Skip to content

[CIR][LoweringPrepare] Wrap cir.va_arg lowered code in a cir.scope #1768

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 2 commits into from
Aug 7, 2025

Conversation

tommymcm
Copy link
Contributor

The cir.va_arg lowering may introduce an if-else control flow.
This breaks the verifier for control flow operations, e.g., cir.for, where there can be only one block inside of the cond and step regions.
This PR wraps the lowered code in a cir.scope (only if it will lower to the if-else control flow). A
dded a test for va_arg inside for loop condition, the basic pattern is: for (; va_arg(...););

The `cir.va_arg` lowering may introduce an if-else control flow.
This breaks the verifier for control flow operations, e.g., `cir.for`, where there can be only one block inside of the `cond` and `step` regions.
This PR wraps the lowered code in a `cir.scope` (only if it will lower to the if-else control flow).
Added a test for `va_arg` inside for loop condition, the basic pattern is: `for (; va_arg(...););`
@bcardosolopes bcardosolopes merged commit 02bef56 into llvm:main Aug 7, 2025
6 of 9 checks passed
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