Skip to content

Commit a58b62b

Browse files
committed
[IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().
This method has been commented as deprecated for a while. Remove it and replace all uses with the equivalent getCalledOperand(). I also made a few cleanups in here. For example, to removes use of getElementType on a pointer when we could just use getFunctionType from the call. Differential Revision: https://reviews.llvm.org/D78882
1 parent 756ba35 commit a58b62b

File tree

71 files changed

+161
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+161
-173
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,10 +2701,10 @@ static llvm::Value *tryEmitFusedAutoreleaseOfResult(CodeGenFunction &CGF,
27012701

27022702
bool doRetainAutorelease;
27032703

2704-
if (call->getCalledValue() == CGF.CGM.getObjCEntrypoints().objc_retain) {
2704+
if (call->getCalledOperand() == CGF.CGM.getObjCEntrypoints().objc_retain) {
27052705
doRetainAutorelease = true;
2706-
} else if (call->getCalledValue() == CGF.CGM.getObjCEntrypoints()
2707-
.objc_retainAutoreleasedReturnValue) {
2706+
} else if (call->getCalledOperand() ==
2707+
CGF.CGM.getObjCEntrypoints().objc_retainAutoreleasedReturnValue) {
27082708
doRetainAutorelease = false;
27092709

27102710
// If we emitted an assembly marker for this call (and the
@@ -2720,8 +2720,8 @@ static llvm::Value *tryEmitFusedAutoreleaseOfResult(CodeGenFunction &CGF,
27202720
assert(prev);
27212721
}
27222722
assert(isa<llvm::CallInst>(prev));
2723-
assert(cast<llvm::CallInst>(prev)->getCalledValue() ==
2724-
CGF.CGM.getObjCEntrypoints().retainAutoreleasedReturnValueMarker);
2723+
assert(cast<llvm::CallInst>(prev)->getCalledOperand() ==
2724+
CGF.CGM.getObjCEntrypoints().retainAutoreleasedReturnValueMarker);
27252725
InstsToKill.push_back(prev);
27262726
}
27272727
} else {
@@ -2764,8 +2764,8 @@ static llvm::Value *tryRemoveRetainOfSelf(CodeGenFunction &CGF,
27642764
// Look for a retain call.
27652765
llvm::CallInst *retainCall =
27662766
dyn_cast<llvm::CallInst>(result->stripPointerCasts());
2767-
if (!retainCall ||
2768-
retainCall->getCalledValue() != CGF.CGM.getObjCEntrypoints().objc_retain)
2767+
if (!retainCall || retainCall->getCalledOperand() !=
2768+
CGF.CGM.getObjCEntrypoints().objc_retain)
27692769
return nullptr;
27702770

27712771
// Look for an ordinary load of 'self'.

clang/lib/CodeGen/CGObjC.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,8 @@ llvm::Value *CodeGenFunction::EmitARCRetainBlock(llvm::Value *value,
21602160
if (!mandatory && isa<llvm::Instruction>(result)) {
21612161
llvm::CallInst *call
21622162
= cast<llvm::CallInst>(result->stripPointerCasts());
2163-
assert(call->getCalledValue() == CGM.getObjCEntrypoints().objc_retainBlock);
2163+
assert(call->getCalledOperand() ==
2164+
CGM.getObjCEntrypoints().objc_retainBlock);
21642165

21652166
call->setMetadata("clang.arc.copy_on_escape",
21662167
llvm::MDNode::get(Builder.getContext(), None));

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2464,7 +2464,7 @@ void CodeGenFunction::emitAlignmentAssumptionCheck(
24642464
llvm::Value *OffsetValue, llvm::Value *TheCheck,
24652465
llvm::Instruction *Assumption) {
24662466
assert(Assumption && isa<llvm::CallInst>(Assumption) &&
2467-
cast<llvm::CallInst>(Assumption)->getCalledValue() ==
2467+
cast<llvm::CallInst>(Assumption)->getCalledOperand() ==
24682468
llvm::Intrinsic::getDeclaration(
24692469
Builder.GetInsertBlock()->getParent()->getParent(),
24702470
llvm::Intrinsic::assume) &&

lldb/source/Expression/IRInterpreter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
13711371

13721372
// Find the address of the callee function
13731373
lldb_private::Scalar I;
1374-
const llvm::Value *val = call_inst->getCalledValue();
1374+
const llvm::Value *val = call_inst->getCalledOperand();
13751375

13761376
if (!frame.EvaluateValue(I, val, module)) {
13771377
error.SetErrorToGenericError();

lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ class ObjcObjectChecker : public Instrumenter {
465465
}
466466

467467
static llvm::Function *GetCalledFunction(llvm::CallInst *inst) {
468-
return GetFunction(inst->getCalledValue());
468+
return GetFunction(inst->getCalledOperand());
469469
}
470470

471471
bool InspectInstruction(llvm::Instruction &i) override {

lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ bool IRForTarget::RemoveCXAAtExit(BasicBlock &basic_block) {
13951395
if (func && func->getName() == "__cxa_atexit")
13961396
remove = true;
13971397

1398-
llvm::Value *val = call->getCalledValue();
1398+
llvm::Value *val = call->getCalledOperand();
13991399

14001400
if (val && val->getName() == "__cxa_atexit")
14011401
remove = true;

llvm/include/llvm-c/Core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,8 +3252,8 @@ LLVMTypeRef LLVMGetCalledFunctionType(LLVMValueRef C);
32523252
* This expects an LLVMValueRef that corresponds to a llvm::CallInst or
32533253
* llvm::InvokeInst.
32543254
*
3255-
* @see llvm::CallInst::getCalledValue()
3256-
* @see llvm::InvokeInst::getCalledValue()
3255+
* @see llvm::CallInst::getCalledOperand()
3256+
* @see llvm::InvokeInst::getCalledOperand()
32573257
*/
32583258
LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr);
32593259

llvm/include/llvm/CodeGen/FastISel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class FastISel {
127127
const CallBase &Call,
128128
unsigned FixedArgs = ~0U) {
129129
RetTy = ResultTy;
130-
Callee = Call.getCalledValue();
130+
Callee = Call.getCalledOperand();
131131
Symbol = Target;
132132

133133
IsInReg = Call.hasRetAttr(Attribute::InReg);

llvm/include/llvm/IR/AbstractCallSite.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,16 @@ class AbstractCallSite {
201201
}
202202

203203
/// Return the pointer to function that is being called.
204-
Value *getCalledValue() const {
204+
Value *getCalledOperand() const {
205205
if (isDirectCall())
206-
return CB->getCalledValue();
206+
return CB->getCalledOperand();
207207
return CB->getArgOperand(getCallArgOperandNoForCallee());
208208
}
209209

210210
/// Return the function being called if this is a direct call, otherwise
211211
/// return null (if it's an indirect call).
212212
Function *getCalledFunction() const {
213-
Value *V = getCalledValue();
213+
Value *V = getCalledOperand();
214214
return V ? dyn_cast<Function>(V->stripPointerCasts()) : nullptr;
215215
}
216216
};

llvm/include/llvm/IR/InstrTypes.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,10 +1286,6 @@ class CallBase : public Instruction {
12861286

12871287
Value *getCalledOperand() const { return Op<CalledOperandOpEndIdx>(); }
12881288

1289-
// DEPRECATED: This routine will be removed in favor of `getCalledOperand` in
1290-
// the near future.
1291-
Value *getCalledValue() const { return getCalledOperand(); }
1292-
12931289
const Use &getCalledOperandUse() const { return Op<CalledOperandOpEndIdx>(); }
12941290
Use &getCalledOperandUse() { return Op<CalledOperandOpEndIdx>(); }
12951291

0 commit comments

Comments
 (0)