[llvm] [LV][NFC] Emit remarks when failing to vectorise early exit loops (PR #225078)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 07:46:36 PDT 2026


================
@@ -3227,20 +3251,39 @@ static bool handleUncountableExitsWithSideEffects(
     if (!isDereferenceableAndAlignedInLoop(
             PtrSCEV, cast<LoadInst>(Load->getUnderlyingInstr())->getAlign(),
             PSE.getSE()->getConstant(EltSize), TheLoop, *PSE.getSE(), DT, AC,
-            &Predicates))
+            &Predicates)) {
+      reportVectorizationFailure("Early exit loop with side effects contains "
+                                 "load used by the exit condition that may "
+                                 "fault.\n",
+                                 "EarlyExitSideEffectsFaultingLoad", ORE,
+                                 TheLoop);
       return false;
+    }
   }
 
   // Check for a single GEP for the condition load to see if we can link it to
   // a widen IV recipe with a step of 1; we're only interested in contiguous
   // accesses for the condition load right now.
   auto *IV = cast<VPWidenInductionRecipe>(&HeaderVPBB->front());
   if (!match(IV->getStartValue(), m_SpecificInt(0)) ||
-      !match(IV->getStepValue(), m_SpecificInt(1)))
+      !match(IV->getStepValue(), m_SpecificInt(1))) {
+    reportVectorizationFailure("Early exit loop with side effects contains "
+                               "non-contiguous load used by the exit "
+                               "condition.\n",
+                               "EarlyExitSideEffectsBadCriticalLoad", ORE,
+                               TheLoop);
----------------
david-arm wrote:

OK, I think I found a sufficiently vague error message that can cover the GEP and IV errors. See what you think!

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


More information about the llvm-commits mailing list