Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[llvm] Add option to emit callgraph section #87574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: users/Prabhuk/sprmain.callsiteinfocallgraphsection-extend-callsiteinfo-with-typeid
Choose a base branch
Loading
from

Conversation

Prabhuk
Copy link
Contributor

@Prabhuk Prabhuk commented Apr 3, 2024

Introducing EnableCallGraphSection target option. The cl::opt flag to
enable this option is --call-graph-section.

Adding CalleeTypeIds field to CallSiteInfo to tracking callee type ids.
Read the calle type ids in and out by the MIR parser/printer.

CalleeTypeIds is only set for callSites.CalleeTypeIds fields from MIR
inputs. An upcoming patch will pass type ids from the clang front-end.

Created using spr 1.3.6-beta.1
Prabhuk pushed a commit to Prabhuk/llvm-project that referenced this pull request Apr 19, 2024
Add TypeId field to CallSiteInfo for tracking callee type id. Read the type
id in and out by the MIR parser/printer.

With this patch, TypeId is only set from callSites.typeId fields from MIR
inputs. An upcoming patch will pass type ids from the clang front-end,
and they will be read and set while lowering in the LLVM middle-end.

Original RFC: https://lists.llvm.org/pipermail/llvm-dev/2021-June/151044.html
Updated RFC: https://lists.llvm.org/pipermail/llvm-dev/2021-July/151739.html

Reviewed By:
morehouse

Differential Revision: https://reviews.llvm.org/D107110?id=362890

Pull Request: llvm#87574
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@Prabhuk Prabhuk requested review from ilovepi and arsenm November 20, 2024 22:11
@Prabhuk Prabhuk changed the title [CallSiteInfo][CallGraphSection] Extend CallSiteInfo with TypeId [llvm] Extend CallSiteInfo with TypeId Dec 10, 2024
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@ilovepi
Copy link
Contributor

ilovepi commented Feb 6, 2025

I think we could probably do w/ a few more test cases.

  1. Some direct calls (e.g. foo->bar, bar->fizz, bar->buzz)
  2. the indirect callee is ambiguous (you could do this with control flow, or via parameter w/o much difference).
  3. the type of the callee matches another function, but the callee is known (simplest case would be two void functions).

There may be other cases we also want to check, but these three seem like a good start. I imagine they could be useful as you flesh out more features too.

@Prabhuk Prabhuk changed the title [llvm] Extend CallSiteInfo with TypeId [llvm] Add option to emit callgraph section Feb 11, 2025
Created using spr 1.3.6-beta.1
Prabhuk added a commit to Prabhuk/llvm-project that referenced this pull request Mar 12, 2025
Introducing `EnableCallGraphSection` target option. The cl::opt flag to
enable this option is `--call-graph-section`.

Adding TypeId field to CallSiteInfo for tracking callee type id. Read the
type id in and out by the MIR parser/printer.

TypeId is only set for callSites.typeId fields from MIR
inputs. An upcoming patch will pass type ids from the clang front-end,
and they will be read and set while lowering in the LLVM middle-end.

Pull Request: llvm#87574
Prabhuk added 2 commits March 13, 2025 01:03
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@Prabhuk
Copy link
Contributor Author

Prabhuk commented Mar 13, 2025

I think we could probably do w/ a few more test cases.

  1. Some direct calls (e.g. foo->bar, bar->fizz, bar->buzz)
  2. the indirect callee is ambiguous (you could do this with control flow, or via parameter w/o much difference).
  3. the type of the callee matches another function, but the callee is known (simplest case would be two void functions).

There may be other cases we also want to check, but these three seem like a good start. I imagine they could be useful as you flesh out more features too.

I've added new tests for 1 & 2. I don't understand the purpose of the third suggestion.

@Prabhuk Prabhuk requested a review from ilovepi March 13, 2025 01:24
Created using spr 1.3.6-beta.1
Prabhuk added a commit to Prabhuk/llvm-project that referenced this pull request Apr 15, 2025
Introducing `EnableCallGraphSection` target option. The cl::opt flag to
enable this option is `--call-graph-section`.

Adding TypeId field to CallSiteInfo for tracking callee type id. Read the
type id in and out by the MIR parser/printer.

TypeId is only set for callSites.typeId fields from MIR
inputs. An upcoming patch will pass type ids from the clang front-end,
and they will be read and set while lowering in the LLVM middle-end.

Pull Request: llvm#87574
Created using spr 1.3.6-beta.1
Prabhuk added a commit to Prabhuk/llvm-project that referenced this pull request Apr 22, 2025
Introducing `EnableCallGraphSection` target option. The cl::opt flag to
enable this option is `--call-graph-section`.

Adding CalleeTypeIds field to CallSiteInfo to tracking callee type ids.
Read the calle type ids in and out by the MIR parser/printer.

CalleeTypeIds is only set for callSites.CalleeTypeIds fields from MIR
inputs. An upcoming patch will pass type ids from the clang front-end.

Pull Request: llvm#87574
Prabhuk added 4 commits April 23, 2025 01:02
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Prabhuk added 4 commits April 24, 2025 20:39
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@Prabhuk Prabhuk force-pushed the users/Prabhuk/sprcallsiteinfocallgraphsection-extend-callsiteinfo-with-typeid branch from a703c75 to 1a104c9 Compare May 1, 2025 20:48
Prabhuk added 2 commits May 5, 2025 23:13
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Prabhuk added a commit to Prabhuk/llvm-project that referenced this pull request May 10, 2025
Introducing `EnableCallGraphSection` target option. The cl::opt flag to
enable this option is `--call-graph-section`.

Adding CalleeTypeIds field to CallSiteInfo to tracking callee type ids.
Read the calle type ids in and out by the MIR parser/printer.

CalleeTypeIds is only set for callSites.CalleeTypeIds fields from MIR
inputs. An upcoming patch will pass type ids from the clang front-end.

Pull Request: llvm#87574
return error(Twine("Call site info provided but not used"));
if (!YamlMF.CallSitesInfo.empty() &&
!(TM.Options.EmitCallSiteInfo || TM.Options.EmitCallGraphSection))
return error(Twine("call site info provided but not used"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably don't need the explicit Twine()

Created using spr 1.3.6-beta.1
Copy link
Contributor

@ilovepi ilovepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from my perspective. Do wait for other reviewers to chime in before landing though.

Prabhuk added 2 commits May 14, 2025 02:06
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.