Do not let dead constant expressions hanging off of functions prevent IPCP.
authorChris Lattner <sabre@nondot.org>
Tue, 9 Nov 2004 20:47:30 +0000 (20:47 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 9 Nov 2004 20:47:30 +0000 (20:47 +0000)
This allows to elimination of a bunch of global pool descriptor args from
programs being pool allocated (and is also generally useful!)

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

lib/Transforms/IPO/IPConstantPropagation.cpp

index 64d1df8354abe0bc58a573924d24ef5204a79ce8..a1e09e6beffe98945647d1fb727638454147e342 100644 (file)
@@ -62,6 +62,9 @@ bool IPCP::runOnModule(Module &M) {
 bool IPCP::processFunction(Function &F) {
   if (F.aempty() || F.use_empty()) return false;  // No arguments?  Early exit.
 
+  // Delete any klingons.
+  F.removeDeadConstantUsers();
+
   std::vector<std::pair<Constant*, bool> > ArgumentConstants;
   ArgumentConstants.resize(F.asize());