[all-commits] [llvm/llvm-project] 3b8cd6: [mlir][affine] Fix crash in affine-super-vectorize...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Wed Mar 11 05:37:07 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b8cd6c5287ebf17397f25e0e5e8513ebdea7bd1
      https://github.com/llvm/llvm-project/commit/3b8cd6c5287ebf17397f25e0e5e8513ebdea7bd1
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2026-03-11 (Wed, 11 Mar 2026)

  Changed paths:
    M mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
    M mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir

  Log Message:
  -----------
  [mlir][affine] Fix crash in affine-super-vectorize for index constants inside loops (#184614)

When an arith.constant of index type is defined inside the loop body
being vectorized, vectorizeConstant creates a vector<Nxindex> constant
and registers it as the vector replacement. However,
getScalarValueReplacementsFor (used by vectorizeAffineStore to compute
indices for vector.transfer_write) looks only in the scalar replacement
map. With no scalar replacement registered for the index constant, it
falls back to the original scalar value, which is erased when the scalar
loop is cleaned up. This results in a "operation destroyed but still has
uses" crash.

Fix: when vectorizeConstant processes an index-typed constant, also
create a new scalar constant in the vector loop body and register it as
the scalar replacement. This ensures that memory operation index
computation can find a live value in the vectorized IR.

Fixes #122213

Assisted-by: Claude Code



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