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
4 ; Test that various function attributes give us sane results.
6 @g = external global i32
8 declare void @readonlyFunction() readonly
9 declare void @noattrsFunction()
11 define void @readonlyAttr() {
12 ; CHECK: 1 = MemoryDef(liveOnEntry)
13 ; CHECK-NEXT: store i32 0
14 store i32 0, i32* @g, align 4
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
22 ; CHECK-NEXT: call void @readonlyFunction()
23 call void @readonlyFunction()
26 ; CHECK-NEXT: call void @noattrsFunction() #
27 ; Assume that #N is readonly
28 call void @noattrsFunction() readonly
30 ; Sanity check that noattrsFunction is otherwise a MemoryDef
31 ; CHECK: 3 = MemoryDef(2)
32 ; CHECK-NEXT: call void @noattrsFunction()
33 call void @noattrsFunction()
37 declare void @argMemOnly(i32*) argmemonly
39 define 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
45 ; CHECK: 2 = MemoryDef(1)
46 ; CHECK-NEXT: store i32 0
47 store i32 0, i32* @g, align 4
50 ; CHECK-NEXT: call void @argMemOnly(i32* %1) #
51 ; Assume that #N is readonly
52 call void @argMemOnly(i32* %1) readonly
54 ; CHECK: 3 = MemoryDef(2)
55 ; CHECK-NEXT: call void @argMemOnly(i32* %1)
56 call void @argMemOnly(i32* %1)