[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Chris Lattner sabre at nondot.org
Fri May 11 15:40:52 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.136 -> 1.137
---
Log message:

significantly improve debug output of lsr


---
Diffs of the changes:  (+13 -6)

 LoopStrengthReduce.cpp |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.136 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.137
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.136	Fri May  4 09:59:09 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Fri May 11 17:40:34 2007
@@ -592,11 +592,12 @@
         while (isa<PHINode>(InsertPt)) ++InsertPt;
       }
     }
-    
     Value *NewVal = InsertCodeForBaseAtPosition(NewBase, Rewriter, InsertPt, L);
     // Replace the use of the operand Value with the new Phi we just created.
     Inst->replaceUsesOfWith(OperandValToReplace, NewVal);
-    DOUT << "    CHANGED: IMM =" << *Imm << "  Inst = " << *Inst;
+    DOUT << "    CHANGED: IMM =" << *Imm;
+    DOUT << "  \tNEWBASE =" << *NewBase;
+    DOUT << "  \tInst = " << *Inst;
     return;
   }
   
@@ -1078,7 +1079,7 @@
   // Now that we know what we need to do, insert the PHI node itself.
   //
   DOUT << "INSERTING IV of TYPE " << *ReplacedTy << " of STRIDE "
-       << *Stride << " and BASE " << *CommonExprs << " :\n";
+       << *Stride << " and BASE " << *CommonExprs << ": ";
 
   SCEVExpander Rewriter(*SE, *LI);
   SCEVExpander PreheaderRewriter(*SE, *LI);
@@ -1120,6 +1121,8 @@
 
     // Remember this in case a later stride is multiple of this.
     IVsByStride[Stride].addIV(Stride, CommonExprs, NewPHI, IncV);
+    
+    DOUT << " IV=%" << NewPHI->getNameStr() << " INC=%" << IncV->getNameStr();
   } else {
     Constant *C = dyn_cast<Constant>(CommonBaseV);
     if (!C ||
@@ -1130,6 +1133,7 @@
       CommonBaseV = new BitCastInst(CommonBaseV, CommonBaseV->getType(), 
                                     "commonbase", PreInsertPt);
   }
+  DOUT << "\n";
 
   // We want to emit code for users inside the loop first.  To do this, we
   // rearrange BasedUser so that the entries at the end have
@@ -1166,12 +1170,15 @@
   while (!UsersToProcess.empty()) {
     SCEVHandle Base = UsersToProcess.back().Base;
 
-    DOUT << "  INSERTING code for BASE = " << *Base << ":\n";
-   
     // Emit the code for Base into the preheader.
     Value *BaseV = PreheaderRewriter.expandCodeFor(Base, PreInsertPt,
                                                    ReplacedTy);
-    
+
+    DOUT << "  INSERTING code for BASE = " << *Base << ":";
+    if (BaseV->hasName())
+      DOUT << " Result value name = %" << BaseV->getNameStr();
+    DOUT << "\n";
+
     // If BaseV is a constant other than 0, make sure that it gets inserted into
     // the preheader, instead of being forward substituted into the uses.  We do
     // this by forcing a BitCast (noop cast) to be inserted into the preheader 






More information about the llvm-commits mailing list