[Mlir-commits] [mlir] [MLIR] Prevent invalid IR from being passed outside of RemoveDeadValues (PR #121079)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Jan 2 08:02:26 PST 2025


================
@@ -165,52 +214,59 @@ static SmallVector<OpOperand *> operandsToOpOperands(OperandRange operands) {
   return opOperands;
 }
 
-/// Clean a simple op `op`, given the liveness analysis information in `la`.
-/// Here, cleaning means:
-///   (1) Dropping all its uses, AND
-///   (2) Erasing it
-/// iff it has no memory effects and none of its results are live.
+/// Process a simple operation `op` using the liveness analysis `la`.
+/// If the operation has no memory effects and none of its results are live:
+///   1. Adding the operation to a list for future removal, and
+///   2. Marking all its results as non-live values
 ///
-/// It is assumed that `op` is simple. Here, a simple op is one which isn't a
-/// function-like op, a call-like op, a region branch op, a branch op, a region
-/// branch terminator op, or return-like.
-static void cleanSimpleOp(Operation *op, RunLivenessAnalysis &la) {
-  if (!isMemoryEffectFree(op) || hasLive(op->getResults(), la))
+/// The operation `op` is assumed to be simple.
+/// A simple operation is one that is NOT:
----------------
banach-space wrote:

```suggestion
/// The operation `op` is assumed to be simple. A simple operation is one that is NOT:
```

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


More information about the Mlir-commits mailing list