This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: Fix livein calculation in MachineBasicBlock splitAt
ClosedPublic

Authored by critson on Sep 30 2020, 12:44 AM.

Details

Summary

Fix and simplify computation of liveins for new block.

Diff Detail

Event Timeline

critson created this revision.Sep 30 2020, 12:44 AM
critson requested review of this revision.Sep 30 2020, 12:44 AM

Fix in what way? How was it broken before?

Fix in what way? How was it broken before?

I have not fully root caused it, but if I apply D88537 with splitAt as-is then I get code generation errors due to missing liveins.
Since the code sequence in splitAt is almost the same as that used by computeAndAddLiveIns, it seems logic to use that instead?

Looking at the code again for the moment, I think the problem is that SplitPoint (after increment) is missed in the stepBackward application.
i.e. the iteration needs to be inclusive of the whole range, not exclusive of the end point.

critson updated this revision to Diff 295450.Sep 30 2020, 6:43 PM

Revise the fix to address the underlying problem in the original code.

I see now my previous fix was incorrect; however, was addressing the verifier
errors I was seeing because it would generate correct liveins on a per-block
basis, but not for chains of blocks (I am not sure if the verifier checks these?).

arsenm accepted this revision.Oct 1 2020, 6:57 AM
This revision is now accepted and ready to land.Oct 1 2020, 6:57 AM
This revision was landed with ongoing or failed builds.Oct 1 2020, 6:45 PM
This revision was automatically updated to reflect the committed changes.