source: icGREP/icgrep-devel/llvm-3.8.0.src/test/Analysis/BasicAA/phi-aa.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 2.0 KB
Line 
1; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
2target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3target triple = "x86_64-unknown-linux-gnu"
4
5; rdar://7282591
6
7@X = common global i32 0
8@Y = common global i32 0
9@Z = common global i32 0
10
11; CHECK-LABEL: foo
12; CHECK:  NoAlias: i32* %P, i32* @Z
13
14define void @foo(i32 %cond) nounwind {
15entry:
16  %"alloca point" = bitcast i32 0 to i32
17  %tmp = icmp ne i32 %cond, 0
18  br i1 %tmp, label %bb, label %bb1
19
20bb:
21  br label %bb2
22
23bb1:
24  br label %bb2
25
26bb2:
27  %P = phi i32* [ @X, %bb ], [ @Y, %bb1 ]
28  %tmp1 = load i32, i32* @Z, align 4
29  store i32 123, i32* %P, align 4
30  %tmp2 = load i32, i32* @Z, align 4
31  br label %return
32
33return:
34  ret void
35}
36
37; Pointers can vary in between iterations of loops.
38; PR18068
39
40; CHECK-LABEL: pr18068
41; CHECK: MayAlias: i32* %0, i32* %arrayidx5
42; CHECK: NoAlias: i32* %arrayidx13, i32* %arrayidx5
43
44define i32 @pr18068(i32* %jj7, i32* %j) {
45entry:
46  %oa5 = alloca [100 x i32], align 16
47  br label %codeRepl
48
49codeRepl:
50  %0 = phi i32* [ %arrayidx13, %for.body ], [ %j, %entry ]
51  %targetBlock = call i1 @cond(i32* %jj7)
52  br i1 %targetBlock, label %for.body, label %bye
53
54for.body:
55  %1 = load i32, i32* %jj7, align 4
56  %idxprom4 = zext i32 %1 to i64
57  %arrayidx5 = getelementptr inbounds [100 x i32], [100 x i32]* %oa5, i64 0, i64 %idxprom4
58  %2 = load i32, i32* %arrayidx5, align 4
59  %sub6 = sub i32 %2, 6
60  store i32 %sub6, i32* %arrayidx5, align 4
61  ; %0 and %arrayidx5 can alias! It is not safe to DSE the above store.
62  %3 = load i32, i32* %0, align 4
63  store i32 %3, i32* %arrayidx5, align 4
64  %sub11 = add i32 %1, -1
65  %idxprom12 = zext i32 %sub11 to i64
66  %arrayidx13 = getelementptr inbounds [100 x i32], [100 x i32]* %oa5, i64 0, i64 %idxprom12
67  call void @inc(i32* %jj7)
68  br label %codeRepl
69
70bye:
71  %.reload = load i32, i32* %jj7, align 4
72  ret i32 %.reload
73}
74
75declare i1 @cond(i32*)
76
77declare void @inc(i32*)
78
79
Note: See TracBrowser for help on using the repository browser.