1 ; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
3 ; Ensuring that external functions without attributes are MemoryDefs
5 @g = external global i32
6 declare void @modifyG()
9 ; CHECK: MemoryUse(liveOnEntry)
10 ; CHECK-NEXT: %1 = load i32
13 ; CHECK: 1 = MemoryDef(liveOnEntry)
14 ; CHECK-NEXT: store i32 4
15 store i32 4, ptr @g, align 4
17 ; CHECK: 2 = MemoryDef(1)
18 ; CHECK-NEXT: call void @modifyG()
22 ; CHECK-NEXT: %2 = load i32
28 declare void @readEverything() readonly
29 declare void @clobberEverything()
31 ; CHECK-LABEL: define void @bar
33 ; CHECK: 1 = MemoryDef(liveOnEntry)
34 ; CHECK-NEXT: call void @clobberEverything()
35 call void @clobberEverything()
36 br i1 undef, label %if.end, label %if.then
40 ; CHECK-NEXT: call void @readEverything()
41 call void @readEverything()
42 ; CHECK: 2 = MemoryDef(1)
43 ; CHECK-NEXT: call void @clobberEverything()
44 call void @clobberEverything()
48 ; CHECK: 3 = MemoryPhi({%0,1},{if.then,2})
50 ; CHECK-NEXT: call void @readEverything()
51 call void @readEverything()