[PATCH] D89451: [SystemZ] Mark unsaved argument R6 as live throughout function

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 17 03:07:00 PDT 2020


jonpa added inline comments.


================
Comment at: llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp:369
+        MachineInstrBuilder(MF, MBB.back())
+          .addReg(SystemZ::R6D, RegState::Implicit);
+    }
----------------
uweigand wrote:
> Just one question here: do we need to explicitly add this use?  If I followed your description in the bugzilla correctly, all callee-saved register are implicitly considered used at the end of the return block?
Good question... It seems both LiveRegUnits and LivePhysRegs classes do special-treat the return blocks so it might be that this is implicitly modelled in the IR. RegScavenger uses LiveRegUnits (I don't know why there are two different classes for this) so in this particular case the use operands are not needed.

I now see a comment at LivePhysRegs::addLiveOutsNoPristines():

```
    // Return blocks are a special case because we currently don't mark up
    // return instructions completely: specifically, there is no explicit
    // use for callee-saved registers. So we add all callee saved registers
    // that are saved and restored (somewhere). This does not include
    // callee saved registers that are unused and hence not saved and
    // restored; they are called pristine.
    // FIXME: PEI should add explicit markings to return instructions
    // instead of implicitly handling them here.

``` 
It seems there is some intent on moving towards explicit use operands on return instructions instead?

The notion of a "pristine" register meaning an unused callee saved reg, makes me think we may want to be explicit about R6 since that seems to imply it is completely unused, which may not be true...?




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89451/new/

https://reviews.llvm.org/D89451



More information about the llvm-commits mailing list