1; RUN: opt < %s -basic-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s 2 3target 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" 4 5; Check that geps with equal base offsets of noalias base pointers stay noalias. 6define i32 @test(i32* %p, i16 %i) { 7; CHECK-LABEL: Function: test: 8 %pi = getelementptr i32, i32* %p, i32 0 9 %pi.next = getelementptr i32, i32* %p, i32 1 10 %b = icmp eq i16 %i, 0 11 br i1 %b, label %bb1, label %bb2 12 13bb1: 14 %f = getelementptr i32, i32* %pi, i32 1 15 %g = getelementptr i32, i32* %pi.next, i32 1 16 br label %bb3 17bb2: 18 %f2 = getelementptr i32, i32* %pi, i32 1 19 %g2 = getelementptr i32, i32* %pi.next, i32 1 20 br label %bb3 21 22bb3: 23 %ptr_phi = phi i32* [ %f, %bb1 ], [ %f2, %bb2 ] 24 %ptr_phi2 = phi i32* [ %g, %bb1 ], [ %g2, %bb2 ] 25; CHECK: NoAlias: i32* %f1, i32* %g1 26 %f1 = getelementptr i32, i32* %ptr_phi , i32 1 27 %g1 = getelementptr i32, i32* %ptr_phi2 , i32 1 28; This should also work if the access size is not the same. 29; CHECK: NoAlias: i16* %h1, i32* %f1 30 %h1 = bitcast i32* %g1 to i16* 31 32ret i32 0 33} 34 35; Check that geps with equal indices of noalias base pointers stay noalias. 36define i32 @test2([2 x i32]* %p, i32 %i) { 37; CHECK-LABEL: Function: test2: 38 %pi = getelementptr [2 x i32], [2 x i32]* %p, i32 0 39 %pi.next = getelementptr [2 x i32], [2 x i32]* %p, i32 1 40 %b = icmp eq i32 %i, 0 41 br i1 %b, label %bb1, label %bb2 42 43bb1: 44 %f = getelementptr [2 x i32], [2 x i32]* %pi, i32 1 45 %g = getelementptr [2 x i32], [2 x i32]* %pi.next, i32 1 46 br label %bb3 47bb2: 48 %f2 = getelementptr [2 x i32], [2 x i32]* %pi, i32 1 49 %g2 = getelementptr [2 x i32], [2 x i32]* %pi.next, i32 1 50 br label %bb3 51bb3: 52 %ptr_phi = phi [2 x i32]* [ %f, %bb1 ], [ %f2, %bb2 ] 53 %ptr_phi2 = phi [2 x i32]* [ %g, %bb1 ], [ %g2, %bb2 ] 54; CHECK: NoAlias: i32* %f1, i32* %g1 55 %f1 = getelementptr [2 x i32], [2 x i32]* %ptr_phi , i32 1, i32 %i 56 %g1 = getelementptr [2 x i32], [2 x i32]* %ptr_phi2 , i32 1, i32 %i 57 58ret i32 0 59} 60