Skip to content

[NFC] Simplify printing of unreachable replacements#8616

Open
tlively wants to merge 1 commit intomainfrom
simplify-unreachable-print
Open

[NFC] Simplify printing of unreachable replacements#8616
tlively wants to merge 1 commit intomainfrom
simplify-unreachable-print

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented Apr 17, 2026

When an instruction has a type immediate that we cannot print because the expression it is supposed to come from has unreachable or null type, we instead print an unreachable block with a comment saying what instruction we failed to print. We previously handled this via different code paths for type immediates that come from child expressions that type immediates that come from the printed expression's own return type. Unify these code paths in the printer by improving Properties::hasUnwritableTypeImmediate to handle both cases. Also fix the printing of ShallowExpression to check for unwritable type immediates first to avoid assertion failures.

When an instruction has a type immediate that we cannot print because the expression it is supposed to come from has unreachable or null type, we instead print an unreachable block with a comment saying what instruction we failed to print. We previously handled this via different code paths for type immediates that come from child expressions that type immediates that come from the printed expression's own return type. Unify these code paths in the printer by improving `Properties::hasUnwritableTypeImmediate` to handle both cases. Also fix the printing of `ShallowExpression` to check for unwritable type immediates first to avoid assertion failures.
@tlively tlively requested a review from a team as a code owner April 17, 2026 05:08
@tlively tlively requested review from aheejin and removed request for a team April 17, 2026 05:08
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.

1 participant