[Mlir-commits] [mlir] [MLIR] Added check for IsTerminator trait (PR #79317)

Mehdi Amini llvmlistbot at llvm.org
Wed Jan 24 13:00:12 PST 2024


================
@@ -598,6 +598,9 @@ void RemoveDeadValues::runOnOperation() {
       // Nothing to do because this terminator is associated with either a
       // function op or a region branch op and gets cleaned when these ops are
       // cleaned.
+    } else if (op->hasTrait<::mlir::OpTrait::IsTerminator>()) {
+      // Nothing to do here because this a terminator op and it should be
+      // honored with respect to its parent
----------------
joker-eph wrote:

Seems in line with the `cleanSimpleOp` comment that states:
```
/// It is assumed that `op` is simple. Here, a simple op is one which isn't a
/// symbol op, a symbol-user op, a region branch op, a branch op, a region
/// branch terminator op, or return-like.
```

Now isn't this check redundant with `ReturnLike` and `RegionBranchTerminatorOpInterface`? There two should also be Terminator.

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


More information about the Mlir-commits mailing list