[llvm] [LV] Vectorize early exit loops with stores using masking (PR #178454)
Graham Hunter via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 8 08:20:21 PDT 2026
================
@@ -1911,7 +1911,11 @@ bool LoopVectorizationLegality::canUncountableExitConditionLoadBeMoved(
if (&I == Load)
continue;
- if (I.mayWriteToMemory()) {
+ if (I.mayReadOrWriteMemory()) {
+ // We need to mask all other memory ops.
----------------
huntergr-arm wrote:
Currently we block vectorization for such instructions in `LoopVectorizationLegality::isVectorizableEarlyExitLoop` (right below the declaration of HasSideEffects), where we check that anything writing to memory is a simple store instruction, but also check everything else for being safe to speculatively execute.
This will need to change later as we want to support more loops, along with moving the checks into vplan. But I think for now we're safe?
https://github.com/llvm/llvm-project/pull/178454
More information about the llvm-commits
mailing list