Instruction ldi.fmt can be considered cheap enough to avoid spill and restore
of value that it produces since it's loaded from immediate.
Details
Diff Detail
Event Timeline
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. |
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.
These lines can be removed from the test.