[llvm-branch-commits] [CallSiteInfo][CallGraphSection] Extract and propagate indirect call type ids (PR #87575)
Paul Kirth via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 14 10:20:46 PST 2024
================
@@ -488,6 +490,38 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction {
/// Callee type id.
ConstantInt *TypeId = nullptr;
+
+ CallSiteInfo() {}
+
+ /// 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;
+
+ auto Opt = CB.getOperandBundle(LLVMContext::OB_type);
+ if (!Opt.has_value()) {
+ errs() << "warning: cannot find indirect call type operand bundle for "
+ "call graph section\n";
+ return;
----------------
ilovepi wrote:
This is still using `llvm::errs()`. There are other methods, as mentioned above. Using `diagnose` seems to be the most common method in `CodeGen`, so please update your patch use one of the established methods.
https://github.com/llvm/llvm-project/pull/87575
More information about the llvm-branch-commits
mailing list