[Mlir-commits] [mlir] [mlir][CSE] Pre-process trivially dead ops (NFC) (PR #191135)
Mehdi Amini
llvmlistbot at llvm.org
Fri Apr 17 06:33:51 PDT 2026
================
@@ -308,7 +301,16 @@ LogicalResult CSEDriver::simplifyOperation(ScopedMapTy &knownValues,
void CSEDriver::simplifyBlock(ScopedMapTy &knownValues, Block *bb,
bool hasSSADominance) {
- for (auto &op : *bb) {
+ for (auto &op : llvm::make_early_inc_range(*bb)) {
+ // If the operation is already trivially dead just add it to the erase list.
+ // This also avoids calling `simplifyRegion` on dead region ops
+ // unnecessarily.
+ if (isOpTriviallyDead(&op)) {
----------------
joker-eph wrote:
I'm not always clear on how not eagerly deleting operation isn't just making CSE miss on simplification opportunities, but this patch looks good within the current flow.
https://github.com/llvm/llvm-project/pull/191135
More information about the Mlir-commits
mailing list