[PATCH] D49401: TII: Generalize X86's isSafeToClobberEFLAGs

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 27 04:51:52 PDT 2018


arsenm added a comment.

In https://reviews.llvm.org/D49401#1206110, @MatzeB wrote:

> In https://reviews.llvm.org/D49401#1177039, @arsenm wrote:
>
> > In https://reviews.llvm.org/D49401#1177010, @MatzeB wrote:
> >
> > > Also I'd generally recommend to rather look at LivePhysReg/LiveRegUnits for doing liveness queries post-ra. They can be more expensive but give more consistent results...
> >
> >
> > I want to use this in an SSA pass, not post-RA
>
>
> Fair enough. But `MachineBasicBlock::computeRegisterLiveness(TRI, Reg, I, 4) == LQR_Dead?` should work in machine SSA, shouldn't it?


I tried swapping these and found a few bugs in each.

isSafeToClobber doesn't count debug instruction towards the search count, while computeRegisterLiveness does which is just a bug. I also found another subregister bug in isSafeToClobber. computeRegisterLiveness seems overall nicer, but might need some changes.

The most important difference seems to be the handling of unused defs that might be live out. If a physical register is defined and not used, computeRegisterLiveness says it's alive and doesn't consider that it's not live in to any successors. I suppose this could be solved by searching uses before defs, and adding another liveness type LQR_LiveUnused or something? I suppose other users might care that the register has any value.


https://reviews.llvm.org/D49401





More information about the llvm-commits mailing list