OSDN Git Service

[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)
commit56f506811f622031c1c7e0403bc4db5e89039f03
tree578a14c41d1a53f1df833cbc15fd02f7888ad589
parentcbf6acb30e7d18bb8df420e5f49ab4f9fba51bd3
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340255 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/RegisterCoalescer.cpp
test/CodeGen/X86/coalesce-dead-lanes.mir [new file with mode: 0644]