[Constant Hoisting] Erase dead cast instructions.
authorJuergen Ributzka <juergen@apple.com>
Sat, 22 Mar 2014 01:49:30 +0000 (01:49 +0000)
committerJuergen Ributzka <juergen@apple.com>
Sat, 22 Mar 2014 01:49:30 +0000 (01:49 +0000)
The cleanup code that removes dead cast instructions only removed them from the
basic block, but didn't delete them. This fix erases them now too.

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

lib/Transforms/Scalar/ConstantHoisting.cpp

index ce2e7eb6bf22eb6681e3b27b787ef8bf4f752454..cd0801d1efa50ca7338910bc6523a6114e276a17 100644 (file)
@@ -595,7 +595,7 @@ bool ConstantHoisting::emitBaseConstants() {
 void ConstantHoisting::deleteDeadCastInst() const {
   for (auto const &I : ClonedCastMap)
     if (I.first->use_empty())
-      I.first->removeFromParent();
+      I.first->eraseFromParent();
 }
 
 /// \brief Optimize expensive integer constants in the given function.