Skip to content

Add Dropped Variable Statistics for MIR #10019

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

Merged

Conversation

rastogishubham
Copy link

This patch adds support for dropped variable statistics in MIR.

It cherry-picks:
8c5a048: This patch moved the class DroppedVariableStats code to it's own file and be extensible. It also introduced class DroppedVariableStatsIR that calculates dropped statistics to IR.

7cfb292: This patch moved the class DroppedVariableStatsIR code to it's own file.

0622cd2: This patch adds a PassID to the runOnFunction and runOnModule functions as an argument for easier debuggability.

and 999a765: This patch adds class DroppedVariableStatsMIR to calculate dropped variable statistics in MIR. It also moves class DroppedVariableStats and class DroppedVariableStatsIR code to the llvm/IR lib

[NFC] Move DroppedVariableStats to its own file and redesign it to be
extensible. (llvm#115563)

Move DroppedVariableStats code to its own file and change the class to
have an extensible design so that we can use it to add dropped
statistics to MIR passes and the instruction selector.

(cherry picked from commit 5717a99)
Move DroppedVariableStats code to its own file and change the class to
have an extensible design so that we can use it to add dropped
statistics to MIR passes and the instruction selector.

Also moved class DroppedVariableStatsIR to its own file.

Reland 2de7881

(cherry picked from commit 0b5b09b)
Debugging the dropped variable statistics for large LLVM IR files can be
made easier if the functions called before an optimization pass is run
includes the PassID of the pass that will be run after statistics
metrics are collected. This patch adds that support.

(cherry picked from commit 12903fb)
This patch attempts to reland
llvm#120780 while addressing the
issues that caused the patch to be reverted.

Namely:

1. The patch had included code from the llvm/Passes directory in the
llvm/CodeGen directory.

2. The patch increased the backend compile time by 2% due to adding a
very expensive include in MachineFunctionPass.h

The patch has been re-structured so that there is no dependency between
the llvm/Passes and llvm/CodeGen directory, by moving the base class,
`class DroppedVariableStats` to the llvm/IR directory.

The expensive include in MachineFunctionPass.h has been changed to
contain forward declarations instead of other header includes which was
pulling a ton of code into MachineFunctionPass.h and should resolve any
issues when it comes to compile time increase.

(cherry picked from commit 92f916f)
@rastogishubham rastogishubham requested a review from a team as a code owner February 13, 2025 08:33
@rastogishubham
Copy link
Author

@swift-ci please test

@rastogishubham
Copy link
Author

@swift-ci please test macOS

@rastogishubham
Copy link
Author

@swift-ci please test Linux

@rastogishubham rastogishubham merged commit 863c801 into swiftlang:stable/20240723 Feb 13, 2025
3 checks passed
@rastogishubham rastogishubham deleted the MIRStatsStable branch February 13, 2025 17:35
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.

1 participant