1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
4 ; Make sure we do not incorrectly add variables to the system.
6 define i1 @test(ptr %p1, ptr %p2, i32 %num_rows, i32 %start_row, i1 %c) {
9 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[NUM_ROWS:%.*]], [[START_ROW:%.*]]
10 ; CHECK-NEXT: [[L3:%.*]] = load i32, ptr [[P1:%.*]], align 4
11 ; CHECK-NEXT: [[CMP6:%.*]] = icmp ugt i32 [[L3]], [[START_ROW]]
12 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_END36:%.*]], label [[IF_END36]]
14 ; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[P2:%.*]], align 4
15 ; CHECK-NEXT: [[CMP37:%.*]] = icmp ult i32 [[L1]], [[ADD]]
16 ; CHECK-NEXT: br i1 [[CMP37]], label [[IF_THEN39:%.*]], label [[EXIT:%.*]]
18 ; CHECK-NEXT: [[CMP41:%.*]] = icmp ult i32 [[L1]], [[START_ROW]]
19 ; CHECK-NEXT: ret i1 [[CMP41]]
21 ; CHECK-NEXT: ret i1 false
24 %add = add i32 %num_rows, %start_row
25 %l3 = load i32, ptr %p1, align 4
26 %cmp6 = icmp ugt i32 %l3, %start_row
27 br i1 %c, label %if.end36, label %if.end36
29 if.end36: ; preds = %if.then11
30 %l1 = load i32, ptr %p2, align 4
31 %cmp37 = icmp ult i32 %l1, %add
32 br i1 %cmp37, label %if.then39, label %exit
34 if.then39: ; preds = %if.end36
35 %cmp41 = icmp ult i32 %l1, %start_row
38 exit: ; preds = %if.end36