[PATCH] D107638: [ARM] Add a tail-predication loop predicate register

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 9 09:15:43 PDT 2021


dmgreen added a comment.

> From looking at the changes to some of the tests that should produce tail-predicated loops, none of them get the $noreg replaced with $lr. Isn't that supposed to happen in the VPT optimisation pass, or am I looking in the wrong place?

There are a couple of mir tests that I updated to use $lr (like dont-ignore-vctp.mir and subreg-liveness.mir), but most I just used $noreg for to simplify things, in the same way that we still use t2DoLoopStart where most tailpredicated loops would usually use t2DoLoopStartTP. It is the register allocator that this is targetting, so the tests checking the ARMLowOverheadLoops pass needn't change.

The only reproducer I have of the original problem requires a very large test file and downstream scheduling to trigger the same issue.



================
Comment at: llvm/lib/CodeGen/MachineVerifier.cpp:1635-1636
     if (Def.isVirtual() &&
+        !MF->getProperties().hasProperty(
+            MachineFunctionProperties::Property::NoPHIs) &&
         std::distance(MRI->use_nodbg_begin(Def), MRI->use_nodbg_end()) > 1)
----------------
samtebbs wrote:
> What's the purpose of this change?
The "UnspillableTerminator" we use for t2LoopEndDec and t2DoLoopEndTP need only a single use up to phi elimination in order to be lowered correctly. That is already tested in phi elimination, with this verifier check making sure that the unspillable terminators always have a single use. This is only for virtual regs, not physical regs.

But there is a point, in between phi elimination and when the reg allocator assigns registers (which is only a very short period of time) that we can have multiple uses for a def that is still not (quite yet) a physical reg.  So this check makes it slightly more precise, not running into verifier problems where they are not an issue.


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

https://reviews.llvm.org/D107638



More information about the llvm-commits mailing list