-
Notifications
You must be signed in to change notification settings - Fork 10.5k
InstructionSimplification: simplify negated integer comparisons #82804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InstructionSimplification: simplify negated integer comparisons #82804
Conversation
@swift-ci test |
@swift-ci apple silicon benchmark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
d7e4213
to
a33cfae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
a33cfae
to
d429bad
Compare
@swift-ci test |
@swift-ci apple silicon benchmark |
d429bad
to
b4d7b68
Compare
@swift-ci test |
So far, only negated comparisons (via xor) were handled. Now, also handle simplified comparisons
That means: make `BuiltinInst` conform to `SILCombineSimplifiable`, but still also run the legacy builtin simplification in SILCombine
Replaces a builtin "xor", which negates its operand comparison ``` %3 = builtin "cmp_slt_Int64"(%1, %2) : $Builtin.Int1 %4 = integer_literal $Builtin.Int1, -1 %5 = builtin "xor_Int1"(%3, %4) : $Builtin.Int1 ``` with the negated comparison ``` %5 = builtin "cmp_ge_Int64"(%1, %2) : $Builtin.Int1 ``` This makes LLVM's IPSCCP happy. rdar://154950810
b4d7b68
to
5064297
Compare
@swift-ci smoke test |
@swift-ci smoke test macos |
1 similar comment
@swift-ci smoke test macos |
Replaces a builtin "xor", which negates its operand comparison
with the negated comparison
This makes LLVM's IPSCCP happy.
rdar://154950810