[Mlir-commits] [mlir] [mlir] Optimize `isOpTriviallyDead` greedy rewriter checks for deeply nested IR (PR #231423)

Ivan Butygin llvmlistbot at llvm.org
Mon Oct 26 05:59:46 PDT 2026


================
@@ -36,6 +36,39 @@ bool mlir::isOpTriviallyDead(Operation *op) {
   return op->use_empty() && wouldOpBeTriviallyDead(op);
 }
 
+/// Return true if the op's own memory effects do not prevent erasure. Allowed
+/// effects are reads and effects on results allocated by the op itself.
+///
+/// If the op only has recursive effects, treat the op itself as having no
+/// effects. Without a memory effect interface or recursive effects, return
+/// false to conservatively assume live effects.
+///
+/// The caller must also check nested effects when `hasRecursiveEffects` is
+/// true. This function does not check uses or restrictions on erasing
+/// terminators and symbols.
+static bool hasOnlyDeadEffects(Operation *op, bool hasRecursiveEffects) {
----------------
Hardcode84 wrote:

Renamed to `hasOnlyRemovableEffects`

https://github.com/llvm/llvm-project/pull/231423


More information about the Mlir-commits mailing list