[llvm] [LV] Consider whether vscale is a known power of two for iteration check (PR #144963)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 01:31:04 PDT 2025


================
@@ -2434,7 +2434,7 @@ Value *InnerLoopVectorizer::createIterationCountCheck(ElementCount VF,
       // check is known to be true, or known to be false.
       CheckMinIters = Builder.CreateICmp(P, Count, Step, "min.iters.check");
     } // else step known to be < trip count, use CheckMinIters preset to false.
-  } else if (VF.isScalable() &&
+  } else if (VF.isScalable() && !TTI->isVScaleKnownToBeAPowerOfTwo() &&
----------------
david-arm wrote:

Do you know if the code here is now exercised at all in any tests? I understand the rationale for adding the check, but I'm a bit worried that there is no longer anything to defend it.

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


More information about the llvm-commits mailing list