1 ; RUN: opt %s -S -simplifycfg | FileCheck %s
3 ; cmp1 implies cmp2 is false
5 ; CHECK-NOT: call void @is(i1 true)
6 ; CHECK: call void @is(i1 false)
7 define void @test1(i32 %a) {
8 %cmp1 = icmp eq i32 %a, 0
9 br i1 %cmp1, label %taken, label %untaken
12 %cmp2 = icmp eq i32 %a, 1
13 br i1 %cmp2, label %istrue, label %isfalse
16 call void @is(i1 true)
20 call void @is(i1 false)
27 ; cmp1 implies cmp2 is false
29 ; CHECK-NOT: call void @is(i1 true)
30 ; CHECK: call void @is(i1 false)
31 define void @test2(i32 %a) {
32 %cmp1 = icmp ugt i32 %a, 5
33 br i1 %cmp1, label %untaken, label %taken
36 %cmp2 = icmp ugt i32 %a, 6
37 br i1 %cmp2, label %istrue, label %isfalse
40 call void @is(i1 true)
44 call void @is(i1 false)
51 ; cmp1 implies cmp2 is false
53 ; CHECK-NOT: call void @is(i1 true)
54 ; CHECK: call void @is(i1 false)
55 define void @test3(i32 %a) {
56 %cmp1 = icmp ugt i32 %a, 1
57 br i1 %cmp1, label %taken, label %untaken
60 %cmp2 = icmp eq i32 %a, 0
61 br i1 %cmp2, label %istrue, label %isfalse
64 call void @is(i1 true)
68 call void @is(i1 false)
75 ; cmp1 implies cmp2 is true
77 ; CHECK: call void @is(i1 true)
78 ; CHECK-NOT: call void @is(i1 false)
79 define void @test4(i32 %a) {
80 %cmp1 = icmp sgt i32 %a, 1
81 br i1 %cmp1, label %taken, label %untaken
84 %cmp2 = icmp ugt i32 %a, 0
85 br i1 %cmp2, label %istrue, label %isfalse
88 call void @is(i1 true)
92 call void @is(i1 false)
99 ; cmp1 implies cmp2 is true
100 ; CHECK-LABEL: @test5
101 ; CHECK: call void @is(i1 true)
102 ; CHECK-NOT: call void @is(i1 false)
103 define void @test5(i32 %a) {
104 %cmp1 = icmp sgt i32 %a, 5
105 br i1 %cmp1, label %taken, label %untaken
108 %cmp2 = icmp sgt i32 %a, -1
109 br i1 %cmp2, label %istrue, label %isfalse
112 call void @is(i1 true)
116 call void @is(i1 false)