1 ; This testcase consists of alias relations which should be completely 2 ; resolvable by cfl-steens-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-steens-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 CFLSteensAA. 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 20 define 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 32 define 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 CFLSteensAA 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 48 define 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 } 58