1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 08:23:21 +01:00
llvm-mirror/test/Transforms/Sink/basic.ll
Eli Friedman 2f99e7b97a Fix test; sorry for any inconvenience.
llvm-svn: 138966
2011-09-01 21:25:42 +00:00

39 lines
709 B
LLVM

; RUN: opt < %s -basicaa -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
}
; But don't sink volatile loads...
; CHECK: @foo2
; CHECK: load volatile
; CHECK-NEXT: store i32
define i32 @foo2(i1 %z) {
%l = load volatile i32* @A
store i32 0, i32* @B
br i1 %z, label %true, label %false
true:
ret i32 %l
false:
ret i32 0
}