1 ; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
3 ; Test that various function attributes give us sane results.
5 @g = external global i32
7 declare void @readonlyFunction() readonly
8 declare void @noattrsFunction()
10 define void @readonlyAttr() {
11 ; CHECK: 1 = MemoryDef(liveOnEntry)
12 ; CHECK-NEXT: store i32 0
13 store i32 0, ptr @g, align 4
15 %1 = alloca i32, align 4
16 ; CHECK: 2 = MemoryDef(1)
17 ; CHECK-NEXT: store i32 0
18 store i32 0, ptr %1, align 4
21 ; CHECK-NEXT: call void @readonlyFunction()
22 call void @readonlyFunction()
25 ; CHECK-NEXT: call void @noattrsFunction() #
26 ; Assume that #N is readonly
27 call void @noattrsFunction() readonly
29 ; Verify that noattrsFunction is otherwise a MemoryDef
30 ; CHECK: 3 = MemoryDef(2)
31 ; CHECK-NEXT: call void @noattrsFunction()
32 call void @noattrsFunction()
36 declare void @argMemOnly(ptr) argmemonly
38 define void @inaccessableOnlyAttr() {
39 %1 = alloca i32, align 4
40 ; CHECK: 1 = MemoryDef(liveOnEntry)
41 ; CHECK-NEXT: store i32 0
42 store i32 0, ptr %1, align 4
44 ; CHECK: 2 = MemoryDef(1)
45 ; CHECK-NEXT: store i32 0
46 store i32 0, ptr @g, align 4
49 ; CHECK-NEXT: call void @argMemOnly(ptr %1) #
50 ; Assume that #N is readonly
51 call void @argMemOnly(ptr %1) readonly
53 ; CHECK: 3 = MemoryDef(2)
54 ; CHECK-NEXT: call void @argMemOnly(ptr %1)
55 call void @argMemOnly(ptr %1)