[PATCH] D14719: Track pristine registers in terms of register units.

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 17:06:56 PST 2015


MatzeB added a comment.

- Next time, please upload the patch with full context (see http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface)
- It is technically possible to track pristine registers as register units, if you track things at the regunit level you are more conservative with respect to the XMM0/YMM0 problem but that shouldn't be a problem in this case. But:

I doesn't look like this change actually simplifies the code: While RegisterScavenger.cpp gets simpler with this patch, AggressiveAntiDepBreaker.cpp, CriticalAntiDepBreaker.cpp, LivePhysRegs.cpp and MachineVerifier.cpp get more complicated.

I'd rather change getPristineRegs() to something like this to fix the bug:

  BitVector MachineFrameInfo::getPristineRegs(const MachineFunction &MF) const {
    const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
    BitVector BV(TRI->getNumRegs());
  
    // Before CSI is calculated, no registers are considered pristine. They can be
    // freely used and PEI will make sure they are saved.
    if (!isCalleeSavedInfoValid())
      return BV;
  
    for (const MCPhysReg *CSR = TRI->getCalleeSavedRegs(&MF); CSR && *CSR; ++CSR)
      BV.set(*CSR);
  
    // Saved registers and their subregisters are not pristine.
    const std::vector<CalleeSavedInfo> &CSI = getCalleeSavedInfo();
    for (const CalleeSavedInfo &Info : CSI) {
      for (MCSubRegIterator R(Info.getReg(), TRI, true); R.isValid(); ++R)
        BV.reset(*R);
    }
  
    return BV;
  }

would that work for you?


Repository:
  rL LLVM

http://reviews.llvm.org/D14719





More information about the llvm-commits mailing list