[llvm] [AArch64] Add MATCH loops to LoopIdiomVectorizePass (PR #101976)

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 08:26:41 PST 2024


================
@@ -939,3 +988,361 @@ void LoopIdiomVectorize::transformByteCompare(GetElementPtrInst *GEPA,
       report_fatal_error("Loops must remain in LCSSA form!");
   }
 }
+
+bool LoopIdiomVectorize::recognizeFindFirstByte() {
+  // Currently the transformation only works on scalable vector types, although
+  // there is no fundamental reason why it cannot be made to work for fixed
+  // vectors too.
+  if (!TTI->supportsScalableVectors() || DisableFindFirstByte)
+    return false;
+
+  // Define some constants we need throughout.
+  BasicBlock *Header = CurLoop->getHeader();
+  LLVMContext &Ctx = Header->getContext();
+
+  // We are expecting the blocks below. For now, we will bail out for almost
+  // anything other than this.
+  //
+  // Header:
----------------
sjoerdmeijer wrote:

Nit: it's easier to read if you move the basic block "definitions" to the code where the matching is happening. Here you can say something like "we are matching 4 blocks, Header, MatchBB, ... OuterBB, and bail out for almost anything else". 

https://github.com/llvm/llvm-project/pull/101976


More information about the llvm-commits mailing list