1; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s 2; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s 3; 4; Test that various function attributes give us sane results. 5 6@g = external global i32 7 8declare void @readonlyFunction() readonly 9declare void @noattrsFunction() 10 11define void @readonlyAttr() { 12; CHECK: 1 = MemoryDef(liveOnEntry) 13; CHECK-NEXT: store i32 0 14 store i32 0, i32* @g, align 4 15 16 %1 = alloca i32, align 4 17; CHECK: 2 = MemoryDef(1) 18; CHECK-NEXT: store i32 0 19 store i32 0, i32* %1, align 4 20 21; CHECK: MemoryUse(1) 22; CHECK-NEXT: call void @readonlyFunction() 23 call void @readonlyFunction() 24 25; CHECK: MemoryUse(1) 26; CHECK-NEXT: call void @noattrsFunction() # 27; Assume that #N is readonly 28 call void @noattrsFunction() readonly 29 30 ; Sanity check that noattrsFunction is otherwise a MemoryDef 31; CHECK: 3 = MemoryDef(2) 32; CHECK-NEXT: call void @noattrsFunction() 33 call void @noattrsFunction() 34 ret void 35} 36 37declare void @argMemOnly(i32*) argmemonly 38 39define void @inaccessableOnlyAttr() { 40 %1 = alloca i32, align 4 41; CHECK: 1 = MemoryDef(liveOnEntry) 42; CHECK-NEXT: store i32 0 43 store i32 0, i32* %1, align 4 44 45; CHECK: 2 = MemoryDef(1) 46; CHECK-NEXT: store i32 0 47 store i32 0, i32* @g, align 4 48 49; CHECK: MemoryUse(1) 50; CHECK-NEXT: call void @argMemOnly(i32* %1) # 51; Assume that #N is readonly 52 call void @argMemOnly(i32* %1) readonly 53 54; CHECK: 3 = MemoryDef(2) 55; CHECK-NEXT: call void @argMemOnly(i32* %1) 56 call void @argMemOnly(i32* %1) 57 58 ret void 59} 60