1 ; This testcase tests for a problem where LICM hoists
2 ; potentially trapping instructions when they are not guaranteed to execute.
4 ; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "IfUnEqual" 2 | grep div
6 @X = global i32 0 ; <i32*> [#uses=1]
10 define i32 @test(i1 %c) {
11 %A = load i32* @X ; <i32> [#uses=2]
13 Loop: ; preds = %LoopTail, %0
15 br i1 %c, label %LoopTail, label %IfUnEqual
16 IfUnEqual: ; preds = %Loop
17 %B1 = sdiv i32 4, %A ; <i32> [#uses=1]
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]