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