summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-15 01:50:47 +0000
committerChris Lattner <sabre@nondot.org>2004-07-15 01:50:47 +0000
commit2fc1230dd68e3f67d36b295adc5168733c412009 (patch)
treeb4e7f73a9f48622b8f1695104b4a3957955d4fd8 /lib/Transforms
parentce36d55cf8d3239942e0e9c426c835f0c33a11e6 (diff)
downloadllvm-2fc1230dd68e3f67d36b295adc5168733c412009.tar.gz
llvm-2fc1230dd68e3f67d36b295adc5168733c412009.tar.bz2
llvm-2fc1230dd68e3f67d36b295adc5168733c412009.tar.xz
Fixes working towards PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14839 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp4
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp8
-rw-r--r--lib/Transforms/Scalar/PRE.cpp17
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp8
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp6
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp2
6 files changed, 23 insertions, 22 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 98f8bed516..04a6417272 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -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()));
}
};
diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp
index d9e96485fc..aeeade40cc 100644
--- a/lib/Transforms/Scalar/CorrelatedExprs.cpp
+++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp
@@ -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;
}
diff --git a/lib/Transforms/Scalar/PRE.cpp b/lib/Transforms/Scalar/PRE.cpp
index 88d9143d07..cfa74b928d 100644
--- a/lib/Transforms/Scalar/PRE.cpp
+++ b/lib/Transforms/Scalar/PRE.cpp
@@ -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...
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 705da7f1cb..6e107497d4 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -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
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 38a403b1a5..5a0b100dc6 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -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);
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index aeba94afa1..44ef7905bd 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -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;