eliminate the "Value" printing methods that print to a std::ostream.
This required converting a bunch of stuff off DOUT and other cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79819 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index cd901c0..6dd2641 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7831,7 +7831,7 @@
++UI; // If this instruction uses AI more than once, don't break UI.
++NumDeadInst;
- DOUT << "IC: DCE: " << *User << '\n';
+ DEBUG(errs() << "IC: DCE: " << *User << '\n');
EraseInstFromFunction(*User);
}
}
@@ -8387,8 +8387,8 @@
}
if (DoXForm) {
- DOUT << "ICE: EvaluateInDifferentType converting expression type to avoid"
- << " cast: " << CI;
+ DEBUG(errs() << "ICE: EvaluateInDifferentType converting expression type"
+ " to avoid cast: " << CI);
Value *Res = EvaluateInDifferentType(SrcI, DestTy,
CI.getOpcode() == Instruction::SExt);
if (JustReplace)
@@ -12915,14 +12915,15 @@
// DCE instruction if trivially dead.
if (isInstructionTriviallyDead(Inst)) {
++NumDeadInst;
- DOUT << "IC: DCE: " << *Inst << '\n';
+ DEBUG(errs() << "IC: DCE: " << *Inst << '\n');
Inst->eraseFromParent();
continue;
}
// ConstantProp instruction if trivially constant.
if (Constant *C = ConstantFoldInstruction(Inst, BB->getContext(), TD)) {
- DOUT << "IC: ConstFold to: " << *C << " from: " << *Inst << '\n';
+ DEBUG(errs() << "IC: ConstFold to: " << *C << " from: "
+ << *Inst << '\n');
Inst->replaceAllUsesWith(C);
++NumConstProp;
Inst->eraseFromParent();
@@ -13002,7 +13003,7 @@
while (Term != BB->begin()) { // Remove instrs bottom-up
BasicBlock::iterator I = Term; --I;
- DOUT << "IC: DCE: " << *I << '\n';
+ DEBUG(errs() << "IC: DCE: " << *I << '\n');
// A debug intrinsic shouldn't force another iteration if we weren't
// going to do one without it.
if (!isa<DbgInfoIntrinsic>(I)) {
@@ -13027,7 +13028,7 @@
AddUsesToWorkList(*I);
++NumDeadInst;
- DOUT << "IC: DCE: " << *I << '\n';
+ DEBUG(errs() << "IC: DCE: " << *I << '\n');
I->eraseFromParent();
RemoveFromWorkList(I);
@@ -13037,7 +13038,7 @@
// Instruction isn't dead, see if we can constant propagate it.
if (Constant *C = ConstantFoldInstruction(I, F.getContext(), TD)) {
- DOUT << "IC: ConstFold to: " << *C << " from: " << *I << '\n';
+ DEBUG(errs() << "IC: ConstFold to: " << *C << " from: " << *I << '\n');
// Add operands to the worklist.
AddUsesToWorkList(*I);
@@ -13089,13 +13090,13 @@
#ifndef NDEBUG
std::string OrigI;
#endif
- DEBUG(std::ostringstream SS; I->print(SS); OrigI = SS.str(););
+ DEBUG(raw_string_ostream SS(OrigI); I->print(SS); OrigI = SS.str(););
if (Instruction *Result = visit(*I)) {
++NumCombined;
// Should we replace the old instruction with a new one?
if (Result != I) {
- DOUT << "IC: Old = " << *I << '\n'
- << " New = " << *Result << '\n';
+ DEBUG(errs() << "IC: Old = " << *I << '\n'
+ << " New = " << *Result << '\n');
// Everything uses the new instruction now.
I->replaceAllUsesWith(Result);
@@ -13129,8 +13130,8 @@
InstParent->getInstList().erase(I);
} else {
#ifndef NDEBUG
- DOUT << "IC: Mod = " << OrigI << '\n'
- << " New = " << *I << '\n';
+ DEBUG(errs() << "IC: Mod = " << OrigI << '\n'
+ << " New = " << *I << '\n');
#endif
// If the instruction was modified, it's possible that it is now dead.