This is an archive of the discontinued LLVM Phabricator instance.

[LiveIntervals] Handle moving up dead partial write
ClosedPublic

Authored by tpr on Feb 19 2018, 11:59 AM.

Details

Summary

In the test case, the machine scheduler moves a dead write to a subreg
up into the middle of a segment of the overall reg's live range, where
the segment had liveness only for other subregs in the reg.
handleMoveUp created an invalid live range, causing an assert a bit
later.

This commit fixes it to handle that situation. The segment is split in
two at the insertion point, and the part after the split, and any
subsequent segments up to the old position, are changed to be defined by
the moved def.

Apologies for the test -- it's the best that bugpoint could do, and I
couldn't turn it into a mir test because MIRPrinter failed with it.

Diff Detail

Event Timeline

tpr created this revision.Feb 19 2018, 11:59 AM

I put my handleMove() tests into unittests/MI/LiveIntervalTest.cpp, with manually crafted MI snippets and a specified move of a single instruction.

tpr updated this revision to Diff 135202.Feb 21 2018, 1:40 AM

V2: Better test

MatzeB accepted this revision.Feb 22 2018, 4:24 PM

This is a tricky case, good catch.

I have a bad feeling with handleMove() actually changing instructions (at least the liveness of the operands). But this is not the first case where this happens so. Looks good to me for now. Thanks.

This revision is now accepted and ready to land.Feb 22 2018, 4:24 PM
This revision was automatically updated to reflect the committed changes.