summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index cd901c0b14..6dd2641ad4 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7831,7 +7831,7 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
++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 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) {
}
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 @@ static void AddReachableCodeToWorklist(BasicBlock *BB,
// 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 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
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 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
AddUsesToWorkList(*I);
++NumDeadInst;
- DOUT << "IC: DCE: " << *I << '\n';
+ DEBUG(errs() << "IC: DCE: " << *I << '\n');
I->eraseFromParent();
RemoveFromWorkList(I);
@@ -13037,7 +13038,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
// 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 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
#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 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
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.