source: icGREP/icgrep-devel/llvm-3.8.0.src/test/Analysis/CFLAliasAnalysis/const-expr-gep.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: 1.8 KB
Line 
1; This testcase consists of alias relations which should be completely
2; resolvable by cfl-aa, but require analysis of getelementptr constant exprs.
3; Derived from BasicAA/2003-12-11-ConstExprGEP.ll
4
5; RUN: opt < %s -disable-basicaa -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s
6
7%T = type { i32, [10 x i8] }
8
9@G = external global %T
10@G2 = external global %T
11
12; TODO: Quite a few of these are MayAlias because we don't yet consider
13; constant offsets in CFLAA. If we start doing so, then we'll need to
14; change these test cases
15
16; CHECK:     Function: test
17; CHECK:     MayAlias: i32* %D, i32* %F
18; CHECK:     MayAlias: i32* %D, i8* %X
19; CHECK:     MayAlias: i32* %F, i8* %X
20define void @test() {
21  %D = getelementptr %T, %T* @G, i64 0, i32 0
22  %F = getelementptr i32, i32* getelementptr (%T, %T* @G, i64 0, i32 0), i64 0
23  %X = getelementptr [10 x i8], [10 x i8]* getelementptr (%T, %T* @G, i64 0, i32 1), i64 0, i64 5
24
25  ret void
26}
27
28; CHECK:     Function: simplecheck
29; CHECK:     MayAlias: i32* %F, i32* %arg0
30; CHECK:     MayAlias: i32* %H, i32* %arg0
31; CHECK:     MayAlias: i32* %F, i32* %H
32define void @simplecheck(i32* %arg0) {
33  %F = getelementptr i32, i32* getelementptr (%T, %T* @G, i64 0, i32 0), i64 0
34  %H = getelementptr %T, %T* @G2, i64 0, i32 0
35
36  ret void
37}
38
39; Ensure that CFLAA properly identifies and handles escaping variables (i.e.
40; globals) in nested ConstantExprs
41
42; CHECK:      Function: checkNesting
43; CHECK:      MayAlias: i32* %A, i32* %arg0
44
45%NestedT = type { [1 x [1 x i32]] }
46@NT = external global %NestedT
47
48define void @checkNesting(i32* %arg0) {
49  %A = getelementptr [1 x i32],
50         [1 x i32]* getelementptr
51           ([1 x [1 x i32]], [1 x [1 x i32]]* getelementptr (%NestedT, %NestedT* @NT, i64 0, i32 0),
52           i64 0,
53           i32 0),
54         i64 0,
55         i32 0
56  ret void
57}
Note: See TracBrowser for help on using the repository browser.