Skip to content

[BitcodeReader] Avoid quadratic complexity in intrinsic upgrade #150032

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
merged 1 commit into from
Jul 23, 2025

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Jul 22, 2025

When materializing a function, we'd upgrade all calls to all upgraded intrinsics. However, this would operate on all calls to the intrinsic (including previously materialized ones), which leads to quadratic complexity.

Instead, only upgrade the calls that are in the materialized function.

This fixes a compile-time regression introduced by #149310.

Compile-time: https://llvm-compile-time-tracker.com/compare.php?from=cb8b0cd2cfbe817253f2679df53dd7926a7e1894&to=f2c866239748e90685aff15780d4b2132eb329e9&stat=instructions:u

When materializing a function, we'd upgrade all calls to all
upgraded intrinsics. However, this would operate on all calls to
the intrinsic (including previously materialized ones), which
leads to quadratic complexity.

Instead, only upgrade the calls that are in the materialized
function.

This fixes a compile-time regression introduced by llvm#149310.
@nikic nikic requested review from pcc, fhahn and dtcxzyw July 22, 2025 14:31
Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

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

LG.

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@nikic nikic merged commit 0cfea5b into llvm:main Jul 23, 2025
10 checks passed
@nikic nikic deleted the bc-auto-upgrade branch July 23, 2025 07:52
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.

3 participants