comparison test/Transforms/InstCombine/store.ll @ 95:afa8332a0e37 LLVM3.8

LLVM 3.8
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Tue, 13 Oct 2015 17:48:58 +0900
parents 60c9769439b8
children 7d135dc70f03
comparison
equal deleted inserted replaced
84:f3e34b893a5f 95:afa8332a0e37
10 ; CHECK-NEXT: store i32 undef, i32* null 10 ; CHECK-NEXT: store i32 undef, i32* null
11 ; CHECK-NEXT: ret void 11 ; CHECK-NEXT: ret void
12 } 12 }
13 13
14 define void @test2(i32* %P) { 14 define void @test2(i32* %P) {
15 %X = load i32* %P ; <i32> [#uses=1] 15 %X = load i32, i32* %P ; <i32> [#uses=1]
16 %Y = add i32 %X, 0 ; <i32> [#uses=1] 16 %Y = add i32 %X, 0 ; <i32> [#uses=1]
17 store i32 %Y, i32* %P 17 store i32 %Y, i32* %P
18 ret void 18 ret void
19 ; CHECK-LABEL: @test2( 19 ; CHECK-LABEL: @test2(
20 ; CHECK-NEXT: ret void 20 ; CHECK-NEXT: ret void
34 Cond2: 34 Cond2:
35 store i32 47, i32* %A 35 store i32 47, i32* %A
36 br label %Cont 36 br label %Cont
37 37
38 Cont: 38 Cont:
39 %V = load i32* %A 39 %V = load i32, i32* %A
40 ret i32 %V 40 ret i32 %V
41 ; CHECK-LABEL: @test3( 41 ; CHECK-LABEL: @test3(
42 ; CHECK-NOT: alloca 42 ; CHECK-NOT: alloca
43 ; CHECK: Cont: 43 ; CHECK: Cont:
44 ; CHECK-NEXT: %storemerge = phi i32 [ 47, %Cond2 ], [ -987654321, %Cond ] 44 ; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %Cond2 ]
45 ; CHECK-NEXT: ret i32 %storemerge 45 ; CHECK-NEXT: ret i32 %storemerge
46 } 46 }
47 47
48 ; "if then" 48 ; "if then"
49 define i32 @test4(i1 %C) { 49 define i32 @test4(i1 %C) {
54 Cond: 54 Cond:
55 store i32 -987654321, i32* %A 55 store i32 -987654321, i32* %A
56 br label %Cont 56 br label %Cont
57 57
58 Cont: 58 Cont:
59 %V = load i32* %A 59 %V = load i32, i32* %A
60 ret i32 %V 60 ret i32 %V
61 ; CHECK-LABEL: @test4( 61 ; CHECK-LABEL: @test4(
62 ; CHECK-NOT: alloca 62 ; CHECK-NOT: alloca
63 ; CHECK: Cont: 63 ; CHECK: Cont:
64 ; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %0 ] 64 ; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %0 ]
90 store i32 42, i32* %gi, align 4, !tbaa !0 90 store i32 42, i32* %gi, align 4, !tbaa !0
91 br label %for.cond 91 br label %for.cond
92 92
93 for.cond: ; preds = %for.body, %entry 93 for.cond: ; preds = %for.body, %entry
94 %storemerge = phi i32 [ 0, %entry ], [ %inc, %for.body ] 94 %storemerge = phi i32 [ 0, %entry ], [ %inc, %for.body ]
95 %0 = load i32* %gi, align 4, !tbaa !0 95 %0 = load i32, i32* %gi, align 4, !tbaa !0
96 %cmp = icmp slt i32 %0, %n 96 %cmp = icmp slt i32 %0, %n
97 br i1 %cmp, label %for.body, label %for.end 97 br i1 %cmp, label %for.body, label %for.end
98 98
99 for.body: ; preds = %for.cond 99 for.body: ; preds = %for.cond
100 %idxprom = sext i32 %0 to i64 100 %idxprom = sext i32 %0 to i64
101 %arrayidx = getelementptr inbounds float* %a, i64 %idxprom 101 %arrayidx = getelementptr inbounds float, float* %a, i64 %idxprom
102 store float 0.000000e+00, float* %arrayidx, align 4, !tbaa !3 102 store float 0.000000e+00, float* %arrayidx, align 4, !tbaa !3
103 %1 = load i32* %gi, align 4, !tbaa !0 103 %1 = load i32, i32* %gi, align 4, !tbaa !0
104 %inc = add nsw i32 %1, 1 104 %inc = add nsw i32 %1, 1
105 store i32 %inc, i32* %gi, align 4, !tbaa !0 105 store i32 %inc, i32* %gi, align 4, !tbaa !0
106 br label %for.cond 106 br label %for.cond
107 107
108 for.end: ; preds = %for.cond 108 for.end: ; preds = %for.cond