aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-05-20 03:01:48 +0000
committerDan Gohman <gohman@apple.com>2008-05-20 03:01:48 +0000
commit50b570a4fd6a575eefc5a42a14ef0db78cf542d8 (patch)
treeedeabfb95060cfd5edca738896e5248649ac969e
parentae50ca36f731ef914f057ea9ac1d2e947cc43c31 (diff)
downloadexternal_llvm-50b570a4fd6a575eefc5a42a14ef0db78cf542d8.zip
external_llvm-50b570a4fd6a575eefc5a42a14ef0db78cf542d8.tar.gz
external_llvm-50b570a4fd6a575eefc5a42a14ef0db78cf542d8.tar.bz2
Refine the fix in r51169 to only apply when the operand val being
replaced is a PHI. This prevents it from inserting uses before defs in the case that it isn't a PHI and it depends on other instructions later in the block. This fixes the 447.dealII regression on x86-64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51292 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index dbd22d9..d9371d2 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -625,7 +625,7 @@ void BasedUser::RewriteInstructionToUseNewBase(const SCEVHandle &NewBase,
// value will be pinned to live somewhere after the original computation.
// In this case, we have to back off.
if (!isUseOfPostIncrementedValue) {
- if (NewBasePt) {
+ if (NewBasePt && isa<PHINode>(OperandValToReplace)) {
InsertPt = NewBasePt;
++InsertPt;
} else if (Instruction *OpInst = dyn_cast<Instruction>(OperandValToReplace)) {
@@ -1412,8 +1412,9 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
// consider that they may not have been able to end up immediately
// next to RewriteOp, because non-PHI instructions may never precede
// PHI instructions in a block. In this case, remember where the last
- // instruction was inserted so that we can use that point to expand
- // the final RewriteExpr.
+ // instruction was inserted so that if we're replacing a different
+ // PHI node, we can use the later point to expand the final
+ // RewriteExpr.
Instruction *NewBasePt = dyn_cast<Instruction>(RewriteOp);
if (RewriteOp == NewPHI) NewBasePt = 0;