[llvm] [Inliner] Put inline history into IR as !inline_history metadata (PR #190092)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 09:15:07 PDT 2026
================
@@ -3269,6 +3240,33 @@ void llvm::InlineFunctionImpl(CallBase &CB, InlineFunctionInfo &IFI,
IFI.InlinedCallSites.push_back(CB);
}
+ for (CallBase *ICB : IFI.InlinedCallSites) {
+ // We only track inline history if requested, or if the inlined call site
+ // was originally an indirect call (it may have become a direct call
+ // during inlining).
+ if (TrackInlineHistory ||
+ InlinedFunctionInfo.OriginallyIndirectCalls.contains(ICB)) {
+ // !inline_history is {Callee, CB.inline_history, ICB.inline_history}.
+ SmallVector<Metadata *, 4> History;
+ History.push_back(ValueAsMetadata::get(CalledFunc));
+ if (MDNode *CBHistory = CB.getMetadata(LLVMContext::MD_inline_history)) {
+ for (const auto &Op : CBHistory->operands()) {
+ if (Op)
----------------
nikic wrote:
Can Op really be null here?
https://github.com/llvm/llvm-project/pull/190092
More information about the llvm-commits
mailing list