[llvm] [LV] Pure runtime check for minimum profitable trip count. (PR #115833)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 05:36:01 PST 2024


================
@@ -2502,6 +2502,12 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
 #endif
     // Don't execute the vector loop if (UMax - n) < (VF * UF).
     CheckMinIters = Builder.CreateICmp(ICmpInst::ICMP_ULT, LHS, Step);
+  } else if (MinProfitableTripCount.isNonZero()) {
----------------
Mel-Chen wrote:

> Another problem here is inconsistency - it looks like you're only adding the check here, but what about the above tail-folding case:
> 
> ```
>   } else if (VF.isScalable() &&
>              !isIndvarOverflowCheckKnownFalse(Cost, VF, UF) &&
>              Style != TailFoldingStyle::DataAndControlFlowWithoutRuntimeCheck) {
> ```
> 
> It's not obvious to me why we don't need the same check there?

We have same checks, it just hidden in the `CreateStep()`.

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


More information about the llvm-commits mailing list