This is an archive of the discontinued LLVM Phabricator instance.

[MachineVerifier] Live interval for a subreg must have subranges
ClosedPublic

Authored by foad on Oct 26 2021, 9:25 AM.

Details

Summary

MachineVerifier verified the subranges of a live interval if
they existed, but did not complain if they did not exist.

This patch changes the verifier to complain if there are no
subranges in the live interval for a subreg operand (so long
as MachineRegisterInfo says we should be tracking subreg
liveness for that register). This matches the conditions for
LiveIntervalCalc to create subranges in the first place.

Diff Detail

Event Timeline

foad created this revision.Oct 26 2021, 9:25 AM
foad requested review of this revision.Oct 26 2021, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2021, 9:25 AM

This came up when I was debugging -early-live-intervals failures. I ran into cases where TwoAddressInstruction violates this rule (which was not detected by MachineVerifier), which then causes RegisterCoalescer to either fail assertions, or produce even worse code which does fail machine verification.

foad added inline comments.Oct 26 2021, 9:30 AM
llvm/lib/CodeGen/MachineVerifier.cpp
2227–2229

This is the only substantive change. The rest is just NFC refactoring.

arsenm accepted this revision.Oct 26 2021, 9:32 AM

LGTM. I think this should be enforced

This revision is now accepted and ready to land.Oct 26 2021, 9:32 AM
foad edited the summary of this revision. (Show Details)Nov 2 2021, 8:40 AM
This revision was landed with ongoing or failed builds.Nov 15 2021, 2:18 AM
This revision was automatically updated to reflect the committed changes.