Fixes working towards PR341
authorChris Lattner <sabre@nondot.org>
Thu, 15 Jul 2004 01:50:47 +0000 (01:50 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 15 Jul 2004 01:50:47 +0000 (01:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14839 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ADCE.cpp
lib/Transforms/Scalar/CorrelatedExprs.cpp
lib/Transforms/Scalar/PRE.cpp
lib/Transforms/Scalar/Reassociate.cpp
lib/Transforms/Scalar/SCCP.cpp
lib/Transforms/Scalar/ScalarReplAggregates.cpp

index 98f8bed516033781a3101529b3252cfbf2f210f9..04a641727267701313511771e6602c6dab14f0e8 100644 (file)
@@ -92,13 +92,13 @@ private:
 
   inline void markInstructionLive(Instruction *I) {
     if (LiveSet.count(I)) return;
-    DEBUG(std::cerr << "Insn Live: " << I);
+    DEBUG(std::cerr << "Insn Live: " << *I);
     LiveSet.insert(I);
     WorkList.push_back(I);
   }
 
   inline void markTerminatorLive(const BasicBlock *BB) {
-    DEBUG(std::cerr << "Terminator Live: " << BB->getTerminator());
+    DEBUG(std::cerr << "Terminator Live: " << *BB->getTerminator());
     markInstructionLive(const_cast<TerminatorInst*>(BB->getTerminator()));
   }
 };
index d9e96485fc4caec64edd3eeac3d7cde5dbabc189..aeeade40cce8cbbbc7d6cca19ef733c70aad413c 100644 (file)
@@ -1011,7 +1011,7 @@ bool CEE::SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI) {
       Relation::KnownResult Result = getSetCCResult(SCI, RI);
       if (Result != Relation::Unknown) {
         DEBUG(std::cerr << "Replacing setcc with " << Result
-                        << " constant: " << SCI);
+                        << " constant: " << *SCI);
 
         SCI->replaceAllUsesWith(ConstantBool::get((bool)Result));
         // The instruction is now dead, remove it from the program.
@@ -1038,8 +1038,8 @@ bool CEE::SimplifyInstruction(Instruction *I, const RegionInfo &RI) {
       if (Value *Repl = VI->getReplacement()) {
         // If we know if a replacement with lower rank than Op0, make the
         // replacement now.
-        DEBUG(std::cerr << "In Inst: " << I << "  Replacing operand #" << i
-                        << " with " << Repl << "\n");
+        DEBUG(std::cerr << "In Inst: " << *I << "  Replacing operand #" << i
+                        << " with " << *Repl << "\n");
         I->setOperand(i, Repl);
         Changed = true;
         ++NumOperandsCann;
@@ -1067,7 +1067,7 @@ Relation::KnownResult CEE::getSetCCResult(SetCondInst *SCI,
     if (isa<Constant>(Op1)) {
       if (Constant *Result = ConstantFoldInstruction(SCI)) {
         // Wow, this is easy, directly eliminate the SetCondInst.
-        DEBUG(std::cerr << "Replacing setcc with constant fold: " << SCI);
+        DEBUG(std::cerr << "Replacing setcc with constant fold: " << *SCI);
         return cast<ConstantBool>(Result)->getValue()
           ? Relation::KnownTrue : Relation::KnownFalse;
       }
index 88d9143d071b49808d96bf0511314c9c083cb802..cfa74b928d78949c59289cb0e237bd068944c92d 100644 (file)
@@ -390,7 +390,7 @@ bool PRE::ProcessExpression(Instruction *Expr) {
     return Changed;
   }
 #endif
-  DEBUG(std::cerr << "\n====--- Expression: " << Expr);
+  DEBUG(std::cerr << "\n====--- Expression: " << *Expr);
   const Type *ExprType = Expr->getType();
 
   // AnticipatibleBlocks - Blocks where the current expression is anticipatible.
@@ -425,7 +425,7 @@ bool PRE::ProcessExpression(Instruction *Expr) {
       BasicBlock *BB = Occurrence->getParent();
       Definitions.erase(Definitions.begin());
 
-      DEBUG(std::cerr << "PROCESSING Occurrence: " << Occurrence);
+      DEBUG(std::cerr << "PROCESSING Occurrence: " << *Occurrence);
 
       // Check to see if there is already an incoming value for this block...
       AvailableBlocksTy::iterator LBI = AvailableBlocks.find(BB);
@@ -433,7 +433,7 @@ bool PRE::ProcessExpression(Instruction *Expr) {
         // Yes, there is a dominating definition for this block.  Replace this
         // occurrence with the incoming value.
         if (LBI->second != Occurrence) {
-          DEBUG(std::cerr << "  replacing with: " << LBI->second);
+          DEBUG(std::cerr << "  replacing with: " << *LBI->second);
           Occurrence->replaceAllUsesWith(LBI->second);
           BB->getInstList().erase(Occurrence);   // Delete instruction
           ++NumRedundant;
@@ -489,7 +489,7 @@ bool PRE::ProcessExpression(Instruction *Expr) {
                                           DFBlock->begin());
                 ProcessedExpressions.insert(PN);
 
-                DEBUG(std::cerr << "  INSERTING PHI on frontier: " << PN);
+                DEBUG(std::cerr << "  INSERTING PHI on frontier: " << *PN);
 
                 // Add the incoming blocks for the PHI node
                 for (pred_iterator PI = pred_begin(DFBlock),
@@ -501,7 +501,8 @@ bool PRE::ProcessExpression(Instruction *Expr) {
 
                 Instruction *&BlockOcc = Definitions[DFBlockID];
                 if (BlockOcc) {
-                  DEBUG(std::cerr <<"    PHI superceeds occurrence: "<<BlockOcc);
+                  DEBUG(std::cerr <<"    PHI superceeds occurrence: "<<
+                        *BlockOcc);
                   BlockOcc->replaceAllUsesWith(PN);
                   BlockOcc->getParent()->getInstList().erase(BlockOcc);
                   ++NumRedundant;
@@ -528,7 +529,7 @@ bool PRE::ProcessExpression(Instruction *Expr) {
       //
       PHINode *PN = new PHINode(ExprType, Expr->getName()+".PRE",
                                 AFBlock->begin());
-      DEBUG(std::cerr << "INSERTING PHI for PR: " << PN);
+      DEBUG(std::cerr << "INSERTING PHI for PR: " << *PN);
 
       // If there is a pending occurrence in this block, make sure to replace it
       // with the PHI node...
@@ -538,7 +539,7 @@ bool PRE::ProcessExpression(Instruction *Expr) {
         // There is already an occurrence in this block.  Replace it with PN and
         // remove it.
         Instruction *OldOcc = EDFI->second;
-        DEBUG(std::cerr << "  Replaces occurrence: " << OldOcc);
+        DEBUG(std::cerr << "  Replaces occurrence: " << *OldOcc);
         OldOcc->replaceAllUsesWith(PN);
         AFBlock->getInstList().erase(OldOcc);
         Definitions.erase(EDFI);
@@ -567,7 +568,7 @@ bool PRE::ProcessExpression(Instruction *Expr) {
             New->setName(NonPHIOccurrence->getName() + ".PRE-inserted");
             ProcessedExpressions.insert(New);
 
-            DEBUG(std::cerr << "  INSERTING OCCURRRENCE: " << New);
+            DEBUG(std::cerr << "  INSERTING OCCURRRENCE: " << *New);
 
             // Insert it into the bottom of the predecessor, right before the
             // terminator instruction...
index 705da7f1cba44a7614710e8eaee5cf2f5962df3b..6e107497d43d3fafa7bff56c374341541f72ec65 100644 (file)
@@ -127,7 +127,7 @@ bool Reassociate::ReassociateExpr(BinaryOperator *I) {
     std::swap(LHSRank, RHSRank);
     Changed = true;
     ++NumSwapped;
-    DEBUG(std::cerr << "Transposed: " << I
+    DEBUG(std::cerr << "Transposed: " << *I
           /* << " Result BB: " << I->getParent()*/);
   }
   
@@ -156,7 +156,7 @@ bool Reassociate::ReassociateExpr(BinaryOperator *I) {
         I->getParent()->getInstList().insert(I, LHSI);
 
         ++NumChanged;
-        DEBUG(std::cerr << "Reassociated: " << I/* << " Result BB: "
+        DEBUG(std::cerr << "Reassociated: " << *I/* << " Result BB: "
                                                    << I->getParent()*/);
 
         // Since we modified the RHS instruction, make sure that we recheck it.
@@ -235,7 +235,7 @@ bool Reassociate::ReassociateBB(BasicBlock *BB) {
       New->setOperand(1, NegateValue(New->getOperand(1), BI));
       
       Changed = true;
-      DEBUG(std::cerr << "Negated: " << New /*<< " Result BB: " << BB*/);
+      DEBUG(std::cerr << "Negated: " << *New /*<< " Result BB: " << BB*/);
     }
 
     // If this instruction is a commutative binary operator, and the ranks of
@@ -265,7 +265,7 @@ bool Reassociate::ReassociateBB(BasicBlock *BB) {
           I = Tmp;
           ++NumLinear;
           Changed = true;
-          DEBUG(std::cerr << "Linearized: " << I/* << " Result BB: " << BB*/);
+          DEBUG(std::cerr << "Linearized: " << *I/* << " Result BB: " << BB*/);
         }
 
         // Make sure that this expression is correctly reassociated with respect
index 38a403b1a5d0b3c51fcaa31157f351c23d83022c..5a0b100dc67694762a046a35f9e5e4491dda62ae 100644 (file)
@@ -289,7 +289,7 @@ bool SCCP::runOnFunction(Function &F) {
       Instruction *I = InstWorkList.back();
       InstWorkList.pop_back();
 
-      DEBUG(std::cerr << "\nPopped off I-WL: " << I);
+      DEBUG(std::cerr << "\nPopped off I-WL: " << *I);
       
       // "I" got into the work list because it either made the transition from
       // bottom to constant, or to Overdefined.
@@ -305,7 +305,7 @@ bool SCCP::runOnFunction(Function &F) {
       BasicBlock *BB = BBWorkList.back();
       BBWorkList.pop_back();
 
-      DEBUG(std::cerr << "\nPopped off BBWL: " << BB);
+      DEBUG(std::cerr << "\nPopped off BBWL: " << *BB);
 
       // Notify all instructions in this basic block that they are newly
       // executable.
@@ -329,7 +329,7 @@ bool SCCP::runOnFunction(Function &F) {
       InstVal &IV = ValueState[&Inst];
       if (IV.isConstant()) {
         Constant *Const = IV.getConstant();
-        DEBUG(std::cerr << "Constant: " << Const << " = " << Inst);
+        DEBUG(std::cerr << "Constant: " << *Const << " = " << Inst);
 
         // Replaces all of the uses of a variable with uses of the constant.
         Inst.replaceAllUsesWith(Const);
index aeba94afa1d2abfc80b82f897cc6ccffb1526883..44ef7905bdd96a8b6ac95d5f449a2bd21538a156 100644 (file)
@@ -294,7 +294,7 @@ bool SROA::isSafeAllocaToPromote(AllocationInst *AI) {
        I != E; ++I)
     if (!isSafeUseOfAllocation(cast<Instruction>(*I))) {
       DEBUG(std::cerr << "Cannot transform: " << *AI << "  due to user: "
-                      << *I);
+                      << **I);
       return false;
     }
   return true;