1 ; RUN: opt < %s -globals-aa -aa-eval -print-all-alias-modref-info -S 2>&1 | FileCheck %s 2 3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 4 target triple = "x86_64-apple-macosx10.10.0" 5 6 @a = internal global i32 0, align 4 7 @b = internal global i32 0, align 4 8 9 define void @g(i32* %p, void (i32*)* nocapture %ptr) { 10 entry: 11 tail call void %ptr(i32* %p) #1 12 ret void 13 } 14 15 ; CHECK-LABEL: Function: f 16 ; CHECK: MayAlias: i32* %p, i32* @a 17 ; CHECK: MayAlias: i32* %q, i32* @a 18 define i32 @f(i32 %n, i32* nocapture readonly %p, i32* nocapture %q, void (i32*)* nocapture %ptr) { 19 entry: 20 tail call void @g(i32* nonnull @a, void (i32*)* %ptr) 21 %arrayidx = getelementptr inbounds i32, i32* %p, i64 0 22 %z1 = load i32, i32* %arrayidx, align 4 23 %z2 = load i32, i32* %q, align 4 24 %add = add nsw i32 %z2, %z1 25 store i32 %add, i32* %q, align 4 26 ret i32 4 27 } 28 29 define void @g2(i32* nocapture %p, void (i32*)* nocapture %ptr) { 30 entry: 31 tail call void %ptr(i32* %p) #1 32 ret void 33 } 34 35 ; CHECK-LABEL: Function: f2 36 ; CHECK: NoAlias: i32* %p, i32* @b 37 ; CHECK: NoAlias: i32* %q, i32* @b 38 define i32 @f2(i32 %n, i32* nocapture readonly %p, i32* nocapture %q, void (i32*)* nocapture %ptr) { 39 entry: 40 tail call void @g2(i32* nonnull @b, void (i32*)* %ptr) 41 %arrayidx = getelementptr inbounds i32, i32* %p, i64 0 42 %z1 = load i32, i32* %arrayidx, align 4 43 %z2 = load i32, i32* %q, align 4 44 %add = add nsw i32 %z2, %z1 45 store i32 %add, i32* %q, align 4 46 ret i32 4 47 } 48