[all-commits] [llvm/llvm-project] abce4e: [mlir][vector] Folder: shape_cast(extract) -> extr...

James Newling via All-commits all-commits at lists.llvm.org
Mon Jul 21 11:13:12 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: abce4e9ad0481ef33812e72a1bae53d77ddd9cce
      https://github.com/llvm/llvm-project/commit/abce4e9ad0481ef33812e72a1bae53d77ddd9cce
  Author: James Newling <james.newling at gmail.com>
  Date:   2025-07-21 (Mon, 21 Jul 2025)

  Changed paths:
    M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
    M mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir
    M mlir/test/Dialect/Vector/canonicalize.mlir

  Log Message:
  -----------
  [mlir][vector] Folder: shape_cast(extract) -> extract (#146368)

In a later PR more shape_cast ops will appear. Specifically, broadcasts that 
just prepend ones become shape_cast ops (i.e. volume preserving broadcasts 
are canonicalized to shape_casts). This PR ensures that broadcast-like 
shape_cast ops fold at least as well as broadcast ops.

This is done by modifying patterns that target broadcast ops, to target
'broadcast-like' ops. No new patterns are added, the patterns that exist
are just made to match on shape_casts where appropriate.

This PR also includes minor code simplifications: use
`isBroadcastableTo` to simplify `ExtractOpFromBroadcast` and simplify
how broadcast dims are detected in `foldExtractFromBroadcast`. These are
NFC.

---------

Co-authored-by: Andrzej WarzyƄski <andrzej.warzynski at gmail.com>



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