[PATCH] D70699: [CriticalAntiDepBreaker] Teach the regmask clobber check to check if any subregister is preserved before considering the super register clobbered

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 07:57:59 PST 2019


spatel added a comment.

I think AggressiveAntiDepBreaker::HandleLastUse() is doing a similar check already, but it would be good if someone can confirm that.



================
Comment at: llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp:266
+        for (unsigned i = 0, e = TRI->getNumRegs(); i != e; ++i) {
           if (MO.clobbersPhysReg(i)) {
+            // Make sure all subregisters are also clobbered.
----------------
Is it useful to make this logic available to everyone? If so, this becomes a 1-line patch that would call something like:


```
bool
MachineOperand::clobbersPhysRegAndSubRegs(unsigned PhysReg,
                                          const TargetRegisterInfo &TRI) const {
  for (MCSubRegIterator SRI(PhysReg, &TRI, true); SRI.isValid(); ++SRI)
    if (!clobbersPhysReg(*SRI))
      return false;

  return true;
}

```

Even if that's not worth adding, it would be easier reading if we had something like that as a static or lambda in this pass.


================
Comment at: llvm/test/CodeGen/X86/pr44140.ll:13
 ; We shouldn't clobber ymm6 inside the loop.
 ; FIXME: We currently clobber ymm6
 define i32 @main() {
----------------
Remove FIXME note.


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

https://reviews.llvm.org/D70699





More information about the llvm-commits mailing list