llvm-6502/test/Transforms/Sink/basic.ll
Dan Gohman 28a193ed8b Add an LLVM IR version of code sinking. This uses the same simple algorithm
as MachineSink, but it isn't constrained by MachineInstr-level details.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103257 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 15:40:13 +00:00

23 lines
434 B
LLVM

; RUN: opt < %s -sink -S | FileCheck %s
@A = external global i32
@B = external global i32
; Sink should sink the load past the store (which doesn't overlap) into
; the block that uses it.
; CHECK: @foo
; CHECK: true:
; CHECK-NEXT: %l = load i32* @A
; CHECK-NEXT: ret i32 %l
define i32 @foo(i1 %z) {
%l = load i32* @A
store i32 0, i32* @B
br i1 %z, label %true, label %false
true:
ret i32 %l
false:
ret i32 0
}