[x86] Fix the RUN-lines of this test to make sense.
[oota-llvm.git] / test / Analysis / BasicAA / gcsetest.ll
index 0cc0af2932c768c053beb99108c973c821036d7f..64792eb00a2ffeb7cd233e89f8b3eb28986ad65c 100644 (file)
@@ -1,36 +1,61 @@
-; Test that GCSE uses basicaa to do alias analysis, which is capable of 
-; disambiguating some obvious cases.  All loads should be removable in 
+; Test that GCSE uses basicaa to do alias analysis, which is capable of
+; disambiguating some obvious cases.  All loads should be removable in
 ; this testcase.
 
-; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep load
+; RUN: opt < %s -basicaa -gvn -instcombine -dce -S | FileCheck %s
 
-%A = global int 7
-%B = global int 8
-implementation
+@A = global i32 7
+@B = global i32 8
 
-int %test() {
-       %A1 = load int* %A
+; CHECK:      define i32 @test()
+; CHECK-NEXT:   store i32 123, i32* @B
+; CHECK-NEXT:   ret i32 0
 
-       store int 123, int* %B  ; Store cannot alias %A
+define i32 @test() {
+       %A1 = load i32* @A
 
-       %A2 = load int* %A
-       %X = sub int %A1, %A2
-       ret int %X
+       store i32 123, i32* @B  ; Store cannot alias @A
+
+       %A2 = load i32* @A
+       %X = sub i32 %A1, %A2
+       ret i32 %X
 }
 
-int %test2() {
-        %A1 = load int* %A
+; 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
 Loop:
-        %AP = phi int [0, %0], [%X, %Loop]
-        store int %AP, int* %B  ; Store cannot alias %A
+        %AP = phi i32 [0, %0], [%X, %Loop]
+        store i32 %AP, i32* @B  ; Store cannot alias @A
 
-        %A2 = load int* %A
-        %X = sub int %A1, %A2
-        %c = seteq int %X, 0
-        br bool %c, label %out, label %Loop
+        %A2 = load i32* @A
+        %X = sub i32 %A1, %A2
+        %c = icmp eq i32 %X, 0
+        br i1 %c, label %out, label %Loop
 
 out:
-        ret int %X
+        ret i32 %X
+}
+
+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
+       call void @external()
+       %V = load i32* %X
+       ret i32 %V
 }