aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-23 18:49:23 +0000
committerChris Lattner <sabre@nondot.org>2003-10-23 18:49:23 +0000
commit2e56dd82b3b3ab9dde8cc55c06df78cec4dbd3b7 (patch)
treef7592f8284673916718599c8a5707e4c2999d587
parent4065ef99f91f929e4e0305cbd22b44873bbe66ab (diff)
We might as well strip off any CPRs before propagation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9437 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index dc8698e162..bb21f11ffc 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -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;