[llvm] 9871486 - [InstCombine] Add multiuse tests for canonicalizing (icmp eq/ne (and x, y), {x,y}); NFC
Noah Goldstein via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 00:38:36 PDT 2024
Author: Noah Goldstein
Date: 2024-05-29T02:38:22-05:00
New Revision: 98714866830f505d7bb87de6b92a28f280a34b9b
URL: https://github.com/llvm/llvm-project/commit/98714866830f505d7bb87de6b92a28f280a34b9b
DIFF: https://github.com/llvm/llvm-project/commit/98714866830f505d7bb87de6b92a28f280a34b9b.diff
LOG: [InstCombine] Add multiuse tests for canonicalizing (icmp eq/ne (and x, y), {x,y}); NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/icmp-of-and-x.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/icmp-of-and-x.ll b/llvm/test/Transforms/InstCombine/icmp-of-and-x.ll
index e95c72b75f97d..75070e5a34f94 100644
--- a/llvm/test/Transforms/InstCombine/icmp-of-and-x.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-of-and-x.ll
@@ -3,6 +3,7 @@
declare i1 @barrier()
declare void @llvm.assume(i1)
+declare void @use.i8(i8)
define i1 @icmp_ult_x_y(i8 %x, i8 %y) {
; CHECK-LABEL: @icmp_ult_x_y(
@@ -262,6 +263,21 @@ define i1 @icmp_eq_x_invertable_y(i8 %x, i8 %y) {
ret i1 %r
}
+define i1 @icmp_eq_x_invertable_y_fail_multiuse(i8 %x, i8 %y) {
+; CHECK-LABEL: @icmp_eq_x_invertable_y_fail_multiuse(
+; CHECK-NEXT: [[YY:%.*]] = xor i8 [[Y:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i8 [[YY]], [[X:%.*]]
+; CHECK-NEXT: call void @use.i8(i8 [[AND]])
+; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[AND]], [[X]]
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %yy = xor i8 %y, -1
+ %and = and i8 %x, %yy
+ call void @use.i8(i8 %and)
+ %r = icmp eq i8 %x, %and
+ ret i1 %r
+}
+
define i1 @icmp_eq_x_invertable_y2_todo(i8 %x, i1 %y) {
; CHECK-LABEL: @icmp_eq_x_invertable_y2_todo(
; CHECK-NEXT: [[YY:%.*]] = select i1 [[Y:%.*]], i8 7, i8 24
More information about the llvm-commits
mailing list