This is an archive of the discontinued LLVM Phabricator instance.

Do not attempt rematerialization with a killed register use
AbandonedPublic

Authored by rampitec on Sep 1 2021, 11:01 AM.

Details

Summary

This change shall be NFC since the value of the used register
will not be available anyway if it is killed, but there is no
point to even attempt rematerialization. We could skip a lot
of logic in the RA by bailing out early.

Diff Detail

Event Timeline

rampitec created this revision.Sep 1 2021, 11:01 AM
rampitec requested review of this revision.Sep 1 2021, 11:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 11:01 AM
rampitec edited reviewers, added: arsenm; removed: arsen.

I.e. rationale: when we do remat original instruction is still in place and one of its operands is killed. It is certainly either dead or VNI is different at the point of rematerialization, so it will not pass a check for "all uses are available". There is no even a point to report it can be rematerialized when an extensive check will say it is not. For the very same reason I was unable to create a test for it, it never happens.

@arsenm We may want to add this check for VOP, just to speedup RA a bit. This will be an extra work, however. Generic implementation scans operands anyway, so it is cheap, but we don't.

arsenm added inline comments.Sep 20 2021, 2:17 PM
llvm/lib/CodeGen/TargetInstrInfo.cpp
988–990

Can't the caller base this check on the live segment?

rampitec added inline comments.Sep 20 2021, 2:32 PM
llvm/lib/CodeGen/TargetInstrInfo.cpp
988–990

TII does not have LIS and multiple callers which do have it would need to scan operands again, which defeats the purpose of the patch to quickly bail if we cannot process it anyway. Here we already have MO available and the check is very cheap.

rampitec abandoned this revision.Sep 24 2021, 10:29 AM

Abandon since D106408 itself was reverted.