cargo-llvm-lines icon indicating copy to clipboard operation
cargo-llvm-lines copied to clipboard

Render call-graph

Open matklad opened this issue 4 years ago • 1 comments

Once again, :heart: for building this, once again, in https://github.com/rust-analyzer/rust-analyzer/issues/10065, llvm-lines was instrumental for getting rid of a major code bloat.

In that issue, llvm-lines quickly identified the leaf bloated functions, but it was not obvious why those monomorphisations are there (indeed, they turned out to be dead code). To figure that out, I used a manual workflow of ctrl+F in the .ll file to follow call-chains of suspicious functions backwards, until I found the root cause of extra monomorphisations (in my case, drop method in trait objects vtable).

It would be very cool If I could somehow automate this process. I think cargo-llvm-lines could easily build a static call-graph between all monomorphizations.

I have no idea how to visualize that information in a convenient way though :(

matklad avatar Aug 29 '21 10:08 matklad

Ended up writing ad-hoc code to follow call chains: https://github.com/matklad/llcg

matklad avatar Aug 29 '21 16:08 matklad