[RFC] Computing, storing, and restoring conservative call graphs with LLVM

Hi all,

Please find the RFC for computing, storing, and restoring conservative
call graphs with LLVM below.

This is an early version of the proposed feature, and we are still
exploring the ways to implement it. Comments and suggestions are
welcome.

Summary

Hi all,

Please see the updates to the RFC below.

The terms “type hash”, “type identifier”, and “type id” are used
interchangeably.

The original RFC describes a use case, which is efficient stack trace
collection and reconstruction via offline reverse call graph
traversal. Besides call graph storing and reconstruction as described
in this RFC, additional LLVM features will be introduced for this use
case including 1) ASan features to collect and report compressed stack
traces, 2) a stand-alone tool to reconstruct stack traces based on the
compressed trace and the call graph. A separate RFC will be sent
shortly for these.

Updates

Reviving this effort

Please note that the contents of this RFC is truncated due to possible markdown formatting issues in migrating the RFC from the mailing list. Please find the links to the original mailing list entries.

Original RFC: [llvm-dev] [RFC] Computing, storing, and restoring conservative call graphs with LLVM
Updated RFC: [llvm-dev] [RFC] Computing, storing, and restoring conservative call graphs with LLVM

The two RFC links above describe the design for emitting a call graph section to object files. The original implementation of this design is among these eight patches ⚙ D105916 [AsmPrinter][CallGraphSection] Emit call graph section. Six of these eight patches had been approved by the reviewers. However these patches were not landed at that time (July 2021). I am interested in addressing the outstanding issues in these patches and landing them. Towards this, I had rebased these patches on ToT LLVM. I am planning to commandeer the existing patches and upload the fixes required to address the compilation/test failures to Phabricator.

The previous reviewers for the patches in Phabricator:
CC: @MaskRay, @vitalybuka, @djtodoro, @matt_morehouse

Hi there,

I am trying to get the result of the call graph by using “llvm-objdump --call-graph-info a.out”. However, it said there is not --call-graph-info instruction in llvm-objdump. Do you mind sharing the github link or anything that have the --call-graph-info command ?

Best,
Ryan

I am going to give this way up if there is no one response tomorrow.

Thx
Ryan

Hi there! Apologies. I was out on vacation for the past couple of weeks.

The patches to emit callgraph are a WIP. I need to address the comments and upload them again to get them landed. You can see them in my outstanding PRs. I can point you to the specific ones later in the week once I go through my higher priority items ( Pull requests · llvm/llvm-project · GitHub ). I have the objdump patches to read the section ready to go but I’d like to land the emit patches before I send out the objdump patches for review. Thank you.