[PATCH] D93292: [AArch64][SVE] Add optimization to remove redundant ptest instructions

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 04:02:53 PST 2020


paulwalker-arm added a comment.

Other than some missing tests this looks reasonable to me.



================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:1341-1365
+    switch (Pred->getOpcode()) {
+    case AArch64::BRKB_PPzP:
+    case AArch64::BRKPB_PPzPP: {
+      // Op 0 is chain, 1 is the mask, 2 the previous predicate to
+      // propagate, 3 the new predicate.
+
+      // Check to see if our mask is the same as the brkpb's. If
----------------
I cannot see any unit tests for this block of functionality.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:1394-1395
+
+  // If we've gotten past all the checks, it's safe to remove the ptest
+  // and use the flag-setting form of brkpb.
+  Pred->setDesc(get(NewOp));
----------------
What about:

If we pass all the checks, it's safe to remove the PTEST and either use the flags as they are prior to PTEST.  Sometimes this requires the tested PTEST operand to be replaced with an equivalent instruction that also sets the flags.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93292



More information about the llvm-commits mailing list