[llvm] [InstCombine] Fold `(icmp eq/ne (xor x, y), C1)` even if multiuse (PR #87275)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 7 09:54:11 PDT 2024
================
@@ -455,7 +455,7 @@ define i1 @icmp_or_xor_2_4_fail(i64 %x1, i64 %y1, i64 %x2, i64 %y2) {
; CHECK-NEXT: [[XOR1:%.*]] = xor i64 [[X2:%.*]], [[Y2:%.*]]
; CHECK-NEXT: [[OR:%.*]] = or i64 [[XOR]], [[XOR1]]
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[OR]], 0
-; CHECK-NEXT: [[CMP_1:%.*]] = icmp eq i64 [[XOR1]], 0
+; CHECK-NEXT: [[CMP_1:%.*]] = icmp eq i64 [[X2]], [[Y2]]
----------------
goldsteinn wrote:
> Do I understand right that this is because this drops the use count of xor1, which enables an optimization of cmp?
I'm 100% sure what is unlocked.
It could also be we are hitting some analysis pattern in the new form.
>
> We could probably handle this by following a deeper chain inside handleUseCountDecrement(), though I'm not sure that would really be worthwhile. I'm fine with landing this as-is for now.
>
> In any case, it would be good to add a comment to the top of the test to explain why there is the no-verify-fixpoint.
Kk
https://github.com/llvm/llvm-project/pull/87275
More information about the llvm-commits
mailing list