[llvm-branch-commits] [llvm] [llvm] Extract and propagate indirect call type id (PR #87575)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Mar 12 23:06:26 PDT 2025
================
@@ -499,6 +502,37 @@ class LLVM_ABI MachineFunction {
/// Callee type id.
ConstantInt *TypeId = nullptr;
+
+ CallSiteInfo() = default;
+
+ /// Extracts the numeric type id from the CallBase's type operand bundle,
+ /// and sets TypeId. This is used as type id for the indirect call in the
+ /// call graph section.
+ CallSiteInfo(const CallBase &CB) {
+ // Call graph section needs numeric type id only for indirect calls.
+ if (!CB.isIndirectCall())
+ return;
+
+ std::optional<OperandBundleUse> Opt =
+ CB.getOperandBundle(LLVMContext::OB_callee_type);
+ // Return if the operand bundle for call graph section cannot be found.
+ if (!Opt)
+ return;
+
+ // Get generalized type id string
+ auto OB = *Opt;
----------------
arsenm wrote:
Just use Opt->? Also rename Opt to something nicer
https://github.com/llvm/llvm-project/pull/87575
More information about the llvm-branch-commits
mailing list