[PATCH] D66580: [ARM] Fold VPNOT into vpt blocks

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 09:00:41 PDT 2019


dmgreen added inline comments.


================
Comment at: llvm/lib/Target/ARM/MVEVPTBlockPass.cpp:158
+
+    // Now that we have a list of instructions between MI and MBIter, adjust it
+    // to make sure that it is a valid block. Including making sure that any the
----------------
samparker wrote:
> I'm struggling to understand the looping and the logic here. Why is a simple walk forward over the instructions not enough? I'd expect to see some conditions being checked and then just break when an instruction no longer meets the criteria. For instance, why can't the checks for kills and defs be performed in the do-loop above?
I was originally attempting to make it work something like that, but there was too much backtracking to make it work nicely. For example we were storing the LastMI and going back if an VPNOT was at the end of the block. Or if a VPNOT is found, we want to add it to the list of dead instructions, flip the CurrentModeT bit and inverse the "Then" to "Else" condition on all following instructions. Except if the value of VPR.P0 that the VPNOT produced is needed after the VPT block. Then we have to go back to before the last VPNOT, reversing all that we just did.

So instead, this is trying to keep it simpler. Checking what we want to change and then making the change.

The alternative, I think, would be replicating a lot of the code in the VPNOT forward scan, otherwise we would not know how far we had to look for dead vprs.


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

https://reviews.llvm.org/D66580





More information about the llvm-commits mailing list