Skip to content

[NFC] Update ChildTyper callback for unknown constaints#7814

Merged
tlively merged 2 commits intomainfrom
child-typer-no-skip-unreachable
Aug 11, 2025
Merged

[NFC] Update ChildTyper callback for unknown constaints#7814
tlively merged 2 commits intomainfrom
child-typer-no-skip-unreachable

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented Aug 11, 2025

When ChildTyper does not have enough type information to generate type
constraints (for example, because a child whose type provides crucial
information is unreachable), it previously allowed the user to determine
whether to return early or not. But not returning early would then lead
to an assertion failure or other bad behavior, so it is never a
reasonable choice. The only real choice a user has is to return early
and ignore the situation (which is what TypeSSA wants) or to fail loudly
because this should never happen (which is what IRBuilder wants).
Simplify the callback to allow customizing this behavior but not whether
the early return ocurrs.

When ChildTyper does not have enough type information to generate type
constraints (for example, because a child whose type provides crucial
information is unreachable), it previously allowed the user to determine
whether to return early or not. But not returning early would then lead
to an assertion failure or other bad behavior, so it is never a
reasonable choice. The only real choice a user has is to return early
and ignore the situation (which is what TypeSSA wants) or to fail loudly
because this should never happen (which is what IRBuilder wants).
Simplify the callback to allow customizing this behavior but not whether
the early return ocurrs.
@tlively tlively requested a review from kripken August 11, 2025 20:01
switch (curr->op) {
case BrOnNull:
case BrOnNonNull:
assert(!target);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure why this is so. Perhaps add a comment?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

@tlively tlively enabled auto-merge (squash) August 11, 2025 20:56
@tlively tlively merged commit 9fe0d16 into main Aug 11, 2025
16 checks passed
@tlively tlively deleted the child-typer-no-skip-unreachable branch August 11, 2025 21:35
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