From: Chris Lattner Date: Sun, 6 Mar 2005 22:23:31 +0000 (+0000) Subject: check that we only insert one phi node per loop X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=57f74708d7f9e4c82077bdfff7f259ca1fae7d22;p=oota-llvm.git check that we only insert one phi node per loop git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20503 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll b/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll new file mode 100644 index 00000000000..9d1b7488651 --- /dev/null +++ b/test/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll @@ -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 +}