1; RUN: opt -basic-aa -print-memoryssa -verify-memoryssa -enable-new-pm=0 -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 3; 4; Invariant loads should be considered live on entry, because, once the 5; location is known to be dereferenceable, the value can never change. 6 7@g = external global i32 8 9declare void @clobberAllTheThings() 10 11; CHECK-LABEL: define i32 @foo 12define 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 19 ret i32 %1 20} 21 22; CHECK-LABEL: define i32 @bar 23define i32 @bar(i32* %a) { 24; CHECK: 1 = MemoryDef(liveOnEntry) 25; CHECK-NEXT: call void @clobberAllTheThings() 26 call void @clobberAllTheThings() 27 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 31 32; CHECK: MemoryUse(2) 33; CHECK-NEXT: %2 = load i32 34 %2 = load i32, i32* %a, align 4 35 ret i32 %2 36} 37 38!0 = !{} 39