• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; This testcase consists of alias relations on 128-bit pointers that
2; should be completely resolvable by basicaa.
3
4; RUN: opt < %s -basic-aa -aa-eval -print-no-aliases -print-may-aliases -print-must-aliases -disable-output 2>&1 | FileCheck %s
5
6target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-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-p100:128:64:64-p101:128:64:64"
7
8
9; test0 is similar to SimpleCases.ll
10
11%T = type { i32, [10 x i8] }
12
13; CHECK:     Function: test0
14; CHECK-NOT:   MayAlias:
15define void @test0(%T addrspace(100)* %P) {
16  %A = getelementptr %T, %T addrspace(100)* %P, i64 0
17  %B = getelementptr %T, %T addrspace(100)* %P, i64 0, i32 0
18  %C = getelementptr %T, %T addrspace(100)* %P, i64 0, i32 1
19  %D = getelementptr %T, %T addrspace(100)* %P, i64 0, i32 1, i64 0
20  %E = getelementptr %T, %T addrspace(100)* %P, i64 0, i32 1, i64 5
21  ret void
22}
23
24; test1 checks that >64 bits of index can be considered.
25; If BasicAA is truncating the arithmetic, it will conclude
26; that %A and %B must alias when in fact they must not.
27
28; CHECK:     Function: test1
29; CHECK-NOT:   MustAlias:
30; CHECK:       NoAlias:
31; CHECK-SAME:  %A
32; CHECK-SAME:  %B
33define void @test1(double addrspace(100)* %P, i128 %i) {
34  ; 1180591620717411303424 is 2**70
35  ;  590295810358705651712 is 2**69
36  %i70 = add i128 %i, 1180591620717411303424
37  %i69 = add i128 %i, 590295810358705651712
38  %A = getelementptr double, double addrspace(100)* %P, i128 %i70
39  %B = getelementptr double, double addrspace(100)* %P, i128 %i69
40  ret void
41}
42
43; test2 checks that >64 bits of index can be considered
44; and computes the same address in two ways to ensure that
45; they are considered equivalent.
46
47; CHECK: Function: test2
48; CHECK: MustAlias:
49; CHECK-SAME: %A
50; CHECK-SAME: %C
51define void @test2(double addrspace(100)* %P, i128 %i) {
52  ; 1180591620717411303424 is 2**70
53  ;  590295810358705651712 is 2**69
54  %i70 = add i128 %i, 1180591620717411303424
55  %i69 = add i128 %i, 590295810358705651712
56  %j70 = add i128 %i69, 590295810358705651712
57  %A = getelementptr double, double addrspace(100)* %P, i128 %i70
58  %C = getelementptr double, double addrspace(100)* %P, i128 %j70
59  ret void
60}
61