Extend the list of instructions that can be rematerialized in
SIInstrInfo::isReallyTriviallyReMaterializable() to support scalar loads.
Try shrinking instructions to remat only the part needed for current
context. Add SIInstrInfo::reMaterialize target hook, and handle shrinking
of S_LOAD_DWORDX16_IMM to S_LOAD_DWORDX8_IMM as a proof of concept.
This is a pre-existent issue, but I am not very comfortable with the fact that we override isReallyTriviallyReMaterializable the way we do.
It works because we rely on extra checks being present before the method is invoked (for example on calling LiveRangeEdit::allUsesAvailableAt()). However, the comment in the base class says isReallyTriviallyReMaterializable "must return false if (..) or if it requres any address registers that are not always available."
Having said that, I am not sure if there is a practical solution for that (apart from softening the comment in the base class).