[llvm] [LoopVectorize] Perform loop versioning for some early exit loops (PR #120603)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 08:36:13 PST 2025


================
@@ -2133,6 +2155,41 @@ class GeneratedRTChecks {
 };
 } // namespace
 
+std::optional<unsigned> getMaxVScale(const Function &F,
+                                     const TargetTransformInfo &TTI) {
+  if (std::optional<unsigned> MaxVScale = TTI.getMaxVScale())
+    return MaxVScale;
+
+  if (F.hasFnAttribute(Attribute::VScaleRange))
+    return F.getFnAttribute(Attribute::VScaleRange).getVScaleRangeMax();
+
+  return std::nullopt;
+}
----------------
david-arm wrote:

Yeah, I think in an early version of the patch I required getMaxVScale for something, but never moved it. Anyway, it's back in it's original place now!

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


More information about the llvm-commits mailing list