Make the description of the hotpatch attribute even more generic. Spotted by
[oota-llvm.git] / test / Transforms / CorrelatedValuePropagation / basic.ll
1 ; RUN: opt < %s -correlated-propagation -S | FileCheck %s
2 ; PR2581
3
4 ; CHECK: @test1
5 define i32 @test1(i1 %C) nounwind  {
6         br i1 %C, label %exit, label %body
7
8 body:           ; preds = %0
9 ; CHECK-NOT: select
10         %A = select i1 %C, i32 10, i32 11               ; <i32> [#uses=1]
11 ; CHECK: ret i32 11
12         ret i32 %A
13
14 exit:           ; preds = %0
15 ; CHECK: ret i32 10
16         ret i32 10
17 }
18
19 ; PR4420
20 declare i1 @ext()
21 ; CHECK: @test2
22 define i1 @test2() {
23 entry:
24         %cond = tail call i1 @ext()             ; <i1> [#uses=2]
25         br i1 %cond, label %bb1, label %bb2
26
27 bb1:            ; preds = %entry
28         %cond2 = tail call i1 @ext()            ; <i1> [#uses=1]
29         br i1 %cond2, label %bb3, label %bb2
30
31 bb2:            ; preds = %bb1, %entry
32 ; CHECK-NOT: phi i1
33         %cond_merge = phi i1 [ %cond, %entry ], [ false, %bb1 ]         ; <i1> [#uses=1]
34 ; CHECK: ret i1 false
35         ret i1 %cond_merge
36
37 bb3:            ; preds = %bb1
38         %res = tail call i1 @ext()              ; <i1> [#uses=1]
39 ; CHECK: ret i1 %res
40         ret i1 %res
41 }
42
43 ; PR4855
44 @gv = internal constant i8 7
45 ; CHECK: @test3
46 define i8 @test3(i8* %a) nounwind {
47 entry:
48         %cond = icmp eq i8* %a, @gv
49         br i1 %cond, label %bb2, label %bb
50
51 bb:             ; preds = %entry
52         ret i8 0
53
54 bb2:            ; preds = %entry
55 ; CHECK-NOT: load i8* %a
56         %should_be_const = load i8* %a
57 ; CHECK: ret i8 7
58         ret i8 %should_be_const
59 }
60
61 ; PR1757
62 ; CHECK: @test4
63 define i32 @test4(i32) {
64 EntryBlock:
65 ; CHECK: icmp sgt i32 %0, 2  
66   %.demorgan = icmp sgt i32 %0, 2    
67   br i1 %.demorgan, label %GreaterThanTwo, label %LessThanOrEqualToTwo
68
69 GreaterThanTwo:
70 ; CHECK-NOT: icmp eq i32 %0, 2
71   icmp eq i32 %0, 2
72 ; CHECK: br i1 false
73   br i1 %1, label %Impossible, label %NotTwoAndGreaterThanTwo
74
75 NotTwoAndGreaterThanTwo:
76   ret i32 2
77
78 Impossible:
79   ret i32 1
80
81 LessThanOrEqualToTwo:
82   ret i32 0
83 }