Teach reassociate to commute FMul's and FAdd's in order to canonicalize the order...
[oota-llvm.git] / test / Transforms / CorrelatedValuePropagation / range.ll
1 ; RUN: opt -correlated-propagation -S < %s | FileCheck %s
2
3 declare i32 @foo()
4
5 define i32 @test1(i32 %a) nounwind {
6   %a.off = add i32 %a, -8
7   %cmp = icmp ult i32 %a.off, 8
8   br i1 %cmp, label %then, label %else
9
10 then:
11   %dead = icmp eq i32 %a, 7
12   br i1 %dead, label %end, label %else
13
14 else:
15   ret i32 1
16
17 end:
18   ret i32 2
19
20 ; CHECK: @test1
21 ; CHECK: then:
22 ; CHECK-NEXT: br i1 false, label %end, label %else
23 }
24
25 define i32 @test2(i32 %a) nounwind {
26   %a.off = add i32 %a, -8
27   %cmp = icmp ult i32 %a.off, 8
28   br i1 %cmp, label %then, label %else
29
30 then:
31   %dead = icmp ugt i32 %a, 15
32   br i1 %dead, label %end, label %else
33
34 else:
35   ret i32 1
36
37 end:
38   ret i32 2
39
40 ; CHECK: @test2
41 ; CHECK: then:
42 ; CHECK-NEXT: br i1 false, label %end, label %else
43 }