[PATCH] D33562: MachineLICM: Add new condition for hoisting of caller preserved registers

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 28 22:25:51 PDT 2017


nemanjai added a comment.

In https://reviews.llvm.org/D33562#766121, @MatzeB wrote:

> Instead of introducing yet another target callback, how about some simple heuristic like `MRI.hasOneDef(Reg) && !MRI.getUsedPhysRegsMask().test(Reg)`[1] allowing hoisting up to the point of that definition (which you can find out with `MRI.def_instr_begin(Reg)` or similar).
>
> [1] We really oughta rename UsedPhysRegMask to something that makes sense (it's simply the union of call regmask operands in the function).


If that does the job, I think it would be great to not have to add another target hook. But to be honest, it doesn't really sound like it will solve this problem. Namely, the call through a function pointer **does** clobber X2 (but restores it on return). So a call of that sort being in the loop will presumably still prevent the global address calculation (which uses X2) from being hoisted out of the loop.


https://reviews.llvm.org/D33562





More information about the llvm-commits mailing list