Skip to content

Commit 793cde7

Browse files
committed
Use getCalledFunctionName() throughout the codebase.
1 parent 5d90a01 commit 793cde7

24 files changed

+115
-115
lines changed

llvm/include/llvm/Analysis/VectorUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class VFDatabase {
4141
/// a vector Function ABI.
4242
static void getVFABIMappings(const CallInst &CI,
4343
SmallVectorImpl<VFInfo> &Mappings) {
44-
const auto ScalarName = CI.getCalledFunctionName();
44+
const std::optional<StringRef> ScalarName = CI.getCalledFunctionName();
4545
if (!ScalarName.has_value())
4646
return;
4747

llvm/lib/Analysis/IRSimilarityIdentifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void IRInstructionData::setCalleeName(bool MatchByName) {
153153
}
154154

155155
if (!CI->isIndirectCall() && MatchByName)
156-
CalleeName = CI->getCalledFunction()->getName().str();
156+
CalleeName = CI->getCalledFunctionName()->str();
157157
}
158158

159159
void IRInstructionData::setPHIPredecessors(

llvm/lib/Analysis/KernelInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static void remarkFlatAddrspaceAccess(OptimizationRemarkEmitter &ORE,
159159
R << "in ";
160160
identifyFunction(R, Caller);
161161
if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(&Inst)) {
162-
R << ", '" << II->getCalledFunction()->getName() << "' call";
162+
R << ", '" << *II->getCalledFunctionName() << "' call";
163163
} else {
164164
R << ", '" << Inst.getOpcodeName() << "' instruction";
165165
}

llvm/lib/Analysis/ReplayInlineAdvisor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ std::unique_ptr<InlineAdvice> ReplayInlineAdvisor::getAdviceImpl(CallBase &CB) {
108108

109109
std::string CallSiteLoc =
110110
formatCallSiteLocation(CB.getDebugLoc(), ReplaySettings.ReplayFormat);
111-
StringRef Callee = CB.getCalledFunction()->getName();
111+
StringRef Callee = *CB.getCalledFunctionName();
112112
std::string Combined = (Callee + CallSiteLoc).str();
113113

114114
// Replay decision, if it has one

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4398,7 +4398,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
43984398
if (CI->getFunctionType() == NewFn->getFunctionType()) {
43994399
// Handle generic mangling change.
44004400
assert(
4401-
(CI->getCalledFunction()->getName() != NewFn->getName()) &&
4401+
(CI->getCalledFunctionName().value_or("") != NewFn->getName()) &&
44024402
"Unknown function for CallBase upgrade and isn't just a name change");
44034403
CI->setCalledFunction(NewFn);
44044404
return;

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9036,12 +9036,17 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
90369036
auto DescribeCallsite =
90379037
[&](OptimizationRemarkAnalysis &R) -> OptimizationRemarkAnalysis & {
90389038
R << "call from '" << ore::NV("Caller", MF.getName()) << "' to '";
9039-
if (auto *ES = dyn_cast<ExternalSymbolSDNode>(CLI.Callee))
9039+
if (auto *ES = dyn_cast<ExternalSymbolSDNode>(CLI.Callee)) {
90409040
R << ore::NV("Callee", ES->getSymbol());
9041-
else if (CLI.CB && CLI.CB->getCalledFunction())
9042-
R << ore::NV("Callee", CLI.CB->getCalledFunction()->getName());
9043-
else
9041+
}
9042+
 else if (CLI.CB) {
9043+
const std::optional<StringRef> CalleeName =
9044+
CLI.CB->getCalledFunctionName();
9045+
R << ore::NV("Callee", CalleeName.value_or("unknown callee"));
9046+
}
9047+
else {
90449048
R << "unknown callee";
9049+
}
90459050
R << "'";
90469051
return R;
90479052
};

llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,8 +1389,9 @@ bool AMDGPULibCalls::fold_sincos(FPMathOperator *FPOp, IRBuilder<> &B,
13891389
fInfo);
13901390
const std::string PairName = PartnerInfo.mangle();
13911391

1392-
StringRef SinName = isSin ? CI->getCalledFunction()->getName() : PairName;
1393-
StringRef CosName = isSin ? PairName : CI->getCalledFunction()->getName();
1392+
const std::optional<StringRef> CalleeName = CI->getCalledFunctionName();
1393+
StringRef SinName = isSin ? *CalleeName : PairName;
1394+
StringRef CosName = isSin ? PairName : *CalleeName;
13941395
const std::string SinCosPrivateName = SinCosLibFuncPrivate.mangle();
13951396
const std::string SinCosGenericName = SinCosLibFuncGeneric.mangle();
13961397

llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,9 +1638,9 @@ void SPIRVEmitIntrinsics::insertPtrCastOrAssignTypeInstr(Instruction *I,
16381638
return;
16391639

16401640
// collect information about formal parameter types
1641-
std::string DemangledName =
1642-
getOclOrSpirvBuiltinDemangledName(CI->getCalledFunction()->getName());
16431641
Function *CalledF = CI->getCalledFunction();
1642+
std::string DemangledName =
1643+
getOclOrSpirvBuiltinDemangledName(CalledF->getName());
16441644
SmallVector<Type *, 4> CalledArgTys;
16451645
bool HaveTypes = false;
16461646
for (unsigned OpIdx = 0; OpIdx < CalledF->arg_size(); ++OpIdx) {

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ std::string ModuleCallsiteContextGraph::getLabel(const Function *Func,
19621962
const Instruction *Call,
19631963
unsigned CloneNo) const {
19641964
return (Twine(Call->getFunction()->getName()) + " -> " +
1965-
cast<CallBase>(Call)->getCalledFunction()->getName())
1965+
*cast<CallBase>(Call)->getCalledFunctionName())
19661966
.str();
19671967
}
19681968

llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5278,12 +5278,12 @@ struct AAFoldRuntimeCallCallSiteReturned : AAFoldRuntimeCall {
52785278

52795279
CallBase *CB = dyn_cast<CallBase>(&I);
52805280
auto Remark = [&](OptimizationRemark OR) {
5281+
const std::optional<StringRef> CalleeName = CB->getCalledFunctionName();
52815282
if (auto *C = dyn_cast<ConstantInt>(*SimplifiedValue))
5282-
return OR << "Replacing OpenMP runtime call "
5283-
<< CB->getCalledFunction()->getName() << " with "
5284-
<< ore::NV("FoldedValue", C->getZExtValue()) << ".";
5285-
return OR << "Replacing OpenMP runtime call "
5286-
<< CB->getCalledFunction()->getName() << ".";
5283+
return OR << "Replacing OpenMP runtime call " << *CalleeName
5284+
<< " with " << ore::NV("FoldedValue", C->getZExtValue())
5285+
<< ".";
5286+
return OR << "Replacing OpenMP runtime call " << *CalleeName << ".";
52875287
};
52885288

52895289
if (CB && EnableVerboseRemarks)

0 commit comments

Comments
 (0)