xref: /llvm-project/llvm/test/Transforms/ConstraintElimination/debug.ll (revision 26fbdff458ed8a829f732074c06f289b92867a82)
1; RUN: opt -passes=constraint-elimination -S -debug %s 2>&1 | FileCheck %s
2
3; REQUIRES: asserts
4
5define i1 @test_and_ule(i4 %x, i4 %y, i4 %z) {
6; CHECK:      Processing fact to add to the system: icmp ule i4 %x, %y
7; CHECK-NEXT: Adding 'icmp ule i4 %x, %y'
8; CHECK-NEXT:  constraint: %x + -1 * %y <= 0
9
10; CHECK:      Processing fact to add to the system: icmp ule i4 %y, %z
11; CHECK-NEXT: Adding 'icmp ule i4 %y, %z'
12; CHECK-NEXT:  constraint: %y + -1 * %z <= 0
13
14; CHECK: Checking   %t.1 = icmp ule i4 %x, %z
15; CHECK: Condition icmp ule i4 %x, %z implied by dominating constraints
16
17; CHECK: Removing %y + -1 * %z <= 0
18; CHECK: Removing %x + -1 * %y <= 0
19
20entry:
21  %c.1 = icmp ule i4 %x, %y
22  %c.2 = icmp ule i4 %y, %z
23  %and = and i1 %c.1, %c.2
24  br i1 %and, label %bb1, label %exit
25
26bb1:
27  %t.1 = icmp ule i4 %x, %z
28  ret i1 %t.1
29
30exit:
31  %c.3 = icmp ule i4 %x, %z
32  ret i1 %c.3
33}
34
35define i1 @test_and_ugt(i4 %x, i4 %y, i4 %z) {
36; CHECK:      Processing fact to add to the system: icmp ugt i4 %x, %y
37; CHECK-NEXT: Adding 'icmp ugt i4 %x, %y'
38; CHECK-NEXT:  constraint: -1 * %x + %y <= -1
39
40; CHECK:      Processing fact to add to the system: icmp ugt i4 %y, %z
41; CHECK-NEXT: Adding 'icmp ugt i4 %y, %z'
42; CHECK-NEXT:  constraint: -1 * %y + %z <= -1
43
44; CHECK: Checking   %f.1 = icmp ule i4 %x, %z
45; CHECK: Condition icmp ugt i4 %x, %z implied by dominating constraints
46
47; CHECK: Removing -1 * %y + %z <= -1
48; CHECK: Removing -1 * %x + %y <= -1
49
50entry:
51  %c.1 = icmp ugt i4 %x, %y
52  %c.2 = icmp ugt i4 %y, %z
53  %and = and i1 %c.1, %c.2
54  br i1 %and, label %bb1, label %exit
55
56bb1:
57  %f.1 = icmp ule i4 %x, %z
58  ret i1 %f.1
59
60exit:
61  %c.3 = icmp ule i4 %x, %z
62  ret i1 %c.3
63}
64