Skip to content

Fix assertion failure when performing constant-evaluation through basic blocks with non-constant arguments #80873

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
Apr 18, 2025

Conversation

matthewseaman
Copy link
Contributor

This fixes one of the issues exposed by #79707, which marked more integer initializers as @_transparent.

The constant evaluator was overly conservative in returning early when arguments to basic blocks were non-constant. This caused us to hit an assertion assuming that we would only fail to proceed past an unconditional branch if we are inside a loop.

Now, when encountering an unconditional branch, we always proceed to the destination basic block even if some of the arguments are non-constant. This lets us get as far as we can go in constant evaluation and avoids the assertion.

@matthewseaman
Copy link
Contributor Author

@swift-ci please test

@meg-gupta
Copy link
Contributor

@swift-ci please test macOS platform

@meg-gupta
Copy link
Contributor

@swift-ci please test Linux platform

Copy link
Contributor

@meg-gupta meg-gupta left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@ravikandhadai ravikandhadai 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 @matthewseaman

@matthewseaman matthewseaman merged commit 02dd40f into main Apr 18, 2025
5 checks passed
@matthewseaman matthewseaman deleted the mseaman/const-expr-bb-args branch April 18, 2025 23:06
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