[all-commits] [llvm/llvm-project] 8da9d9: [mlir][mem2reg] fix 197158 by moving visitReplaced...

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Jun 10 01:10:55 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8da9d925ac73becc1733c6733ffabc2020131912
      https://github.com/llvm/llvm-project/commit/8da9d925ac73becc1733c6733ffabc2020131912
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M mlir/include/mlir/Interfaces/MemorySlotInterfaces.td
    M mlir/lib/Transforms/Mem2Reg.cpp
    M mlir/test/Dialect/LLVMIR/mem2reg-dbginfo.mlir
    M mlir/test/Transforms/mem2reg.mlir
    M mlir/test/lib/Dialect/Test/TestOpDefs.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td

  Log Message:
  -----------
  [mlir][mem2reg] fix 197158 by moving visitReplacedValues call (#198552)

Fix #197158 and #200844 by moving the `visitReplacedValues` calls
between `promoteInRegion` and `removeBlockingUses` , as well as setting
the insertion point before the replaced store operation before calling
the `PromotableMemOpInterface::getStored` API (instead of setting the
insertion point after).

The action order change is done at the top level. The `promoteInRegion`
are done for all regions in post order, then the `visitReplacedValues`
are done for all regions, and then only the `removeBlockingUses` are
done for all regions in post order. This ensures that any load results
that would happen to be used in a later stored is not deleted by
`removeBlockingUses` before it is used by `visitReplacedValues`.

The insertion point change ensures that the stored values passed to
`visitReplacedValues` dominate the related store operations. Otherwise,
typical `visitReplacedValues` that set insertion points at the store
operation and use the stored values generated invalid IR when
`getStored` generates new IR (like bitcasts for the LLVM dialect
implementation).



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