Simplify some getNode calls.
[oota-llvm.git] / test / Transforms / LICM / 2003-08-04-TrappingInstHoist.ll
1 ; This testcase tests for a problem where LICM hoists 
2 ; potentially trapping instructions when they are not guaranteed to execute.
3 ;
4 ; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "IfUnEqual" 2 | grep div 
5
6 @X = global i32 0               ; <i32*> [#uses=1]
7
8 declare void @foo()
9
10 define i32 @test(i1 %c) {
11         %A = load i32* @X               ; <i32> [#uses=2]
12         br label %Loop
13 Loop:           ; preds = %LoopTail, %0
14         call void @foo( )
15         br i1 %c, label %LoopTail, label %IfUnEqual
16 IfUnEqual:              ; preds = %Loop
17         %B1 = sdiv i32 4, %A            ; <i32> [#uses=1]
18         br label %LoopTail
19 LoopTail:               ; preds = %IfUnEqual, %Loop
20         %B = phi i32 [ 0, %Loop ], [ %B1, %IfUnEqual ]          ; <i32> [#uses=1]
21         br i1 %c, label %Loop, label %Out
22 Out:            ; preds = %LoopTail
23         %C = sub i32 %A, %B             ; <i32> [#uses=1]
24         ret i32 %C
25 }
26