[llvm] 065a39b - [VPlan] Tighten SafeAVL matching in convertEVLExitCond. NFC (#179164)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 03:11:57 PDT 2026


Author: Luke Lau
Date: 2026-03-25T18:11:51+08:00
New Revision: 065a39b9f7f06fca0926394096ee1c1fac41d446

URL: https://github.com/llvm/llvm-project/commit/065a39b9f7f06fca0926394096ee1c1fac41d446
DIFF: https://github.com/llvm/llvm-project/commit/065a39b9f7f06fca0926394096ee1c1fac41d446.diff

LOG: [VPlan] Tighten SafeAVL matching in convertEVLExitCond. NFC (#179164)

Follow-up from
https://github.com/llvm/llvm-project/pull/178181#discussion_r2743630145

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index e709cce1bae44..cfc973afc7fd4 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -3498,9 +3498,12 @@ void VPlanTransforms::convertEVLExitCond(VPlan &Plan) {
     return;
 
   // The AVL may be capped to a safe distance.
-  VPValue *SafeAVL;
-  if (match(AVL, m_Select(m_VPValue(), m_VPValue(SafeAVL), m_VPValue())))
-    AVL = SafeAVL;
+  VPValue *SafeAVL, *UnsafeAVL;
+  if (match(AVL,
+            m_Select(m_SpecificICmp(CmpInst::ICMP_ULT, m_VPValue(UnsafeAVL),
+                                    m_VPValue(SafeAVL)),
+                     m_Deferred(UnsafeAVL), m_Deferred(SafeAVL))))
+    AVL = UnsafeAVL;
 
   VPValue *AVLNext;
   [[maybe_unused]] bool FoundAVLNext =


        


More information about the llvm-commits mailing list