This is an archive of the discontinued LLVM Phabricator instance.

[RegisterCoalescer] Do not assert when trying to remat dead values
ClosedPublic

Authored by bjope on Aug 16 2018, 7:12 AM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

bjope created this revision.Aug 16 2018, 7:12 AM

Just adding some of the latest commiters to RegisterCoalescer.cpp as reviewers. I hope someone is able to review this.

tpr added a comment.Aug 17 2018, 1:43 AM

Hi Bjorn. Looks ok to me, although I don't feel competent to approve as I am new to this area. Hopefully Krzysztof will be able to review it for you.

kparzysz accepted this revision.Aug 17 2018, 7:06 AM

We should convert the copy to an IMPLICIT_DEF, but this patch is good as is.

This revision is now accepted and ready to land.Aug 17 2018, 7:06 AM
This revision was automatically updated to reflect the committed changes.