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 ; Invariant loads should be considered live on entry, because, once the
5 ; location is known to be dereferenceable, the value can never change.
7 @g = external global i32
9 declare void @clobberAllTheThings()
11 ; CHECK-LABEL: define i32 @foo
13 ; CHECK: 1 = MemoryDef(liveOnEntry)
14 ; CHECK-NEXT: call void @clobberAllTheThings()
15 call void @clobberAllTheThings()
16 ; CHECK: MemoryUse(liveOnEntry)
17 ; CHECK-NEXT: %1 = load i32
18 %1 = load i32, i32* @g, align 4, !invariant.load !0
22 ; CHECK-LABEL: define i32 @bar
23 define i32 @bar(i32* %a) {
24 ; CHECK: 1 = MemoryDef(liveOnEntry)
25 ; CHECK-NEXT: call void @clobberAllTheThings()
26 call void @clobberAllTheThings()
28 ; CHECK: 2 = MemoryDef(1)
29 ; CHECK-NEXT: %1 = load atomic i32
30 %1 = load atomic i32, i32* %a acquire, align 4, !invariant.load !0
33 ; CHECK-NEXT: %2 = load i32
34 %2 = load i32, i32* %a, align 4