2007-04-16 06:20:47 +08:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \
|
2007-08-15 21:36:28 +08:00
|
|
|
; RUN: grep {A(} | count 1
|
2006-03-18 03:45:54 +08:00
|
|
|
;
|
|
|
|
; Make sure the common loop invariant _A(reg) is hoisted up to preheader.
|
|
|
|
|
|
|
|
%A = internal global [16 x [16 x int]] zeroinitializer, align 32
|
|
|
|
|
2006-12-31 14:02:00 +08:00
|
|
|
void %test(int %row, int %N.in) {
|
2006-03-18 03:45:54 +08:00
|
|
|
entry:
|
2006-12-31 14:02:00 +08:00
|
|
|
%N = cast int %N.in to uint
|
|
|
|
%tmp5 = setgt int %N.in, 0
|
2006-03-18 03:45:54 +08:00
|
|
|
br bool %tmp5, label %cond_true, label %return
|
|
|
|
|
|
|
|
cond_true:
|
|
|
|
%indvar = phi uint [ 0, %entry ], [ %indvar.next, %cond_true ]
|
|
|
|
%i.0.0 = cast uint %indvar to int
|
|
|
|
%tmp2 = add int %i.0.0, 1
|
|
|
|
%tmp = getelementptr [16 x [16 x int]]* %A, int 0, int %row, int %tmp2
|
|
|
|
store int 4, int* %tmp
|
|
|
|
%tmp5 = add int %i.0.0, 2
|
|
|
|
%tmp7 = getelementptr [16 x [16 x int]]* %A, int 0, int %row, int %tmp5
|
|
|
|
store int 5, int* %tmp7
|
|
|
|
%indvar.next = add uint %indvar, 1
|
|
|
|
%exitcond = seteq uint %indvar.next, %N
|
|
|
|
br bool %exitcond, label %return, label %cond_true
|
|
|
|
|
|
|
|
return:
|
|
|
|
ret void
|
|
|
|
}
|