check that we only insert one phi node per loop

llvm-svn: 20503
This commit is contained in:
Chris Lattner 2005-03-06 22:23:31 +00:00
parent 392a0bba42
commit 1173c52d82
1 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,42 @@
; Check that this test makes INDVAR and related stuff dead.
; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep phi | wc -l | grep 2
declare bool %pred()
void %test({ int, int }* %P) {
br label %Loop
Loop:
%INDVAR = phi int [0, %0], [%INDVAR2, %Loop]
%gep1 = getelementptr { int, int}* %P, int %INDVAR, uint 0
store int 0, int* %gep1
%gep2 = getelementptr { int, int}* %P, int %INDVAR, uint 1
store int 0, int* %gep2
%INDVAR2 = add int %INDVAR, 1
%cond = call bool %pred()
br bool %cond, label %Loop, label %Out
Out:
ret void
}
declare bool %pred()
void %test([2 x int]* %P) {
br label %Loop
Loop:
%INDVAR = phi int [0, %0], [%INDVAR2, %Loop]
%gep1 = getelementptr [2 x int]* %P, int %INDVAR, uint 0
store int 0, int* %gep1
%gep2 = getelementptr [2 x int]* %P, int %INDVAR, uint 1
store int 0, int* %gep2
%INDVAR2 = add int %INDVAR, 1
%cond = call bool %pred()
br bool %cond, label %Loop, label %Out
Out:
ret void
}