New testcase distilled from:
[oota-llvm.git] / test / Transforms / LICM / 2003-08-04-TrappingInstOkHoist.ll
1 ; This testcase tests to make sure a trapping instruction is hoisted when
2 ; it is guaranteed to execute.
3 ;
4 ; RUN: llvm-as < %s | opt -licm | llvm-dis | grep -C 2 "test" | grep div
5
6 %X = global int 0
7 declare void %foo()
8
9 int %test(bool %c) {
10         %A = load int *%X
11         br label %Loop
12 Loop:
13         call void %foo()
14         %B = div int 4, %A  ;; Should have hoisted this div!
15         br bool %c, label %Loop, label %Out
16
17 Out:
18         %C = sub int %A, %B
19         ret int %C
20 }