[llvm-commits] [llvm] r51292 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Dan Gohman gohman at apple.com
Mon May 19 20:01:49 PDT 2008


Author: djg
Date: Mon May 19 22:01:48 2008
New Revision: 51292

URL: http://llvm.org/viewvc/llvm-project?rev=51292&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=51292&r1=51291&r2=51292&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon May 19 22:01:48 2008
@@ -625,7 +625,7 @@
     // 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 @@
       // 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;
 





More information about the llvm-commits mailing list