[MachineVerifier] Relax checkLivenessAtDef regarding dead subreg defs
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Thu, 20 Sep 2018 06:59:18 +0000 (06:59 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Thu, 20 Sep 2018 06:59:18 +0000 (06:59 +0000)
commitb2154af25f52589360eb43e2b74413dbba461aff
tree827d8c93d0bc3a41458a81724e2f0036e70502df
parent1f6020798493b536304dd36b393682b062ef1fbd
[MachineVerifier] Relax checkLivenessAtDef regarding dead subreg defs

Summary:
Consider an instruction that has multiple defs of the same
vreg, but defining different subregs:
  %7.sub1:rc, dead %7.sub2:rc = inst

Calling checkLivenessAtDef for the live interval associated
with %7 incorrectly reported "live range continues after a
dead def". The live range for %7 has a dead def at the slot
index for "inst" even if the live range continues (given that
there are later uses of %7.sub1).

This patch adjusts MachineVerifier::checkLivenessAtDef
to allow dead subregister definitions, unless we are checking
a subrange (when tracking subregister liveness).

A limitation is that we do not detect the situation when the
live range continues past an instruction that defines the
full virtual register by multiple dead subreg defines.

I also removed some dead code related to physical register
in checkLivenessAtDef. Wwe only call that method for virtual
registers, so I added an assertion instead.

Reviewers: kparzysz

Reviewed By: kparzysz

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52237

llvm-svn: 342618
llvm/lib/CodeGen/MachineVerifier.cpp
llvm/test/CodeGen/Hexagon/verify-liveness-at-def.mir [new file with mode: 0644]