diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-08-03 23:30:08 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-08-03 23:30:08 +0000 |
| commit | bb78c97e24ddbefc8069abec3ac762c62eb9159e (patch) | |
| tree | 048e77ff46fd8e0d45432313375707d667bb5a26 /llvm/lib/Transforms | |
| parent | 8d394eb703206b24ea9b92afd9703c7d2293cec5 (diff) | |
| download | bcm5719-llvm-bb78c97e24ddbefc8069abec3ac762c62eb9159e.tar.gz bcm5719-llvm-bb78c97e24ddbefc8069abec3ac762c62eb9159e.zip | |
improve debug output
llvm-svn: 22638
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 27d0e5c667d..ddce7511042 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "loop-reduce" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" @@ -553,6 +554,8 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(Value *Stride, BasicBlock *LatchBlock = SomeLoopPHI->getIncomingBlock(SomeLoopPHI->getIncomingBlock(0) == Preheader); + DEBUG(std::cerr << "INSERTING IVs of STRIDE " << *Stride << ":\n"); + // FIXME: This loop needs increasing levels of intelligence. // STAGE 0: just emit everything as its own base. // STAGE 1: factor out common vars from bases, and try and push resulting @@ -565,7 +568,9 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(Value *Stride, std::sort(UsersToProcess.begin(), UsersToProcess.end()); while (!UsersToProcess.empty()) { SCEVHandle Base = UsersToProcess.front().first; - + + DEBUG(std::cerr << " INSERTING PHI with BASE = " << *Base << ":\n"); + // Create a new Phi for this base, and stick it in the loop header. const Type *ReplacedTy = Base->getType(); PHINode *NewPHI = new PHINode(ReplacedTy, "iv.", PhiInsertBefore); @@ -595,14 +600,14 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(Value *Stride, Rewriter.clear(); SCEVHandle NewValSCEV = SCEVAddExpr::get(SCEVUnknown::get(NewPHI), User.Imm); - Value *Replaced = UsersToProcess.front().second.OperandValToReplace; + Value *Replaced = User.OperandValToReplace; Value *newVal = Rewriter.expandCodeFor(NewValSCEV, User.Inst, Replaced->getType()); // Replace the use of the operand Value with the new Phi we just created. - DEBUG(std::cerr << "REPLACING: " << *Replaced << "IN: " << - *User.Inst << "WITH: "<< *newVal << '\n'); User.Inst->replaceUsesOfWith(Replaced, newVal); + DEBUG(std::cerr << " CHANGED: IMM =" << *User.Imm << " Inst = " + << *User.Inst); // Mark old value we replaced as possibly dead, so that it is elminated // if we just replaced the last use of that value. |

