summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-22 03:59:54 +0000
committerDan Gohman <gohman@apple.com>2010-02-22 03:59:54 +0000
commit4506fcb3c2763f2a5468587d2276082172b5b336 (patch)
treea8f8662f3d09822b4c10a8d2a26cffa650ca69c5 /llvm/lib
parent8064a5ba886f7b22aa1a7f9e91ae02bcffb34e65 (diff)
downloadbcm5719-llvm-4506fcb3c2763f2a5468587d2276082172b5b336.tar.gz
bcm5719-llvm-4506fcb3c2763f2a5468587d2276082172b5b336.zip
When emitting an instruction which depends on both a post-incremented
induction variable value and a loop-variant value, don't force the insert position to be at the post-increment position, because it may not be dominated by the loop-variant value. This fixes a use-before-def problem noticed on PPC. llvm-svn: 96774
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index cf3d702d633..a4bc0170edb 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2866,8 +2866,10 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
if (AR->getLoop() == LF.PostIncLoop) {
Reg = SE.getAddExpr(Reg, AR->getStepRecurrence(SE));
// If the user is inside the loop, insert the code after the increment
- // so that it is dominated by its operand.
- if (L->contains(LF.UserInst))
+ // so that it is dominated by its operand. If the original insert point
+ // was already dominated by the increment, keep it, because there may
+ // be loop-variant operands that need to be respected also.
+ if (L->contains(LF.UserInst) && !DT.dominates(IVIncInsertPos, IP))
IP = IVIncInsertPos;
break;
}
OpenPOWER on IntegriCloud