improve -debug output, so that -debug is more likely to print when
authorChris Lattner <sabre@nondot.org>
Mon, 31 Aug 2009 05:17:58 +0000 (05:17 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 31 Aug 2009 05:17:58 +0000 (05:17 +0000)
instcombine is changing stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80538 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 64f99e34c2946c5e2dd19202b46a8721b230d01b..d17abdf00592681a359f7635fd217e511f33a79d 100644 (file)
@@ -327,6 +327,8 @@ namespace {
     // instruction.  Instead, visit methods should return the value returned by
     // this function.
     Instruction *EraseInstFromFunction(Instruction &I) {
+      DEBUG(errs() << "IC: erase " << I);
+
       assert(I.use_empty() && "Cannot erase instruction that is used!");
       // Make sure that we reprocess all operands now that we reduced their
       // use counts.
@@ -10149,10 +10151,11 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
     }
   }
 
-  if (Caller->getType() != Type::getVoidTy(*Context) && !Caller->use_empty())
+  
+  if (!Caller->use_empty())
     Caller->replaceAllUsesWith(NV);
-  Caller->eraseFromParent();
-  Worklist.Remove(Caller);
+  
+  EraseInstFromFunction(*Caller);
   return true;
 }