[llvm-branch-commits] [clang][CallGraphSection] Add type id metadata to indirect call and targets (PR #87573)
Eli Friedman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 5 12:32:43 PDT 2024
================
@@ -93,9 +93,17 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorCall(
*this, MD, This, ImplicitParam, ImplicitParamTy, CE, Args, RtlArgs);
auto &FnInfo = CGM.getTypes().arrangeCXXMethodCall(
Args, FPT, CallInfo.ReqArgs, CallInfo.PrefixSize);
- return EmitCall(FnInfo, Callee, ReturnValue, Args, nullptr,
+ llvm::CallBase *CallOrInvoke = nullptr;
+ auto Call = EmitCall(FnInfo, Callee, ReturnValue, Args, &CallOrInvoke,
CE && CE == MustTailCall,
CE ? CE->getExprLoc() : SourceLocation());
+
+ // Set type identifier metadata of indirect calls for call graph section.
+ if (CGM.getCodeGenOpts().CallGraphSection && CallOrInvoke &&
+ CallOrInvoke->isIndirectCall())
+ CGM.CreateFunctionTypeMetadataForIcall(MD->getType(), CallOrInvoke);
----------------
efriedma-quic wrote:
This seems like it's scattering calls to CreateFunctionTypeMetadataForIcall across a lot of different places; code like this is hard to maintain. Is there some reason we can't just do it in EmitCall() itself, or something like that?
https://github.com/llvm/llvm-project/pull/87573
More information about the llvm-branch-commits
mailing list