aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/LevelRaise.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-09 00:20:55 +0000
committerChris Lattner <sabre@nondot.org>2004-02-09 00:20:55 +0000
commit99d6b8ec95b86b3e66e2fea50d4114c844edc9dd (patch)
treea6d2d594546487f65fe640e22595fb3f10ebc8e2 /lib/Transforms/LevelRaise.cpp
parent71151aee60d785aebefb0b4cdf085469d4a696a4 (diff)
The ConstantExpr::getCast call can cause a CPR to be generated. If so,
strip it off. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/LevelRaise.cpp')
-rw-r--r--lib/Transforms/LevelRaise.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index c128688da2..12268edbed 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -539,6 +539,10 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
NewCast = new CastInst(CI->getCalledValue(), NewPFunTy,
CI->getCalledValue()->getName()+"_c",CI);
+ // Strip off unneeded CPR's.
+ if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(NewCast))
+ NewCast = CPR->getValue();
+
// Create a new call instruction...
CallInst *NewCall = new CallInst(NewCast,
std::vector<Value*>(CI->op_begin()+1, CI->op_end()));