[llvm-dev] How to get Greedy RA to not spill results of trivially rematerializable instructions

Quentin Colombet via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 20 16:16:49 PST 2019


Do you have a reproducer?

That shouldn’t happen.

> On Feb 20, 2019, at 4:12 PM, Nemanja Ivanovic via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I have encountered a rather odd situation with Greedy where it will end up spilling a register that was populated with a zero (with a trivially rematerializable load-immediate instruction).
> In fact, it spills 3 such values (LICM moves stuff out of a loop, register coalescer replaces copies with load-immediates and then Greedy spills them).
> 
> I personally can't think of a situation where a spill (with a reload later presumably) is better than simply rematerializing the value where it would have otherwise been reloaded. To that end, would it be possible for Greedy to simply duplicate the trivially rematerializable instruction at every reload site? Perhaps this is something it would need to query the target for? Perhaps Greedy would be able to call something like TargetInstrInfo::rematerializeValue(MachineInstr &RematMI, MachineBasicBlock::iterator InsertAt) or something along those lines?
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list