Constant *ConstantCallSrc = 0;
if (Constant *CS = dyn_cast<Constant>(CI->getCalledValue()))
ConstantCallSrc = CS;
- else if (GlobalValue *GV = dyn_cast<GlobalValue>(CI->getCalledValue()))
- ConstantCallSrc = ConstantPointerRef::get(GV);
if (ConstantCallSrc)
NewCast = ConstantExpr::getCast(ConstantCallSrc, NewPFunTy);
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()));