Skip to content

Conversation

aschackmull
Copy link
Contributor

This should improve performance significantly for neovim. All the possible values that are considered are singletons, so disjointness is equivalent to inequality - this means that we can replace the expensive forex with two counts. See also #20485 (comment)

@aschackmull aschackmull added the no-change-note-required This PR does not need a change note label Oct 1, 2025
@Copilot Copilot AI review requested due to automatic review settings October 1, 2025 12:12
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves performance for phi nodes with many incoming constant values by optimizing the uniqueValue predicate. It replaces an expensive forex operation with more efficient counting operations, leveraging the fact that all possible values are singletons where disjointness is equivalent to inequality.

  • Replaced forex with disjointValues check using two strictcount operations
  • Added documentation clarifying that the predicate is restricted to constant singleton values
  • Improved performance for cases like neovim with many incoming constant values

@MathiasVP
Copy link
Contributor

MathiasVP commented Oct 1, 2025

Thanks a lot, Schack! This looks really good locally 🎉 I'm doing a DCA on #20485 with this PR on top of it which should cover C/C++, at least. Do you want to do a DCA for Java as well?

@aschackmull
Copy link
Contributor Author

Do you want to do a DCA for Java as well?

Might as well. Triggered now.

@MathiasVP
Copy link
Contributor

Looks like Neovim is happy now 🎉 Here is the performance impact of #20485 with this PR on top:

image

@MathiasVP
Copy link
Contributor

The CPP CI failures are unrelated and would be fixed by merging in main, but I'll just go ahead and merge this now.

@MathiasVP MathiasVP merged commit 6eb2aad into github:main Oct 1, 2025
37 of 38 checks passed
@aschackmull aschackmull deleted the guards/uniquevalue-perf branch October 2, 2025 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants