[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:08:21 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:
Hmm, in this case we need two different error message then. The step relates to whether the load is contiguous, and the start relates to whether the load starts from the beginning of the object. I'll split these into two and add a new test.
https://github.com/llvm/llvm-project/pull/225078
More information about the llvm-commits
mailing list