[llvm] 12ffa9c - [ConstraintElimination] Add test case for PR54217.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 04:15:10 PST 2022
Author: Florian Hahn
Date: 2022-03-07T12:01:10Z
New Revision: 12ffa9c2aa3ec374fc8b7a7c158144b24432c9b9
URL: https://github.com/llvm/llvm-project/commit/12ffa9c2aa3ec374fc8b7a7c158144b24432c9b9
DIFF: https://github.com/llvm/llvm-project/commit/12ffa9c2aa3ec374fc8b7a7c158144b24432c9b9.diff
LOG: [ConstraintElimination] Add test case for PR54217.
Adds test case for https://github.com/llvm/llvm-project/issues/54217.
Added:
Modified:
llvm/test/Transforms/ConstraintElimination/assumes.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/ConstraintElimination/assumes.ll b/llvm/test/Transforms/ConstraintElimination/assumes.ll
index f916798188ff8..73a24dd1cac56 100644
--- a/llvm/test/Transforms/ConstraintElimination/assumes.ll
+++ b/llvm/test/Transforms/ConstraintElimination/assumes.ll
@@ -152,6 +152,34 @@ else:
ret i1 %res.4
}
+; Test case from PR54217.
+define i1 @assume_does_not_dominates_successor_with_may_unwind_call_before_assume(i16 %a, i1 %i.0) {
+; CHECK-LABEL: @assume_does_not_dominates_successor_with_may_unwind_call_before_assume(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[I_0:%.*]], label [[EXIT:%.*]], label [[IF_THEN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: call void @may_unwind()
+; CHECK-NEXT: [[C_1:%.*]] = icmp eq i16 [[A:%.*]], 0
+; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]])
+; CHECK-NEXT: br label [[EXIT]]
+; CHECK: exit:
+; CHECK-NEXT: [[C_2:%.*]] = icmp eq i16 [[A]], 0
+; CHECK-NEXT: ret i1 true
+;
+entry:
+ br i1 %i.0, label %exit, label %if.then
+
+if.then:
+ call void @may_unwind()
+ %c.1 = icmp eq i16 %a, 0
+ call void @llvm.assume(i1 %c.1)
+ br label %exit
+
+exit:
+ %c.2 = icmp eq i16 %a, 0
+ ret i1 %c.2
+}
+
define i1 @assume_single_bb(i8 %a, i8 %b, i1 %c) {
; CHECK-LABEL: @assume_single_bb(
; CHECK-NEXT: [[ADD_1:%.*]] = add nuw nsw i8 [[A:%.*]], 1
@@ -489,3 +517,4 @@ define i1 @all_uses_after_assume(i8 %a, i8 %b, i1 %c) {
%res.2 = xor i1 %res.1, %c.2
ret i1 %res.2
}
+
More information about the llvm-commits
mailing list