2003-08-05 18:52:42 +00:00
|
|
|
; This testcase tests to make sure a trapping instruction is hoisted when
|
|
|
|
; it is guaranteed to execute.
|
|
|
|
;
|
2003-12-09 16:49:12 +00:00
|
|
|
; RUN: llvm-as < %s | opt -licm | llvm-dis | grep -C2 "test" | grep div
|
2003-08-05 18:52:42 +00:00
|
|
|
|
|
|
|
%X = global int 0
|
2003-12-11 21:06:43 +00:00
|
|
|
declare void %foo(int)
|
2003-08-05 18:52:42 +00:00
|
|
|
|
|
|
|
int %test(bool %c) {
|
|
|
|
%A = load int *%X
|
|
|
|
br label %Loop
|
|
|
|
Loop:
|
|
|
|
%B = div int 4, %A ;; Should have hoisted this div!
|
2003-12-11 21:06:43 +00:00
|
|
|
call void %foo(int %B)
|
2003-08-05 18:52:42 +00:00
|
|
|
br bool %c, label %Loop, label %Out
|
|
|
|
|
|
|
|
Out:
|
|
|
|
%C = sub int %A, %B
|
|
|
|
ret int %C
|
|
|
|
}
|