forked from OSchip/llvm-project
Add a setCalledFunction member to InvokeInst (like in CallInst)
and use this (as well as getCalledValue) to access the callee, instead of {g|s}etOperand(0). llvm-svn: 99084
This commit is contained in:
parent
322cbff3d3
commit
febf6ab718
|
@ -2516,6 +2516,11 @@ public:
|
|||
const Value *getCalledValue() const { return getOperand(0); }
|
||||
Value *getCalledValue() { return getOperand(0); }
|
||||
|
||||
/// setCalledFunction - Set the function called.
|
||||
void setCalledFunction(Value* Fn) {
|
||||
Op<0>() = Fn;
|
||||
}
|
||||
|
||||
// get*Dest - Return the destination basic blocks...
|
||||
BasicBlock *getNormalDest() const {
|
||||
return cast<BasicBlock>(getOperand(1));
|
||||
|
|
|
@ -622,12 +622,12 @@ static bool AllUsesOfValueWillTrapIfNull(Value *V,
|
|||
return false; // Storing the value.
|
||||
}
|
||||
} else if (CallInst *CI = dyn_cast<CallInst>(*UI)) {
|
||||
if (CI->getOperand(0) != V) {
|
||||
if (CI->getCalledValue() != V) {
|
||||
//cerr << "NONTRAPPING USE: " << **UI;
|
||||
return false; // Not calling the ptr
|
||||
}
|
||||
} else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
|
||||
if (II->getOperand(0) != V) {
|
||||
if (II->getCalledValue() != V) {
|
||||
//cerr << "NONTRAPPING USE: " << **UI;
|
||||
return false; // Not calling the ptr
|
||||
}
|
||||
|
|
|
@ -820,7 +820,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
|||
|
||||
// We cannot remove an invoke, because it would change the CFG, just
|
||||
// change the callee to a null pointer.
|
||||
cast<InvokeInst>(OldCall)->setOperand(0,
|
||||
cast<InvokeInst>(OldCall)->setCalledFunction(
|
||||
Constant::getNullValue(CalleeF->getType()));
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue