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 ; Ensuring that external functions without attributes are MemoryDefs
6 @g = external global i32
7 declare void @modifyG()
10 ; CHECK: MemoryUse(liveOnEntry)
11 ; CHECK-NEXT: %1 = load i32
12 %1 = load i32, i32* @g
14 ; CHECK: 1 = MemoryDef(liveOnEntry)
15 ; CHECK-NEXT: store i32 4
16 store i32 4, i32* @g, align 4
18 ; CHECK: 2 = MemoryDef(1)
19 ; CHECK-NEXT: call void @modifyG()
23 ; CHECK-NEXT: %2 = load i32
24 %2 = load i32, i32* @g
29 declare void @readEverything() readonly
30 declare void @clobberEverything()
32 ; CHECK-LABEL: define void @bar
34 ; CHECK: 1 = MemoryDef(liveOnEntry)
35 ; CHECK-NEXT: call void @clobberEverything()
36 call void @clobberEverything()
37 br i1 undef, label %if.end, label %if.then
41 ; CHECK-NEXT: call void @readEverything()
42 call void @readEverything()
43 ; CHECK: 2 = MemoryDef(1)
44 ; CHECK-NEXT: call void @clobberEverything()
45 call void @clobberEverything()
49 ; CHECK: 3 = MemoryPhi({%0,1},{if.then,2})
51 ; CHECK-NEXT: call void @readEverything()
52 call void @readEverything()