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
This commit is contained in:
Chris Lattner 2004-02-09 00:20:55 +00:00
parent 71151aee60
commit 99d6b8ec95

View File

@ -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()));