Skip to content

AArch64: Improve ArrayCopyBNDCHKEvaluator #6431

Closed

Description

@knn-k

ArrayCopyBNDCHK nodes often take the following form, i.e. compare the result of a subtraction against immediate 0:

------------------------------
 n3643n   (  0)  ArrayCopyBNDCHK [#1]
 n3642n   (  1)    isub (cannotOverflow )
 n3638n   (  1)      ==>iloadi (X>=0 cannotOverflow )
 n740n    (  3)      ==>iloadi (cannotOverflow )
 n3640n   (  3)    ==>iconst 0 (X==0 X>=0 X<=0 )
------------------------------

ArrayCopyBNDCHKEvaluator for AArch64 generates code like the following in this case.

    0xffff9d23a220 000005fc [    0xffff97bbcba0] 4b0b0000 26 	subw 	w0, w0, w11
    0xffff9d23a224 00000600 [    0xffff97bbcc30] 7100001f 26 	cmpimmw 	w0, 0
    0xffff9d23a228 00000604 [    0xffff97bbcd10] 54007deb 26 	b.lt 	Snippet Label L0513 (Helper Call Snippet)

You can save one instruction here by changing it to:

	cmpw	w0, w11
	b.lt	Snippet Label L0513

Activity

  1. added 2 commits that reference this issue on Mar 31, 2022
    e449c72
    e1b6918
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions