[all-commits] [llvm/llvm-project] 04d107: [VPlan] Model first memory runtime checks as VPlan...

Florian Hahn via All-commits all-commits at lists.llvm.org
Tue Sep 29 04:59:19 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04d107c5289d7f39d5eadbf559d330e7ac545bc7
      https://github.com/llvm/llvm-project/commit/04d107c5289d7f39d5eadbf559d330e7ac545bc7
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
    M llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
    M llvm/lib/Transforms/Vectorize/VPlanTransforms.h
    M llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/predicated-costs.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/reduction-cost.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/blocks-with-dead-instructions.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/dead-ops-cost.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/induction-costs.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/truncate-to-minimal-bitwidth-cost.ll
    M llvm/test/Transforms/LoopVectorize/RISCV/type-info-cache-evl-crash.ll
    M llvm/test/Transforms/LoopVectorize/VPlan/memory-checks.ll
    M llvm/test/Transforms/LoopVectorize/X86/cost-model.ll
    M llvm/test/Transforms/LoopVectorize/X86/interleave-cost.ll
    M llvm/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll
    M llvm/test/Transforms/LoopVectorize/if-conversion.ll
    M llvm/test/Transforms/LoopVectorize/induction.ll
    M llvm/test/Transforms/LoopVectorize/interleaved-accesses-metadata.ll
    M llvm/test/Transforms/LoopVectorize/invariant-store-vectorization-2.ll
    M llvm/test/Transforms/LoopVectorize/invariant-store-vectorization.ll
    M llvm/test/Transforms/LoopVectorize/metadata.ll
    M llvm/test/Transforms/LoopVectorize/opaque-ptr.ll
    M llvm/test/Transforms/LoopVectorize/pointer-select-runtime-checks.ll
    M llvm/test/Transforms/LoopVectorize/pr59319-loop-access-info-invalidation.ll
    M llvm/test/Transforms/LoopVectorize/predicated-inductions-vs-first-order-recurrences.ll
    M llvm/test/Transforms/LoopVectorize/runtime-check.ll

  Log Message:
  -----------
  [VPlan] Model first memory runtime checks as VPlan recipes. (#221483)

Add VPlanTransforms::addMemoryRuntimeChecks to generate memory runtime
checks directly as VPlan recipes, re-using VPSCEVExpander. This enables
more CSE/simplification opportunities in VPlan, and in the long term
allows us to remove the current slightly hacky runtime check generation
code, which builds checks up front in IR, and removes them again if we
do not vectorize. This whole dance requires quite a bit of code to make
the removal step transparent if the loop was not vectorized.

The initial patch excludes the following checks from VPlan expansion (to
be added in follow-ups), to keep the initial logic as simple as
possible:
* checks in nested loops (VPlan expansion cannot hoist out of the outer
loop)
 * diff checks
* bounds requiring expanding AddRecs (currently AddRecs must be expanded
in the Plan's entry)

The IR block built by GeneratedRTChecks::create() is still needed to
cost the checks and to detect that they folded to a constant. Once all
kinds of runtime checks can be created directly in VPlan, we can compute
their cost via the VPlan-based cost model, like other skeleton blocks.

PR: https://github.com/llvm/llvm-project/pull/221483



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list