[llvm-branch-commits] [llvm] [LV][REVEC][AArch64] Proof of concept for re-vectorisation (PR #208213)

Gaƫtan Bossu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jul 30 07:09:02 PDT 2026


================
@@ -953,8 +960,20 @@ bool LoopVectorizationLegality::canVectorizeInstr(Instruction &I) {
   if (CI && !VFDatabase::getMappings(*CI).empty())
     VecCallVariantsFound = true;
 
-  auto CanWidenInstructionTy = [](Instruction const &Inst) {
+  // REVEC: Remember that a vector instruction was found for later checks.
+  if (I.getType()->isVectorTy() ||
+      any_of(I.operand_values(),
+             [](const Value *V) { return V->getType()->isVectorTy(); }))
+    LoopContainsVectors = true;
+
+  auto CanWidenInstructionTy = [TTI = TTI](Instruction const &Inst) {
     Type *InstTy = Inst.getType();
+
+    // TODO-REVEC: To support fixed VFs, we'll need to query a diffent TTI hook.
+    if (isa<FixedVectorType>(InstTy))
+      return VectorizeVectorLoops &&
+             TTI->isElementTypeLegalForScalableVector(InstTy->getScalarType());
----------------
gbossu wrote:

I use this to query the target whether it allows re-vectorising vector types. I think this should instead rely on a new hook, e.g. `TTI->isTypeLegalForReVectorization(InstTy);`, but I've been wary of adding new hooks at this point.

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


More information about the llvm-branch-commits mailing list