1; RUN: opt < %s -basicaa -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 29ret i32 0 30} 31 32; Check that geps with equal indices of noalias base pointers stay noalias. 33define i32 @test2([2 x i32]* %p, i32 %i) { 34; CHECK-LABEL: Function: test2: 35 %pi = getelementptr [2 x i32], [2 x i32]* %p, i32 0 36 %pi.next = getelementptr [2 x i32], [2 x i32]* %p, i32 1 37 %b = icmp eq i32 %i, 0 38 br i1 %b, label %bb1, label %bb2 39 40bb1: 41 %f = getelementptr [2 x i32], [2 x i32]* %pi, i32 1 42 %g = getelementptr [2 x i32], [2 x i32]* %pi.next, i32 1 43 br label %bb3 44bb2: 45 %f2 = getelementptr [2 x i32], [2 x i32]* %pi, i32 1 46 %g2 = getelementptr [2 x i32], [2 x i32]* %pi.next, i32 1 47 br label %bb3 48bb3: 49 %ptr_phi = phi [2 x i32]* [ %f, %bb1 ], [ %f2, %bb2 ] 50 %ptr_phi2 = phi [2 x i32]* [ %g, %bb1 ], [ %g2, %bb2 ] 51; CHECK: NoAlias: i32* %f1, i32* %g1 52 %f1 = getelementptr [2 x i32], [2 x i32]* %ptr_phi , i32 1, i32 %i 53 %g1 = getelementptr [2 x i32], [2 x i32]* %ptr_phi2 , i32 1, i32 %i 54 55ret i32 0 56} 57