Skip to content

Add a pass to collect dropped variable statistics (#102233) #9463

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 is inspired by @Snowy1803 excellent work in swift and the patch: https://github.com/swiftlang/swift/pull/73334/files

Add an instrumentation pass to llvm to collect dropped debug information variable statistics for every Function-level and Module-level IR pass.

This patch creates adds the class DroppedVariableStats which iterates over every DbgRecord in a function or module before and after an optimization pass and counts the number of variables who's debug information has been dropped due to that pass, then prints that output to stdout in a csv format.

I ran this patch on optdriver.cpp can see:

Pass Name, Dropped Variables
'InstCombinePass', 1
'SimplifyCFGPass', 6
'JumpThreadingPass', 25

(cherry picked from commit b8930cd)

This patch is inspired by @Snowy1803 excellent work in swift and the
patch: https://github.com/swiftlang/swift/pull/73334/files

Add an instrumentation pass to llvm to collect dropped debug information
variable statistics for every Function-level and Module-level IR pass.

This patch creates adds the class DroppedVariableStats which iterates
over every DbgRecord in a function or module before and after an
optimization pass and counts the number of variables who's debug
information has been dropped due to that pass, then prints that output
to stdout in a csv format.

I ran this patch on optdriver.cpp can see:

Pass Name, Dropped Variables
'InstCombinePass', 1
'SimplifyCFGPass', 6
'JumpThreadingPass', 25

(cherry picked from commit b8930cd)
@rastogishubham
Copy link
Author

@swift-ci please test

@rastogishubham rastogishubham merged commit b3da1b9 into swiftlang:stable/20240723 Oct 23, 2024
2 of 3 checks passed
@rastogishubham rastogishubham deleted the DroppedVarStatsStable branch October 23, 2024 01:10
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