[ConstraintElimination] Add test case for PR54217.

Adds test case for https://github.com/llvm/llvm-project/issues/54217.
This commit is contained in:
Florian Hahn 2022-03-07 12:01:09 +00:00
parent ebd9f44584
commit 12ffa9c2aa
No known key found for this signature in database
GPG Key ID: EEF712BB5E80EBBA
1 changed files with 29 additions and 0 deletions

View File

@ -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
}