[Mlir-commits] [mlir] [MLIR] Fix -remove-dead-values with external function & deleted arguments (PR #99671)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Jul 20 19:34:51 PDT 2024


================
@@ -1124,15 +1124,15 @@ static void getGenericEffectsImpl(
         &effects,
     LinalgOp linalgOp) {
   for (auto [index, operand] : llvm::enumerate(linalgOp.getDpsInputs())) {
-    if (!llvm::isa<MemRefType>(operand.getType()))
+    if (!operand || !llvm::isa<MemRefType>(operand.getType()))
----------------
huang-me wrote:

Since we remove dead values in chronological order, we may have removed `inputOperand` or `outputOperand` when checking the memory effect of `linalgOp`s.
We should have done liveness analysis before removing those operands, so the removed operands are indeed dead values.
Does this sound reasonable?

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


More information about the Mlir-commits mailing list