Details
- Reviewers
MatzeB
Diff Detail
Event Timeline
Is this different from MachineBasicBlock::computeRegisterLiveness(TRI, Reg, I, 4) == LQR_Dead?
The implementations looks the same to me except that this one here has one more case where it checks the successor blocks live in lists...
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...
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.