[llvm] 68fb3d5 - [ConstraintElim] Add test with select where the second op cant be poison.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 21 01:17:22 PST 2023
Author: Florian Hahn
Date: 2023-12-21T09:13:33Z
New Revision: 68fb3d596e451cbb9e40c01d26c4e9af1126ce01
URL: https://github.com/llvm/llvm-project/commit/68fb3d596e451cbb9e40c01d26c4e9af1126ce01
DIFF: https://github.com/llvm/llvm-project/commit/68fb3d596e451cbb9e40c01d26c4e9af1126ce01.diff
LOG: [ConstraintElim] Add test with select where the second op cant be poison.
Extra test for TODO from #75750.
Added:
Modified:
llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll b/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
index 2de7592d5ccc7a..5c49ca0e96f309 100644
--- a/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
+++ b/llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
@@ -478,3 +478,24 @@ entry:
%and = select i1 %c.1, i1 %c.2, i1 false
ret i1 %and
}
+
+define i1 @and_select_second_implies_first_guaranteed_not_poison(ptr noundef %A, ptr noundef %B) {
+; CHECK-LABEL: @and_select_second_implies_first_guaranteed_not_poison(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[C_1:%.*]] = icmp ne ptr [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds ptr, ptr [[B]], i64 -1
+; CHECK-NEXT: [[C_2:%.*]] = icmp ugt ptr [[GEP]], [[A]]
+; CHECK-NEXT: call void @no_noundef(i1 [[C_2]])
+; CHECK-NEXT: [[AND:%.*]] = select i1 [[C_1]], i1 [[C_2]], i1 false
+; CHECK-NEXT: ret i1 [[AND]]
+;
+entry:
+ %c.1 = icmp ne ptr %A, %B
+ %gep = getelementptr inbounds ptr, ptr %B, i64 -1
+ %c.2 = icmp ugt ptr %gep, %A
+ call void @no_noundef(i1 %c.2)
+ %and = select i1 %c.1, i1 %c.2, i1 false
+ ret i1 %and
+}
+
+declare void @no_noundef(i1 noundef)
More information about the llvm-commits
mailing list