summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Util/MemorySSA/load-invariant.ll
blob: 188a4c46d32d70421efb49c61fb737c1ef987c1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
; XFAIL: *
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
;
; Invariant loads should be considered live on entry, because, once the
; location is known to be dereferenceable, the value can never change.
;
; Currently XFAILed because this optimization was held back from the initial
; commit.

@g = external global i32

declare void @clobberAllTheThings()

define i32 @foo() {
; CHECK: 1 = MemoryDef(liveOnEntry)
; CHECK-NEXT: call void @clobberAllTheThings()
  call void @clobberAllTheThings()
; CHECK: MemoryUse(liveOnEntry)
; CHECK-NEXT: %1 = load i32
  %1 = load i32, i32* @g, align 4, !invariant.load !0
  ret i32 %1
}

!0 = !{}
OpenPOWER on IntegriCloud