Fixes working towards PR341

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14839 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-07-15 01:50:47 +00:00
parent ce36d55cf8
commit 2fc1230dd6
6 changed files with 23 additions and 22 deletions

View 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()));
}
};

View 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;
}

View 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...

View 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

View 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);

View 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;