Repository navigation
bugc: keep an inlined body's control flow inside the body - #356
Merged
Merged
Conversation
gnidan
force-pushed
the
bugc-inline-membership
branch
from
October 7, 2026 01:35
7a13c7e to
ba22dca
Compare
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At O2 and O3, the inliner marks each inlined instruction with
transform: ["inline"], but not the body's terminators. A debugger counts theinlinemarkers on each step to decide which virtual frames are still open, so at the first branch of an inlinedifthe frame closed, long before the body'sreturn.These parts of an inlined body did not have the marker:
if's branch and the jumps between the body's blocksJUMPDESTat the entry of each of the body's blocks (its debug came only from the variables pass)returnwhen the body's return block has no instruction to carry it (as when the returned value is a phi). That jump is the body's exit, as a real call's exitJUMPis the callee's. This is not the case that bugc: leave the jump past an inlined return out of the inlined body #347 took the marker off: there thereturnis on an instruction, and the jump after it is the caller's codesplitPhiBranchEdgesputs on a branch edge into a block with phis. It had an empty debug, so it also had no source range and no variables, at every levelThe inliner now marks the body's terminators, and the jump that carries the return. A block's entry
JUMPDESTgets oneinlinemarker for each inlined body that its first operation is in, except for a body whoseinvokethat operation carries. An edge block takes its branch's context, without the branch'sinvokeorreturn, and also its inline sites and origin. The variables pass then lists the variables in scope there, as it does for the branch.The new test in
inline-bracket.test.tsruns a function with anifand a phi, inlined, on both paths at O2 and O3. It checks that each step from theinvokethrough thereturnhas the marker and lists variables.One known limit: the
PUSHbefore the return-carrying jump still lists the caller's variables, because that jump keeps the caller's placement. A terminator has noreturneddebug that would split the variables between its operations, as an instruction has.