1 ; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
3 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
5 ; Check that geps with equal base offsets of noalias base pointers stay noalias.
6 define i32 @test(ptr %p, i16 %i) {
7 ; CHECK-LABEL: Function: test:
8 %pi.next = getelementptr i32, ptr %p, i32 1
10 br i1 %b, label %bb1, label %bb2
13 %f = getelementptr i32, ptr %p, i32 1
14 %g = getelementptr i32, ptr %pi.next, i32 1
17 %f2 = getelementptr i32, ptr %p, i32 1
18 %g2 = getelementptr i32, ptr %pi.next, i32 1
22 %ptr_phi = phi ptr [ %f, %bb1 ], [ %f2, %bb2 ]
23 %ptr_phi2 = phi ptr [ %g, %bb1 ], [ %g2, %bb2 ]
24 ; CHECK: NoAlias: i32* %f1, i32* %g1
25 %f1 = getelementptr i32, ptr %ptr_phi , i32 1
26 %g1 = getelementptr i32, ptr %ptr_phi2 , i32 1
27 ; This should also work if the access size is not the same.
28 ; CHECK: NoAlias: i32* %f1, i16* %g1
36 ; Check that geps with equal indices of noalias base pointers stay noalias.
37 define i32 @test2(ptr %p, i32 %i) {
38 ; CHECK-LABEL: Function: test2:
39 %pi.next = getelementptr [2 x i32], ptr %p, i32 1
40 %b = icmp eq i32 %i, 0
41 br i1 %b, label %bb1, label %bb2
44 %f = getelementptr [2 x i32], ptr %p, i32 1
45 %g = getelementptr [2 x i32], ptr %pi.next, i32 1
48 %f2 = getelementptr [2 x i32], ptr %p, i32 1
49 %g2 = getelementptr [2 x i32], ptr %pi.next, i32 1
52 %ptr_phi = phi ptr [ %f, %bb1 ], [ %f2, %bb2 ]
53 %ptr_phi2 = phi ptr [ %g, %bb1 ], [ %g2, %bb2 ]
54 ; CHECK: NoAlias: i32* %f1, i32* %g1
55 %f1 = getelementptr [2 x i32], ptr %ptr_phi , i32 1, i32 %i
56 %g1 = getelementptr [2 x i32], ptr %ptr_phi2 , i32 1, i32 %i