Skip to content

Conversation

@topolarity
Copy link
Member

If we blindly insert a PiNode without considering liveness, that can create a usage "out of thin air" that our PhiNode insertion did not account for. The result is a reference to a non-dominating value, producing invalid IR.

Resolves #51144.

p.s. I'd like to re-factor this code in the future to walk the dominator tree so that we can re-use PiNode's across basic blocks and avoid some of these temporaries, but this is good as a quick fix.

Copy link
Member

@maleadt maleadt left a comment

Choose a reason for hiding this comment

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

Not familiar with the code, but it does seem to fix both the MWE and BioStockholm.jl, so SGTM.

PhiNodes are not required to be inserted for blocks where a variable is
dead, so we can end up with "incoming" values to the block that aren't
valid dominators.

This is benign since (un-)liveness means that these values should never
end up in the IR, but if we blindly insert a PiNode, that can create a
usage "out of thin air" that references a non-dominating value and
produces invalid IR.

This commit resolves this by saving the liveness information from
PhiNode insertion and checking against it for PiNode insertion.
Copy link
Member

@aviatesk aviatesk left a comment

Choose a reason for hiding this comment

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

LGTM.

@nanosoldier runbenchmarks("inference", vs=":master")

@topolarity
Copy link
Member Author

@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@aviatesk aviatesk merged commit c476d84 into JuliaLang:master Sep 22, 2023
@topolarity topolarity deleted the fix-51144 branch September 22, 2023 16:51
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.

Internal compiler error: UndefRefError during compaction

4 participants