[all-commits] [llvm/llvm-project] 5ce177: Fix llvm-mlir-use-after-erase findings (#210733)

Harald-R via All-commits all-commits at lists.llvm.org
Mon Aug 3 04:17:14 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ce177f6cd3672aae1791ba155b5438c9198a8ce
      https://github.com/llvm/llvm-project/commit/5ce177f6cd3672aae1791ba155b5438c9198a8ce
  Author: Harald-R <rotuna.razvan at gmail.com>
  Date:   2026-08-03 (Mon, 03 Aug 2026)

  Changed paths:
    M mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
    M mlir/lib/Transforms/Utils/DialectConversion.cpp
    M mlir/test/Dialect/MemRef/normalize-memrefs-ops.mlir

  Log Message:
  -----------
  Fix llvm-mlir-use-after-erase findings (#210733)

Fix the following warnings identified by the `llvm-mlir-use-after-erase`
check from https://github.com/llvm/llvm-project/pull/210727:

```cpp
mlir/lib/Transforms/Utils/DialectConversion.cpp:2700:33: warning: operation 'op' is used after it was erased [llvm-mlir-use-after-erase]
 2700 |           curState, std::string(op->getName().getStringRef()) + " folder");
      |                                 ^
mlir/lib/Transforms/Utils/DialectConversion.cpp:2685:12: note: operation erased here
 2685 |   rewriter.replaceOp(op, replacementValues);
      |            ^
mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp:440:29: warning: operation 'newOp' is used after it was erased [llvm-mlir-use-after-erase]
  440 |           Value newMemRef = newOp->getResult(resIndex);
      |                             ^
mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp:459:20: note: operation erased here 
  459 |             newOp->erase();
      |                    ^
mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp:440:29: note: the use happens in a later loop iteration than the erase
  440 |           Value newMemRef = newOp->getResult(resIndex);
      |                             ^
```

The warning at `NormalizeMemRefs.cpp:440` is resolved by breaking the
loop iteration after erasing the operation, similar to what is done at
line 306.



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