; disambiguating some obvious cases. All loads should be removable in
; this testcase.
-; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce \
-; RUN: | llvm-dis | not grep load
+; RUN: opt < %s -basicaa -gvn -instcombine -dce -S | FileCheck %s
@A = global i32 7
@B = global i32 8
+; CHECK: define i32 @test()
+; CHECK-NEXT: store i32 123, i32* @B
+; CHECK-NEXT: ret i32 0
+
define i32 @test() {
%A1 = load i32* @A
ret i32 %X
}
+; CHECK: define i32 @test2()
+; CHECK-NEXT: br label %Loop
+; CHECK: Loop:
+; CHECK-NEXT: store i32 0, i32* @B
+; CHECK-NEXT: br i1 true, label %out, label %Loop
+; CHECK: out:
+; CHECK-NEXT: ret i32 0
+
define i32 @test2() {
%A1 = load i32* @A
br label %Loop
declare void @external()
+; CHECK: define i32 @test3()
+; CHECK-NEXT: call void @external()
+; CHECK-NEXT: ret i32 7
+
define i32 @test3() {
%X = alloca i32
store i32 7, i32* %X