The issue comes about due to an interval split (a prelude to adding a
spill). The insertion of the spill is the point at which the assertion is
triggered, but it is the initial interval split that causes the error state.
A split is created by adding 2 new virtual registers and a copy from one to the
other at the split point. In this case, the register being split has
sub-registers and one of the lanes is never defined (other than with an
Inserting the copy causes a new use of the undefined lane and the copy is
inserted in a block with multiple predecessors. One of these predecessors has a
partial def (copy to one of the lanes) and is marked as undef which means that
the non-written lane is undefined. This is valid when there are no uses and the
original def is an IMPLICIT_DEF, but by adding the new use in the split copy,
this causes issues during the phase to extend uses during the split.
This fix detects a situation where it ignores any tagged
undefs in partial copies and traces back to any dead defs - if these are
confirmed then it treats the whole lane as dead and doesn't add the live range
to the newly created split register - this resolves the assertion.
There may be other more complicated cases with larger numbers of predecessors
that still break but are extremely unlikely to exhibit this issue.
See the comment in the lit test for an example of the problem (simplified in the