[all-commits] [llvm/llvm-project] f7464c: [MLIR][Bufferization] Fix foldMemRefCasts dropping...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Wed Apr 15 06:10:23 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f7464cbdea73a337ee285e119023673249d5600e
      https://github.com/llvm/llvm-project/commit/f7464cbdea73a337ee285e119023673249d5600e
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2026-04-15 (Wed, 15 Apr 2026)

  Changed paths:
    M mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
    M mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir

  Log Message:
  -----------
  [MLIR][Bufferization] Fix foldMemRefCasts dropping ranked return type for unranked->ranked cast (#189249)

When one-shot-bufferize with bufferize-function-boundaries is used and a
function returns a ranked tensor that is produced by casting from an
unranked intermediate (e.g. a call to a function returning
tensor<*xf32>), the foldMemRefCasts post-processing step incorrectly
unpacked the memref.cast from unranked to ranked memref, downgrading the
function return type to the unranked memref type and using the unranked
value as the return operand.

The fix is in unpackCast(): do not unpack a cast whose source is an
unranked memref and whose result is a ranked memref, since doing so
would lose type specificity.

Fixes https://github.com/llvm/llvm-project/issues/176739

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