diff options
author | Dan Gohman <gohman@apple.com> | 2010-02-22 03:59:54 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-02-22 03:59:54 +0000 |
commit | 278f958c61e973975bf63b7a82f3d8322ea16c00 (patch) | |
tree | f7d6053e91ae33afe8c3b62de9df2dc0dbb24f24 /lib | |
parent | 2444080ca4f1f63d647272650aae874360c604cd (diff) | |
download | external_llvm-278f958c61e973975bf63b7a82f3d8322ea16c00.zip external_llvm-278f958c61e973975bf63b7a82f3d8322ea16c00.tar.gz external_llvm-278f958c61e973975bf63b7a82f3d8322ea16c00.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index cf3d702..a4bc017 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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; } |