Skip to content

Commit 12ffa9c

Browse files
committed
[ConstraintElimination] Add test case for PR54217.
Adds test case for llvm#54217.
1 parent ebd9f44 commit 12ffa9c

File tree

1 file changed

+29
-0
lines changed
  • llvm/test/Transforms/ConstraintElimination

1 file changed

+29
-0
lines changed

llvm/test/Transforms/ConstraintElimination/assumes.ll

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,34 @@ else:
152152
ret i1 %res.4
153153
}
154154

155+
; Test case from PR54217.
156+
define i1 @assume_does_not_dominates_successor_with_may_unwind_call_before_assume(i16 %a, i1 %i.0) {
157+
; CHECK-LABEL: @assume_does_not_dominates_successor_with_may_unwind_call_before_assume(
158+
; CHECK-NEXT: entry:
159+
; CHECK-NEXT: br i1 [[I_0:%.*]], label [[EXIT:%.*]], label [[IF_THEN:%.*]]
160+
; CHECK: if.then:
161+
; CHECK-NEXT: call void @may_unwind()
162+
; CHECK-NEXT: [[C_1:%.*]] = icmp eq i16 [[A:%.*]], 0
163+
; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]])
164+
; CHECK-NEXT: br label [[EXIT]]
165+
; CHECK: exit:
166+
; CHECK-NEXT: [[C_2:%.*]] = icmp eq i16 [[A]], 0
167+
; CHECK-NEXT: ret i1 true
168+
;
169+
entry:
170+
br i1 %i.0, label %exit, label %if.then
171+
172+
if.then:
173+
call void @may_unwind()
174+
%c.1 = icmp eq i16 %a, 0
175+
call void @llvm.assume(i1 %c.1)
176+
br label %exit
177+
178+
exit:
179+
%c.2 = icmp eq i16 %a, 0
180+
ret i1 %c.2
181+
}
182+
155183
define i1 @assume_single_bb(i8 %a, i8 %b, i1 %c) {
156184
; CHECK-LABEL: @assume_single_bb(
157185
; 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) {
489517
%res.2 = xor i1 %res.1, %c.2
490518
ret i1 %res.2
491519
}
520+

0 commit comments

Comments
 (0)