comparison test/Analysis/BasicAA/phi-speculation.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 95c75e76d11b
children
comparison
equal deleted inserted replaced
84:f3e34b893a5f 95:afa8332a0e37
6 ; ptr_phi and ptr2_phi do not alias. 6 ; ptr_phi and ptr2_phi do not alias.
7 ; CHECK: test_noalias_1 7 ; CHECK: test_noalias_1
8 ; CHECK: NoAlias: i32* %ptr2_phi, i32* %ptr_phi 8 ; CHECK: NoAlias: i32* %ptr2_phi, i32* %ptr_phi
9 define i32 @test_noalias_1(i32* %ptr2, i32 %count, i32* %coeff) { 9 define i32 @test_noalias_1(i32* %ptr2, i32 %count, i32* %coeff) {
10 entry: 10 entry:
11 %ptr = getelementptr inbounds i32* %ptr2, i64 1 11 %ptr = getelementptr inbounds i32, i32* %ptr2, i64 1
12 br label %while.body 12 br label %while.body
13 13
14 while.body: 14 while.body:
15 %num = phi i32 [ %count, %entry ], [ %dec, %while.body ] 15 %num = phi i32 [ %count, %entry ], [ %dec, %while.body ]
16 %ptr_phi = phi i32* [ %ptr, %entry ], [ %ptr_inc, %while.body ] 16 %ptr_phi = phi i32* [ %ptr, %entry ], [ %ptr_inc, %while.body ]
17 %ptr2_phi = phi i32* [ %ptr2, %entry ], [ %ptr2_inc, %while.body ] 17 %ptr2_phi = phi i32* [ %ptr2, %entry ], [ %ptr2_inc, %while.body ]
18 %result.09 = phi i32 [ 0 , %entry ], [ %add, %while.body ] 18 %result.09 = phi i32 [ 0 , %entry ], [ %add, %while.body ]
19 %dec = add nsw i32 %num, -1 19 %dec = add nsw i32 %num, -1
20 %0 = load i32* %ptr_phi, align 4 20 %0 = load i32, i32* %ptr_phi, align 4
21 store i32 %0, i32* %ptr2_phi, align 4 21 store i32 %0, i32* %ptr2_phi, align 4
22 %1 = load i32* %coeff, align 4 22 %1 = load i32, i32* %coeff, align 4
23 %2 = load i32* %ptr_phi, align 4 23 %2 = load i32, i32* %ptr_phi, align 4
24 %mul = mul nsw i32 %1, %2 24 %mul = mul nsw i32 %1, %2
25 %add = add nsw i32 %mul, %result.09 25 %add = add nsw i32 %mul, %result.09
26 %tobool = icmp eq i32 %dec, 0 26 %tobool = icmp eq i32 %dec, 0
27 %ptr_inc = getelementptr inbounds i32* %ptr_phi, i64 1 27 %ptr_inc = getelementptr inbounds i32, i32* %ptr_phi, i64 1
28 %ptr2_inc = getelementptr inbounds i32* %ptr2_phi, i64 1 28 %ptr2_inc = getelementptr inbounds i32, i32* %ptr2_phi, i64 1
29 br i1 %tobool, label %the_exit, label %while.body 29 br i1 %tobool, label %the_exit, label %while.body
30 30
31 the_exit: 31 the_exit:
32 ret i32 %add 32 ret i32 %add
33 } 33 }
35 ; CHECK: test_noalias_2 35 ; CHECK: test_noalias_2
36 ; CHECK: NoAlias: i32* %ptr_outer_phi, i32* %ptr_outer_phi2 36 ; CHECK: NoAlias: i32* %ptr_outer_phi, i32* %ptr_outer_phi2
37 ; CHECK: NoAlias: i32* %ptr2_phi, i32* %ptr_phi 37 ; CHECK: NoAlias: i32* %ptr2_phi, i32* %ptr_phi
38 define i32 @test_noalias_2(i32* %ptr2, i32 %count, i32* %coeff) { 38 define i32 @test_noalias_2(i32* %ptr2, i32 %count, i32* %coeff) {
39 entry: 39 entry:
40 %ptr = getelementptr inbounds i32* %ptr2, i64 1 40 %ptr = getelementptr inbounds i32, i32* %ptr2, i64 1
41 br label %outer.while.header 41 br label %outer.while.header
42 42
43 outer.while.header: 43 outer.while.header:
44 %ptr_outer_phi = phi i32* [%ptr_inc_outer, %outer.while.backedge], [ %ptr, %entry] 44 %ptr_outer_phi = phi i32* [%ptr_inc_outer, %outer.while.backedge], [ %ptr, %entry]
45 %ptr_outer_phi2 = phi i32* [%ptr2_inc_outer, %outer.while.backedge], [ %ptr2, %entry] 45 %ptr_outer_phi2 = phi i32* [%ptr2_inc_outer, %outer.while.backedge], [ %ptr2, %entry]
50 %num = phi i32 [ %count, %outer.while.header ], [ %dec, %while.body ] 50 %num = phi i32 [ %count, %outer.while.header ], [ %dec, %while.body ]
51 %ptr_phi = phi i32* [ %ptr_outer_phi, %outer.while.header ], [ %ptr_inc, %while.body ] 51 %ptr_phi = phi i32* [ %ptr_outer_phi, %outer.while.header ], [ %ptr_inc, %while.body ]
52 %ptr2_phi = phi i32* [ %ptr_outer_phi2, %outer.while.header ], [ %ptr2_inc, %while.body ] 52 %ptr2_phi = phi i32* [ %ptr_outer_phi2, %outer.while.header ], [ %ptr2_inc, %while.body ]
53 %result.09 = phi i32 [ 0 , %outer.while.header ], [ %add, %while.body ] 53 %result.09 = phi i32 [ 0 , %outer.while.header ], [ %add, %while.body ]
54 %dec = add nsw i32 %num, -1 54 %dec = add nsw i32 %num, -1
55 %0 = load i32* %ptr_phi, align 4 55 %0 = load i32, i32* %ptr_phi, align 4
56 store i32 %0, i32* %ptr2_phi, align 4 56 store i32 %0, i32* %ptr2_phi, align 4
57 %1 = load i32* %coeff, align 4 57 %1 = load i32, i32* %coeff, align 4
58 %2 = load i32* %ptr_phi, align 4 58 %2 = load i32, i32* %ptr_phi, align 4
59 %mul = mul nsw i32 %1, %2 59 %mul = mul nsw i32 %1, %2
60 %add = add nsw i32 %mul, %result.09 60 %add = add nsw i32 %mul, %result.09
61 %tobool = icmp eq i32 %dec, 0 61 %tobool = icmp eq i32 %dec, 0
62 %ptr_inc = getelementptr inbounds i32* %ptr_phi, i64 1 62 %ptr_inc = getelementptr inbounds i32, i32* %ptr_phi, i64 1
63 %ptr2_inc = getelementptr inbounds i32* %ptr2_phi, i64 1 63 %ptr2_inc = getelementptr inbounds i32, i32* %ptr2_phi, i64 1
64 br i1 %tobool, label %outer.while.backedge, label %while.body 64 br i1 %tobool, label %outer.while.backedge, label %while.body
65 65
66 outer.while.backedge: 66 outer.while.backedge:
67 %ptr_inc_outer = getelementptr inbounds i32* %ptr_phi, i64 1 67 %ptr_inc_outer = getelementptr inbounds i32, i32* %ptr_phi, i64 1
68 %ptr2_inc_outer = getelementptr inbounds i32* %ptr2_phi, i64 1 68 %ptr2_inc_outer = getelementptr inbounds i32, i32* %ptr2_phi, i64 1
69 %dec.outer = add nsw i32 %num.outer, -1 69 %dec.outer = add nsw i32 %num.outer, -1
70 %br.cond = icmp eq i32 %dec.outer, 0 70 %br.cond = icmp eq i32 %dec.outer, 0
71 br i1 %br.cond, label %the_exit, label %outer.while.header 71 br i1 %br.cond, label %the_exit, label %outer.while.header
72 72
73 the_exit: 73 the_exit: