1 ; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>' -verify-memoryssa -disable-output < %s 2>&1 | FileCheck %s
3 ; Invariant loads should be considered live on entry, because, once the
4 ; location is known to be dereferenceable, the value can never change.
6 @g = external global i32
8 declare void @clobberAllTheThings()
10 ; CHECK-LABEL: define i32 @foo
12 ; CHECK: 1 = MemoryDef(liveOnEntry)
13 ; CHECK-NEXT: call void @clobberAllTheThings()
14 call void @clobberAllTheThings()
15 ; CHECK: MemoryUse(liveOnEntry)
16 ; CHECK-NEXT: %1 = load i32
17 %1 = load i32, ptr @g, align 4, !invariant.load !0
21 ; CHECK-LABEL: define i32 @bar
22 define i32 @bar(ptr %a) {
23 ; CHECK: 1 = MemoryDef(liveOnEntry)
24 ; CHECK-NEXT: call void @clobberAllTheThings()
25 call void @clobberAllTheThings()
27 ; CHECK: 2 = MemoryDef(1)
28 ; CHECK-NEXT: %1 = load atomic i32
29 %1 = load atomic i32, ptr %a acquire, align 4, !invariant.load !0
32 ; CHECK-NEXT: %2 = load i32
33 %2 = load i32, ptr %a, align 4