This is an archive of the discontinued LLVM Phabricator instance.

[Mips] Add rematerialization support for ldi.fmt
ClosedPublic

Authored by mbrkusanin on Nov 6 2019, 8:33 AM.

Details

Summary

Instruction ldi.fmt can be considered cheap enough to avoid spill and restore
of value that it produces since it's loaded from immediate.

Diff Detail

Event Timeline

mbrkusanin created this revision.Nov 6 2019, 8:33 AM

As far as I understand the code, overriding isReallyTriviallyReMaterializable and reMaterialize is not mandatory to avoid spill for ldi.fmt. Let's split the patch. The first patch could adds isReMaterializable flag to the MSA_I10_LDI_DESC_BASE and test the change. The second one - overrides isReallyTriviallyReMaterializable and reMaterialize. By the way, what is a goal of overriding reMaterialize? Does it give any benefit?

llvm/test/CodeGen/Mips/msa/remat-ldi.ll
109

These lines can be removed from the test.

mbrkusanin marked an inline comment as done.
mbrkusanin edited the summary of this revision. (Show Details)
  • Rebase
  • Removed isReallyTriviallyReMaterializable and reMaterialize

As far as I understand the code, overriding isReallyTriviallyReMaterializable and reMaterialize is not mandatory to avoid spill for ldi.fmt. Let's split the patch. The first patch could adds isReMaterializable flag to the MSA_I10_LDI_DESC_BASE and test the change. The second one - overrides isReallyTriviallyReMaterializable and reMaterialize. By the way, what is a goal of overriding reMaterialize? Does it give any benefit?

I removed everything expect adding the isReMaterializable flag. You're right, no additional code is necessary. In my earlier version of the patch there was a part of the checking and rematerializing that was done manually so I needed the checks for other instructions. But now I see that all of that was unnecessary. I went in a roundabout way and arrived at the same thing that isReallyTriviallyReMaterializableGeneric was already doing. The only benefit of overriding isReallyTriviallyReMaterializable at this point would be in slightly less checks for some instructions (but not in case they can't be rematerialized). Sorry for wasting your time on redundant code.

This revision is now accepted and ready to land.Nov 12 2019, 12:04 PM
This revision was automatically updated to reflect the committed changes.