Changes in directory llvm/lib/Transforms/Scalar:
ADCE.cpp updated: 1.98 -> 1.99 CondPropagate.cpp updated: 1.8 -> 1.9 InstructionCombining.cpp updated: 1.546 -> 1.547 LICM.cpp updated: 1.79 -> 1.80 LoopStrengthReduce.cpp updated: 1.94 -> 1.95 LoopUnroll.cpp updated: 1.30 -> 1.31 LoopUnswitch.cpp updated: 1.49 -> 1.50 LowerPacked.cpp updated: 1.10 -> 1.11 SCCP.cpp updated: 1.136 -> 1.137 ScalarReplAggregates.cpp updated: 1.49 -> 1.50 TailDuplication.cpp updated: 1.33 -> 1.34 --- Log message: Removed #include <iostream> and replaced with llvm_* streams. --- Diffs of the changes: (+100 -115) ADCE.cpp | 17 ++++++++--------- CondPropagate.cpp | 2 +- InstructionCombining.cpp | 21 ++++++++++----------- LICM.cpp | 8 +++----- LoopStrengthReduce.cpp | 39 +++++++++++++++++++-------------------- LoopUnroll.cpp | 13 ++++++------- LoopUnswitch.cpp | 35 +++++++++++++++++------------------ LowerPacked.cpp | 13 +++++-------- SCCP.cpp | 45 ++++++++++++++++++++++----------------------- ScalarReplAggregates.cpp | 12 +++++------- TailDuplication.cpp | 10 ++++------ 11 files changed, 100 insertions(+), 115 deletions(-) Index: llvm/lib/Transforms/Scalar/ADCE.cpp diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.98 llvm/lib/Transforms/Scalar/ADCE.cpp:1.99 --- llvm/lib/Transforms/Scalar/ADCE.cpp:1.98 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/Scalar/ADCE.cpp Sun Nov 26 03:46:52 2006 @@ -27,7 +27,6 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include <algorithm> -#include <iostream> using namespace llvm; namespace { @@ -92,12 +91,12 @@ inline void markInstructionLive(Instruction *I) { if (!LiveSet.insert(I).second) return; - DEBUG(std::cerr << "Insn Live: " << *I); + DOUT << "Insn Live: " << *I; WorkList.push_back(I); } inline void markTerminatorLive(const BasicBlock *BB) { - DEBUG(std::cerr << "Terminator Live: " << *BB->getTerminator()); + DOUT << "Terminator Live: " << *BB->getTerminator(); markInstructionLive(const_cast<TerminatorInst*>(BB->getTerminator())); } }; @@ -260,7 +259,7 @@ for (pred_iterator PI = pred_begin(I), E = pred_end(I); PI != E; ++PI) markInstructionLive((*PI)->getTerminator()); - DEBUG(std::cerr << "Processing work list\n"); + DOUT << "Processing work list\n"; // AliveBlocks - Set of basic blocks that we know have instructions that are // alive in them... @@ -309,13 +308,13 @@ } DEBUG( - std::cerr << "Current Function: X = Live\n"; + DOUT << "Current Function: X = Live\n"; for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I){ - std::cerr << I->getName() << ":\t" - << (AliveBlocks.count(I) ? "LIVE\n" : "DEAD\n"); + DOUT << I->getName() << ":\t" + << (AliveBlocks.count(I) ? "LIVE\n" : "DEAD\n"); for (BasicBlock::iterator BI = I->begin(), BE = I->end(); BI != BE; ++BI){ - if (LiveSet.count(BI)) std::cerr << "X "; - std::cerr << *BI; + if (LiveSet.count(BI)) DOUT << "X "; + DOUT << *BI; } }); Index: llvm/lib/Transforms/Scalar/CondPropagate.cpp diff -u llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.8 llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.9 --- llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.8 Wed Nov 1 17:04:45 2006 +++ llvm/lib/Transforms/Scalar/CondPropagate.cpp Sun Nov 26 03:46:52 2006 @@ -22,7 +22,7 @@ #include "llvm/Type.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Statistic.h" -#include <iostream> +#include "llvm/Support/Streams.h" using namespace llvm; namespace { Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.546 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.547 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.546 Tue Nov 21 11:05:13 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Nov 26 03:46:52 2006 @@ -52,7 +52,6 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include <algorithm> -#include <iostream> using namespace llvm; using namespace llvm::PatternMatch; @@ -5551,7 +5550,7 @@ // Add operands to the worklist. AddUsesToWorkList(*User); ++NumDeadInst; - DEBUG(std::cerr << "IC: DCE: " << *User); + DOUT << "IC: DCE: " << *User; User->eraseFromParent(); removeFromWorkList(User); @@ -6867,7 +6866,7 @@ // If we are removing arguments to the function, emit an obnoxious warning... if (FT->getNumParams() < NumActualArgs) if (!FT->isVarArg()) { - std::cerr << "WARNING: While resolving call to function '" + llvm_cerr << "WARNING: While resolving call to function '" << Callee->getName() << "' arguments were dropped!\n"; } else { // Add all of the arguments in their promoted form to the arg list... @@ -8556,7 +8555,7 @@ // DCE instruction if trivially dead. if (isInstructionTriviallyDead(Inst)) { ++NumDeadInst; - DEBUG(std::cerr << "IC: DCE: " << *Inst); + DOUT << "IC: DCE: " << *Inst; Inst->eraseFromParent(); continue; } @@ -8565,7 +8564,7 @@ if (Constant *C = ConstantFoldInstruction(Inst)) { if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) C = OptimizeConstantExpr(CE, TD); - DEBUG(std::cerr << "IC: ConstFold to: " << *C << " from: " << *Inst); + DOUT << "IC: ConstFold to: " << *C << " from: " << *Inst; Inst->replaceAllUsesWith(C); ++NumConstProp; Inst->eraseFromParent(); @@ -8624,7 +8623,7 @@ while (Term != BB->begin()) { // Remove instrs bottom-up BasicBlock::iterator I = Term; --I; - DEBUG(std::cerr << "IC: DCE: " << *I); + DOUT << "IC: DCE: " << *I; ++NumDeadInst; if (!I->use_empty()) @@ -8645,7 +8644,7 @@ AddUsesToWorkList(*I); ++NumDeadInst; - DEBUG(std::cerr << "IC: DCE: " << *I); + DOUT << "IC: DCE: " << *I; I->eraseFromParent(); removeFromWorkList(I); @@ -8656,7 +8655,7 @@ if (Constant *C = ConstantFoldInstruction(I)) { if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) C = OptimizeConstantExpr(CE, TD); - DEBUG(std::cerr << "IC: ConstFold to: " << *C << " from: " << *I); + DOUT << "IC: ConstFold to: " << *C << " from: " << *I; // Add operands to the worklist. AddUsesToWorkList(*I); @@ -8696,8 +8695,8 @@ ++NumCombined; // Should we replace the old instruction with a new one? if (Result != I) { - DEBUG(std::cerr << "IC: Old = " << *I - << " New = " << *Result); + DOUT << "IC: Old = " << *I + << " New = " << *Result; // Everything uses the new instruction now. I->replaceAllUsesWith(Result); @@ -8733,7 +8732,7 @@ // Erase the old instruction. InstParent->getInstList().erase(I); } else { - DEBUG(std::cerr << "IC: MOD = " << *I); + DOUT << "IC: MOD = " << *I; // If the instruction was modified, it's possible that it is now dead. // if so, remove it. Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.79 llvm/lib/Transforms/Scalar/LICM.cpp:1.80 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.79 Tue Sep 12 14:17:09 2006 +++ llvm/lib/Transforms/Scalar/LICM.cpp Sun Nov 26 03:46:52 2006 @@ -47,7 +47,6 @@ #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" #include <algorithm> -#include <iostream> using namespace llvm; namespace { @@ -430,7 +429,7 @@ /// position, and may either delete it or move it to outside of the loop. /// void LICM::sink(Instruction &I) { - DEBUG(std::cerr << "LICM sinking instruction: " << I); + DOUT << "LICM sinking instruction: " << I; std::vector<BasicBlock*> ExitBlocks; CurLoop->getExitBlocks(ExitBlocks); @@ -565,8 +564,7 @@ /// that is safe to hoist, this instruction is called to do the dirty work. /// void LICM::hoist(Instruction &I) { - DEBUG(std::cerr << "LICM hoisting to " << Preheader->getName() - << ": " << I); + DOUT << "LICM hoisting to " << Preheader->getName() << ": " << I; // Remove the instruction from its current basic block... but don't delete the // instruction. @@ -785,7 +783,7 @@ for (AliasSet::iterator I = AS.begin(), E = AS.end(); I != E; ++I) ValueToAllocaMap.insert(std::make_pair(I->first, AI)); - DEBUG(std::cerr << "LICM: Promoting value: " << *V << "\n"); + DOUT << "LICM: Promoting value: " << *V << "\n"; } } } Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.94 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.95 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.94 Fri Nov 17 00:17:33 2006 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Nov 26 03:46:52 2006 @@ -34,7 +34,6 @@ #include "llvm/Support/Compiler.h" #include "llvm/Target/TargetLowering.h" #include <algorithm> -#include <iostream> #include <set> using namespace llvm; @@ -322,8 +321,8 @@ Start = SCEVAddExpr::get(Start, AddRec->getOperand(0)); if (!isa<SCEVConstant>(AddRec->getOperand(1))) - DEBUG(std::cerr << "[" << L->getHeader()->getName() - << "] Variable stride: " << *AddRec << "\n"); + DOUT << "[" << L->getHeader()->getName() + << "] Variable stride: " << *AddRec << "\n"; Stride = AddRec->getOperand(1); // Check that all constant strides are the unsigned type, we don't want to @@ -422,12 +421,12 @@ // don't recurse into it. bool AddUserToIVUsers = false; if (LI->getLoopFor(User->getParent()) != L) { - DEBUG(std::cerr << "FOUND USER in other loop: " << *User - << " OF SCEV: " << *ISE << "\n"); + DOUT << "FOUND USER in other loop: " << *User + << " OF SCEV: " << *ISE << "\n"; AddUserToIVUsers = true; } else if (!AddUsersIfInteresting(User, L, Processed)) { - DEBUG(std::cerr << "FOUND USER: " << *User - << " OF SCEV: " << *ISE << "\n"); + DOUT << "FOUND USER: " << *User + << " OF SCEV: " << *ISE << "\n"; AddUserToIVUsers = true; } @@ -445,7 +444,7 @@ SCEVHandle NewStart = SCEV::getMinusSCEV(Start, Stride); StrideUses.addUser(NewStart, User, I); StrideUses.Users.back().isUseOfPostIncrementedValue = true; - DEBUG(std::cerr << " USING POSTINC SCEV, START=" << *NewStart<< "\n"); + DOUT << " USING POSTINC SCEV, START=" << *NewStart<< "\n"; } else { StrideUses.addUser(Start, User, I); } @@ -508,12 +507,12 @@ } void BasedUser::dump() const { - std::cerr << " Base=" << *Base; - std::cerr << " Imm=" << *Imm; + llvm_cerr << " Base=" << *Base; + llvm_cerr << " Imm=" << *Imm; if (EmittedBase) - std::cerr << " EB=" << *EmittedBase; + llvm_cerr << " EB=" << *EmittedBase; - std::cerr << " Inst: " << *Inst; + llvm_cerr << " Inst: " << *Inst; } Value *BasedUser::InsertCodeForBaseAtPosition(const SCEVHandle &NewBase, @@ -561,7 +560,7 @@ Value *NewVal = InsertCodeForBaseAtPosition(NewBase, Rewriter, Inst, L); // Replace the use of the operand Value with the new Phi we just created. Inst->replaceUsesOfWith(OperandValToReplace, NewVal); - DEBUG(std::cerr << " CHANGED: IMM =" << *Imm << " Inst = " << *Inst); + DOUT << " CHANGED: IMM =" << *Imm << " Inst = " << *Inst; return; } @@ -610,7 +609,7 @@ Rewriter.clear(); } } - DEBUG(std::cerr << " CHANGED: IMM =" << *Imm << " Inst = " << *Inst); + DOUT << " CHANGED: IMM =" << *Imm << " Inst = " << *Inst; } @@ -961,8 +960,8 @@ unsigned RewriteFactor = CheckForIVReuse(Stride, ReuseIV, CommonExprs->getType()); if (RewriteFactor != 0) { - DEBUG(std::cerr << "BASED ON IV of STRIDE " << *ReuseIV.Stride - << " and BASE " << *ReuseIV.Base << " :\n"); + DOUT << "BASED ON IV of STRIDE " << *ReuseIV.Stride + << " and BASE " << *ReuseIV.Base << " :\n"; NewPHI = ReuseIV.PHI; IncV = ReuseIV.IncV; } @@ -996,8 +995,8 @@ // Now that we know what we need to do, insert the PHI node itself. // - DEBUG(std::cerr << "INSERTING IV of STRIDE " << *Stride << " and BASE " - << *CommonExprs << " :\n"); + DOUT << "INSERTING IV of STRIDE " << *Stride << " and BASE " + << *CommonExprs << " :\n"; SCEVExpander Rewriter(*SE, *LI); SCEVExpander PreheaderRewriter(*SE, *LI); @@ -1085,7 +1084,7 @@ while (!UsersToProcess.empty()) { SCEVHandle Base = UsersToProcess.back().Base; - DEBUG(std::cerr << " INSERTING code for BASE = " << *Base << ":\n"); + DOUT << " INSERTING code for BASE = " << *Base << ":\n"; // Emit the code for Base into the preheader. Value *BaseV = PreheaderRewriter.expandCodeFor(Base, PreInsertPt, @@ -1302,7 +1301,7 @@ bool HasOneStride = IVUsesByStride.size() == 1; #ifndef NDEBUG - DEBUG(std::cerr << "\nLSR on "); + DOUT << "\nLSR on "; DEBUG(L->dump()); #endif Index: llvm/lib/Transforms/Scalar/LoopUnroll.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.30 llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.31 --- llvm/lib/Transforms/Scalar/LoopUnroll.cpp:1.30 Thu Nov 2 14:25:50 2006 +++ llvm/lib/Transforms/Scalar/LoopUnroll.cpp Sun Nov 26 03:46:52 2006 @@ -34,7 +34,6 @@ #include <cstdio> #include <set> #include <algorithm> -#include <iostream> using namespace llvm; namespace { @@ -134,7 +133,7 @@ if (OnlyPred->getTerminator()->getNumSuccessors() != 1) return 0; - DEBUG(std::cerr << "Merging: " << *BB << "into: " << *OnlyPred); + DOUT << "Merging: " << *BB << "into: " << *OnlyPred; // Resolve any PHI nodes at the start of the block. They are all // guaranteed to have exactly one entry if they exist, unless there are @@ -194,15 +193,15 @@ return Changed; // More than 2^32 iterations??? unsigned LoopSize = ApproximateLoopSize(L); - DEBUG(std::cerr << "Loop Unroll: F[" << Header->getParent()->getName() - << "] Loop %" << Header->getName() << " Loop Size = " - << LoopSize << " Trip Count = " << TripCountFull << " - "); + DOUT << "Loop Unroll: F[" << Header->getParent()->getName() + << "] Loop %" << Header->getName() << " Loop Size = " + << LoopSize << " Trip Count = " << TripCountFull << " - "; uint64_t Size = (uint64_t)LoopSize*TripCountFull; if (Size > UnrollThreshold) { - DEBUG(std::cerr << "TOO LARGE: " << Size << ">" << UnrollThreshold << "\n"); + DOUT << "TOO LARGE: " << Size << ">" << UnrollThreshold << "\n"; return Changed; } - DEBUG(std::cerr << "UNROLLING!\n"); + DOUT << "UNROLLING!\n"; std::vector<BasicBlock*> LoopBlocks = L->getBlocks(); Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.49 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.50 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.49 Thu Nov 2 14:25:50 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Sun Nov 26 03:46:52 2006 @@ -40,7 +40,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/CommandLine.h" #include <algorithm> -#include <iostream> #include <set> using namespace llvm; @@ -369,9 +368,9 @@ // FIXME: this should estimate growth by the amount of code shared by the // resultant unswitched loops. // - DEBUG(std::cerr << "NOT unswitching loop %" - << L->getHeader()->getName() << ", cost too high: " - << L->getBlocks().size() << "\n"); + DOUT << "NOT unswitching loop %" + << L->getHeader()->getName() << ", cost too high: " + << L->getBlocks().size() << "\n"; return false; } @@ -508,10 +507,10 @@ void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, BasicBlock *ExitBlock) { - DEBUG(std::cerr << "loop-unswitch: Trivial-Unswitch loop %" - << L->getHeader()->getName() << " [" << L->getBlocks().size() - << " blocks] in Function " << L->getHeader()->getParent()->getName() - << " on cond: " << *Val << " == " << *Cond << "\n"); + DOUT << "loop-unswitch: Trivial-Unswitch loop %" + << L->getHeader()->getName() << " [" << L->getBlocks().size() + << " blocks] in Function " << L->getHeader()->getParent()->getName() + << " on cond: " << *Val << " == " << *Cond << "\n"; // First step, split the preheader, so that we know that there is a safe place // to insert the conditional branch. We will change 'OrigPH' to have a @@ -553,10 +552,10 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val, Loop *L) { Function *F = L->getHeader()->getParent(); - DEBUG(std::cerr << "loop-unswitch: Unswitching loop %" - << L->getHeader()->getName() << " [" << L->getBlocks().size() - << " blocks] in Function " << F->getName() - << " when '" << *Val << "' == " << *LIC << "\n"); + DOUT << "loop-unswitch: Unswitching loop %" + << L->getHeader()->getName() << " [" << L->getBlocks().size() + << " blocks] in Function " << F->getName() + << " when '" << *Val << "' == " << *LIC << "\n"; // LoopBlocks contains all of the basic blocks of the loop, including the // preheader of the loop, the body of the loop, and the exit blocks of the @@ -721,7 +720,7 @@ /// program, replacing all uses with V and update the worklist. static void ReplaceUsesOfWith(Instruction *I, Value *V, std::vector<Instruction*> &Worklist) { - DEBUG(std::cerr << "Replace with '" << *V << "': " << *I); + DOUT << "Replace with '" << *V << "': " << *I; // Add uses to the worklist, which may be dead now. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) @@ -780,7 +779,7 @@ return; } - DEBUG(std::cerr << "Nuking dead block: " << *BB); + DOUT << "Nuking dead block: " << *BB; // Remove the instructions in the basic block from the worklist. for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { @@ -1013,7 +1012,7 @@ // Simple DCE. if (isInstructionTriviallyDead(I)) { - DEBUG(std::cerr << "Remove dead instruction '" << *I); + DOUT << "Remove dead instruction '" << *I; // Add uses to the worklist, which may be dead now. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) @@ -1066,8 +1065,8 @@ if (!SinglePred) continue; // Nothing to do. assert(SinglePred == Pred && "CFG broken"); - DEBUG(std::cerr << "Merging blocks: " << Pred->getName() << " <- " - << Succ->getName() << "\n"); + DOUT << "Merging blocks: " << Pred->getName() << " <- " + << Succ->getName() << "\n"; // Resolve any single entry PHI nodes in Succ. while (PHINode *PN = dyn_cast<PHINode>(Succ->begin())) @@ -1092,7 +1091,7 @@ // remove dead blocks. break; // FIXME: Enable. - DEBUG(std::cerr << "Folded branch: " << *BI); + DOUT << "Folded branch: " << *BI; BasicBlock *DeadSucc = BI->getSuccessor(CB->getValue()); BasicBlock *LiveSucc = BI->getSuccessor(!CB->getValue()); DeadSucc->removePredecessor(BI->getParent(), true); Index: llvm/lib/Transforms/Scalar/LowerPacked.cpp diff -u llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.10 llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.11 --- llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.10 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Transforms/Scalar/LowerPacked.cpp Sun Nov 26 03:46:52 2006 @@ -20,12 +20,11 @@ #include "llvm/Instructions.h" #include "llvm/Pass.h" #include "llvm/Support/InstVisitor.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/StringExtras.h" #include <algorithm> #include <map> -#include <iostream> #include <functional> - using namespace llvm; namespace { @@ -72,12 +71,10 @@ /// /// @brief Asserts if PackedType instruction is not handled elsewhere. /// @param I the unhandled instruction - void visitInstruction(Instruction &I) - { - if(isa<PackedType>(I.getType())) { - std::cerr << "Unhandled Instruction with Packed ReturnType: " << - I << '\n'; - } + void visitInstruction(Instruction &I) { + if (isa<PackedType>(I.getType())) + llvm_cerr << "Unhandled Instruction with Packed ReturnType: " + << I << '\n'; } private: /// @brief Retrieves lowered values for a packed value. Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.136 llvm/lib/Transforms/Scalar/SCCP.cpp:1.137 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.136 Thu Nov 2 14:25:50 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Sun Nov 26 03:46:52 2006 @@ -36,7 +36,6 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include <algorithm> -#include <iostream> #include <set> using namespace llvm; @@ -134,7 +133,7 @@ /// MarkBlockExecutable - This method can be used by clients to mark all of /// the blocks that are known to be intrinsically live in the processed unit. void MarkBlockExecutable(BasicBlock *BB) { - DEBUG(std::cerr << "Marking Block Executable: " << BB->getName() << "\n"); + DOUT << "Marking Block Executable: " << BB->getName() << "\n"; BBExecutable.insert(BB); // Basic block is executable! BBWorkList.push_back(BB); // Add the block to the work list! } @@ -204,7 +203,7 @@ // inline void markConstant(LatticeVal &IV, Value *V, Constant *C) { if (IV.markConstant(C)) { - DEBUG(std::cerr << "markConstant: " << *C << ": " << *V); + DOUT << "markConstant: " << *C << ": " << *V; InstWorkList.push_back(V); } } @@ -218,11 +217,11 @@ inline void markOverdefined(LatticeVal &IV, Value *V) { if (IV.markOverdefined()) { - DEBUG(std::cerr << "markOverdefined: "; + DEBUG(DOUT << "markOverdefined: "; if (Function *F = dyn_cast<Function>(V)) - std::cerr << "Function '" << F->getName() << "'\n"; + DOUT << "Function '" << F->getName() << "'\n"; else - std::cerr << *V); + DOUT << *V); // Only instructions go on the work list OverdefinedInstWorkList.push_back(V); } @@ -276,8 +275,8 @@ return; // This edge is already known to be executable! if (BBExecutable.count(Dest)) { - DEBUG(std::cerr << "Marking Edge Executable: " << Source->getName() - << " -> " << Dest->getName() << "\n"); + DOUT << "Marking Edge Executable: " << Source->getName() + << " -> " << Dest->getName() << "\n"; // The destination is already executable, but we just made an edge // feasible that wasn't before. Revisit the PHI nodes in the block @@ -351,7 +350,7 @@ void visitInstruction(Instruction &I) { // If a new instruction is added to LLVM that we don't handle... - std::cerr << "SCCP: Don't know how to handle: " << I; + llvm_cerr << "SCCP: Don't know how to handle: " << I; markOverdefined(&I); // Just in case } }; @@ -401,7 +400,7 @@ Succs[0] = true; } } else { - std::cerr << "SCCP: Don't know how to handle: " << TI; + llvm_cerr << "SCCP: Don't know how to handle: " << TI; Succs.assign(TI.getNumSuccessors(), true); } } @@ -460,7 +459,7 @@ } return false; } else { - std::cerr << "Unknown terminator instruction: " << *TI; + llvm_cerr << "Unknown terminator instruction: " << *TI; abort(); } } @@ -971,7 +970,7 @@ Value *I = OverdefinedInstWorkList.back(); OverdefinedInstWorkList.pop_back(); - DEBUG(std::cerr << "\nPopped off OI-WL: " << *I); + DOUT << "\nPopped off OI-WL: " << *I; // "I" got into the work list because it either made the transition from // bottom to constant @@ -989,7 +988,7 @@ Value *I = InstWorkList.back(); InstWorkList.pop_back(); - DEBUG(std::cerr << "\nPopped off I-WL: " << *I); + DOUT << "\nPopped off I-WL: " << *I; // "I" got into the work list because it either made the transition from // bottom to constant @@ -1009,7 +1008,7 @@ BasicBlock *BB = BBWorkList.back(); BBWorkList.pop_back(); - DEBUG(std::cerr << "\nPopped off BBWL: " << *BB); + DOUT << "\nPopped off BBWL: " << *BB; // Notify all instructions in this basic block that they are newly // executable. @@ -1098,7 +1097,7 @@ // and return true if the function was modified. // bool SCCP::runOnFunction(Function &F) { - DEBUG(std::cerr << "SCCP on function '" << F.getName() << "'\n"); + DOUT << "SCCP on function '" << F.getName() << "'\n"; SCCPSolver Solver; // Mark the first block of the function as being executable. @@ -1113,7 +1112,7 @@ bool ResolvedBranches = true; while (ResolvedBranches) { Solver.Solve(); - DEBUG(std::cerr << "RESOLVING UNDEF BRANCHES\n"); + DOUT << "RESOLVING UNDEF BRANCHES\n"; ResolvedBranches = Solver.ResolveBranchesIn(F); } @@ -1126,7 +1125,7 @@ std::set<BasicBlock*> &ExecutableBBs = Solver.getExecutableBlocks(); for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) if (!ExecutableBBs.count(BB)) { - DEBUG(std::cerr << " BasicBlock Dead:" << *BB); + DOUT << " BasicBlock Dead:" << *BB; ++NumDeadBlocks; // Delete the instructions backwards, as it has a reduced likelihood of @@ -1156,7 +1155,7 @@ !isa<TerminatorInst>(Inst)) { Constant *Const = IV.isConstant() ? IV.getConstant() : UndefValue::get(Inst->getType()); - DEBUG(std::cerr << " Constant: " << *Const << " = " << *Inst); + DOUT << " Constant: " << *Const << " = " << *Inst; // Replaces all of the uses of a variable with uses of the constant. Inst->replaceAllUsesWith(Const); @@ -1258,7 +1257,7 @@ while (ResolvedBranches) { Solver.Solve(); - DEBUG(std::cerr << "RESOLVING UNDEF BRANCHES\n"); + DOUT << "RESOLVING UNDEF BRANCHES\n"; ResolvedBranches = false; for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) ResolvedBranches |= Solver.ResolveBranchesIn(*F); @@ -1278,7 +1277,7 @@ if (IV.isConstant() || IV.isUndefined()) { Constant *CST = IV.isConstant() ? IV.getConstant() : UndefValue::get(AI->getType()); - DEBUG(std::cerr << "*** Arg " << *AI << " = " << *CST <<"\n"); + DOUT << "*** Arg " << *AI << " = " << *CST <<"\n"; // Replaces all of the uses of a variable with uses of the // constant. @@ -1290,7 +1289,7 @@ std::vector<BasicBlock*> BlocksToErase; for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) if (!ExecutableBBs.count(BB)) { - DEBUG(std::cerr << " BasicBlock Dead:" << *BB); + DOUT << " BasicBlock Dead:" << *BB; ++IPNumDeadBlocks; // Delete the instructions backwards, as it has a reduced likelihood of @@ -1333,7 +1332,7 @@ !isa<TerminatorInst>(Inst)) { Constant *Const = IV.isConstant() ? IV.getConstant() : UndefValue::get(Inst->getType()); - DEBUG(std::cerr << " Constant: " << *Const << " = " << *Inst); + DOUT << " Constant: " << *Const << " = " << *Inst; // Replaces all of the uses of a variable with uses of the // constant. @@ -1415,7 +1414,7 @@ GlobalVariable *GV = I->first; assert(!I->second.isOverdefined() && "Overdefined values should have been taken out of the map!"); - DEBUG(std::cerr << "Found that GV '" << GV->getName()<< "' is constant!\n"); + DOUT << "Found that GV '" << GV->getName()<< "' is constant!\n"; while (!GV->use_empty()) { StoreInst *SI = cast<StoreInst>(GV->use_back()); SI->eraseFromParent(); Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.49 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.50 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.49 Wed Nov 8 00:47:33 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sun Nov 26 03:46:52 2006 @@ -34,7 +34,6 @@ #include "llvm/Support/Compiler.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" -#include <iostream> using namespace llvm; namespace { @@ -170,7 +169,7 @@ break; } - DEBUG(std::cerr << "Found inst to xform: " << *AI); + DOUT << "Found inst to xform: " << *AI; Changed = true; std::vector<AllocaInst*> ElementAllocas; @@ -265,7 +264,7 @@ break; } default: - DEBUG(std::cerr << " Transformation preventing inst: " << *User); + DOUT << " Transformation preventing inst: " << *User; return 0; } } @@ -358,8 +357,7 @@ I != E; ++I) { isSafe &= isSafeUseOfAllocation(cast<Instruction>(*I)); if (isSafe == 0) { - DEBUG(std::cerr << "Cannot transform: " << *AI << " due to user: " - << **I); + DOUT << "Cannot transform: " << *AI << " due to user: " << **I; return 0; } } @@ -572,8 +570,8 @@ /// predicate and is non-trivial. Convert it to something that can be trivially /// promoted into a register by mem2reg. void SROA::ConvertToScalar(AllocationInst *AI, const Type *ActualTy) { - DEBUG(std::cerr << "CONVERT TO SCALAR: " << *AI << " TYPE = " - << *ActualTy << "\n"); + DOUT << "CONVERT TO SCALAR: " << *AI << " TYPE = " + << *ActualTy << "\n"; ++NumConverted; BasicBlock *EntryBlock = AI->getParent(); Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.33 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.34 --- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.33 Tue Sep 26 23:58:23 2006 +++ llvm/lib/Transforms/Scalar/TailDuplication.cpp Sun Nov 26 03:46:52 2006 @@ -31,7 +31,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" -#include <iostream> using namespace llvm; namespace { @@ -215,14 +214,13 @@ BasicBlock *DestBlock = Branch->getSuccessor(0); assert(SourceBlock != DestBlock && "Our predicate is broken!"); - DEBUG(std::cerr << "TailDuplication[" << SourceBlock->getParent()->getName() - << "]: Eliminating branch: " << *Branch); + DOUT << "TailDuplication[" << SourceBlock->getParent()->getName() + << "]: Eliminating branch: " << *Branch; // See if we can avoid duplicating code by moving it up to a dominator of both // blocks. if (BasicBlock *DomBlock = FindObviousSharedDomOf(SourceBlock, DestBlock)) { - DEBUG(std::cerr << "Found shared dominator: " << DomBlock->getName() - << "\n"); + DOUT << "Found shared dominator: " << DomBlock->getName() << "\n"; // If there are non-phi instructions in DestBlock that have no operands // defined in DestBlock, and if the instruction has no side effects, we can @@ -245,7 +243,7 @@ // Remove from DestBlock, move right before the term in DomBlock. DestBlock->getInstList().remove(I); DomBlock->getInstList().insert(DomBlock->getTerminator(), I); - DEBUG(std::cerr << "Hoisted: " << *I); + DOUT << "Hoisted: " << *I; } } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits