[RegisterCoalescer] Do not assert when trying to remat dead values
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 21 Aug 2018 07:49:05 +0000 (07:49 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 21 Aug 2018 07:49:05 +0000 (07:49 +0000)
commit880f29157770a2fe51f08887c363e789f8d47ba6
tree7b6a588cb789735d9680b3219bcb634ac8322a61
parentf1dc867396a57afb26d91d1bd8d039817c263805
[RegisterCoalescer] Do not assert when trying to remat dead values

Summary:
RegisterCoalescer::reMaterializeTrivialDef used to assert that
the input register was live in. But as shown by the new
coalesce-dead-lanes.mir test case that seems to be a valid
scenario. We now return false instead of the assert, simply
avoiding to remat the dead def.

Normally a COPY of an undef value is eliminated by
eliminateUndefCopy(). Although we only do that when the
destination isn't a physical register. So the situation
above should be limited to the case when we copy an undef
value to a physical register.

Reviewers: kparzysz, wmi, tpr

Reviewed By: kparzysz

Subscribers: MatzeB, qcolombet, tpr, llvm-commits

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

llvm-svn: 340255
llvm/lib/CodeGen/RegisterCoalescer.cpp
llvm/test/CodeGen/X86/coalesce-dead-lanes.mir [new file with mode: 0644]