We might as well strip off any CPRs before propagation
authorChris Lattner <sabre@nondot.org>
Thu, 23 Oct 2003 18:49:23 +0000 (18:49 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 23 Oct 2003 18:49:23 +0000 (18:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9437 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/IPConstantPropagation.cpp

index dc8698e1622d13179a5edc9e5813a4820ccafcd9..bb21f11ffc3e88b16b64cdb7e4e3338cf3b4a6a2 100644 (file)
@@ -103,7 +103,10 @@ bool IPCP::processFunction(Function &F) {
     // Do we have a constant argument!?
     if (!ArgumentConstants[i].second) {
       assert(ArgumentConstants[i].first && "Unknown constant value!");
-      AI->replaceAllUsesWith(ArgumentConstants[i].first);
+      Value *V = ArgumentConstants[i].first;
+      if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(V))
+        V = CPR->getValue();
+      AI->replaceAllUsesWith(V);
       ++NumArgumentsProped;
     }
   return true;