2008-05-20 22:07:21 +00:00
|
|
|
; RUN: llvm-as %s -o %t.bc -f
|
2004-11-06 23:32:43 +00:00
|
|
|
; RUN: lli %t.bc > /dev/null
|
|
|
|
|
2008-03-10 07:21:50 +00:00
|
|
|
define i32 @main() {
|
|
|
|
call i32 @mylog( i32 4 ) ; <i32>:1 [#uses=0]
|
|
|
|
ret i32 0
|
2003-01-13 01:03:16 +00:00
|
|
|
}
|
|
|
|
|
2008-03-10 07:21:50 +00:00
|
|
|
define internal i32 @mylog(i32 %num) {
|
|
|
|
bb0:
|
2003-01-13 01:03:16 +00:00
|
|
|
br label %bb2
|
2008-03-10 07:21:50 +00:00
|
|
|
bb2: ; preds = %bb2, %bb0
|
|
|
|
%reg112 = phi i32 [ 10, %bb2 ], [ 1, %bb0 ] ; <i32> [#uses=1]
|
|
|
|
%cann-indvar = phi i32 [ %cann-indvar, %bb2 ], [ 0, %bb0 ] ; <i32> [#uses=1]
|
|
|
|
%reg114 = add i32 %reg112, 1 ; <i32> [#uses=2]
|
|
|
|
%cond222 = icmp slt i32 %reg114, %num ; <i1> [#uses=1]
|
|
|
|
br i1 %cond222, label %bb2, label %bb3
|
|
|
|
bb3: ; preds = %bb2
|
|
|
|
ret i32 %reg114
|
2003-01-13 01:03:16 +00:00
|
|
|
}
|
|
|
|
|