xref: /llvm-project/llvm/test/Transforms/ConstraintElimination/empty-constraint.ll (revision 13ffde316a8541d77116bd18f73efada236617f3)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
3
4; Make sure constraints where all variable coefficients are 0 are handled
5; properly.
6
7define i1 @test_1_always_false(i32 %A, i32 %B) {
8; CHECK-LABEL: @test_1_always_false(
9; CHECK-NEXT:    br i1 false, label [[IF_END_I16:%.*]], label [[IF_THEN_I10:%.*]]
10; CHECK:       if.then.i10:
11; CHECK-NEXT:    ret i1 false
12; CHECK:       if.end.i16:
13; CHECK-NEXT:    ret i1 false
14;
15  %c.1 = icmp ugt i32 %A, %A
16  br i1 %c.1, label %if.end.i16, label %if.then.i10
17
18if.then.i10:
19  ret i1 false
20
21if.end.i16:
22  %c.2 = icmp ugt i32 %A, %A
23  ret i1 %c.2
24}
25
26define i1 @test_2_always_true(i32 %A, i32 %B) {
27; CHECK-LABEL: @test_2_always_true(
28; CHECK-NEXT:    [[C_1:%.*]] = icmp uge i32 [[A:%.*]], [[B:%.*]]
29; CHECK-NEXT:    br i1 [[C_1]], label [[IF_END_I16:%.*]], label [[IF_THEN_I10:%.*]]
30; CHECK:       if.then.i10:
31; CHECK-NEXT:    ret i1 false
32; CHECK:       if.end.i16:
33; CHECK-NEXT:    ret i1 true
34;
35  %c.1 = icmp uge i32 %A, %B
36  br i1 %c.1, label %if.end.i16, label %if.then.i10
37
38if.then.i10:
39  ret i1 false
40
41if.end.i16:
42  %c.2 = icmp uge i32 %A, %A
43  ret i1 %c.2
44}
45