1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
7 define i1 @test_pr54228(i32 %a, i32 %b, i1 %i.0, i1 %i.1) {
8 ; CHECK-LABEL: @test_pr54228(
10 ; CHECK-NEXT: br i1 [[I_0:%.*]], label [[PH_1:%.*]], label [[LOOP_HEADER:%.*]]
12 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i32 [[A:%.*]], 0
13 ; CHECK-NEXT: call void @llvm.assume(i1 [[C_1]])
14 ; CHECK-NEXT: br label [[LOOP_HEADER]]
16 ; CHECK-NEXT: br i1 [[I_1:%.*]], label [[LOOP_THEN:%.*]], label [[LOOP_LATCH:%.*]]
18 ; CHECK-NEXT: call void @fn()
19 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i32 [[B:%.*]], 0
20 ; CHECK-NEXT: call void @llvm.assume(i1 [[C_2]])
21 ; CHECK-NEXT: br label [[LOOP_LATCH]]
23 ; CHECK-NEXT: [[C_3:%.*]] = icmp eq i32 [[B]], 1
24 ; CHECK-NEXT: br i1 [[C_3]], label [[EXIT:%.*]], label [[LOOP_HEADER]]
26 ; CHECK-NEXT: [[C_4:%.*]] = icmp eq i32 [[A]], 0
27 ; CHECK-NEXT: ret i1 [[C_4]]
30 br i1 %i.0, label %ph.1, label %loop.header
32 ph.1: ; preds = %entry
33 %c.1 = icmp eq i32 %a, 0
34 call void @llvm.assume(i1 %c.1)
37 loop.header: ; preds = %loop.latch, %ph.1, %entry
38 br i1 %i.1, label %loop.then, label %loop.latch
40 loop.then: ; preds = %loop.header
42 %c.2 = icmp eq i32 %b, 0
43 call void @llvm.assume(i1 %c.2)
46 loop.latch: ; preds = %loop.then, %loop.header
47 %c.3 = icmp eq i32 %b, 1
48 br i1 %c.3, label %exit, label %loop.header
50 exit: ; preds = %loop.latch
51 %c.4 = icmp eq i32 %a, 0
55 declare void @llvm.assume(i1 noundef)