Skip to content

[StackColoring] Declare BitVector outside the loop #95688

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

kazutakahirata
Copy link
Contributor

The StackColoring pass creates two instances of BitVector per basic
block until the fixed point is reached. Each instance may involve a
heap allocation depending on its size.

This patch declares them outside the loop, saving 1.40% of heap
allocations during the compilation of CGBuiltin.cpp.ii, a preprocessed
version of CGBuiltin.cpp.

The StackColoring pass creates two instances of BitVector per basic
block until the fixed point is reached.  Each instance may involve a
heap allocation depending on its size.

This patch declares them outside the loop, saving 1.40% of heap
allocations during the compilation of CGBuiltin.cpp.ii, a preprocessed
version of CGBuiltin.cpp.
@kazutakahirata kazutakahirata requested review from nikic and bjope June 16, 2024 04:32
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM

@kazutakahirata kazutakahirata merged commit c44d528 into llvm:main Jun 16, 2024
6 of 8 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_memory_140bp_StackColoring branch June 16, 2024 07:27
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.

2 participants