Move a DenseMap's declaration outside of a loop, and just call
[oota-llvm.git] / test / Transforms / LICM / 2003-08-04-TrappingInstOkHoist.ll
index 3dbd4e7cff847de89cac99d0ef1eea2999ef18f3..59cc0d66207140e1d50b24d936f6fac51b353e55 100644 (file)
@@ -1,20 +1,21 @@
 ; This testcase tests to make sure a trapping instruction is hoisted when
 ; it is guaranteed to execute.
 ;
-; RUN: llvm-as < %s | opt -licm | llvm-dis | grep -C2 "test" | grep div
+; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "test" 2 | grep div
 
-%X = global int 0
-declare void %foo()
+@X = global i32 0              ; <i32*> [#uses=1]
 
-int %test(bool %c) {
-       %A = load int *%X
-       br label %Loop
-Loop:
-       call void %foo()
-       %B = div int 4, %A  ;; Should have hoisted this div!
-        br bool %c, label %Loop, label %Out
+declare void @foo(i32)
 
-Out:
-       %C = sub int %A, %B
-       ret int %C
+define i32 @test(i1 %c) {
+       %A = load i32* @X               ; <i32> [#uses=2]
+       br label %Loop
+Loop:          ; preds = %Loop, %0
+        ;; Should have hoisted this div!
+       %B = sdiv i32 4, %A             ; <i32> [#uses=2]
+       call void @foo( i32 %B )
+       br i1 %c, label %Loop, label %Out
+Out:           ; preds = %Loop
+       %C = sub i32 %A, %B             ; <i32> [#uses=1]
+       ret i32 %C
 }