[Mlir-commits] [mlir] [mlir] Fix `remove-dead-values` pass throws error when module has a name (PR #109990)
Perry Gibson
llvmlistbot at llvm.org
Thu Sep 26 01:52:48 PDT 2024
================
@@ -1,13 +1,14 @@
// RUN: mlir-opt %s -remove-dead-values -split-input-file -verify-diagnostics | FileCheck %s
-// The IR remains untouched because of the presence of a non-function-like
-// symbol op (module @dont_touch_unacceptable_ir).
----------------
Wheest wrote:
The [2nd test](https://github.com/llvm/llvm-project/blob/eeba53c4d7b815268882ce8d1ed65e9736ef10b9/mlir/test/Transforms/remove-dead-values.mlir#L17-L22) checks for `isa<BranchOpInterface>(op)` and raises the error, but no we don't have a test for the "non-function symbol op inside the module" condition (I don't think we had one for this case before).
In terms of non-function symbol ops, would a global constant make sense? I've added this test which meets the requirements:
```mlir
module {
// expected-error @+1 {{cannot optimize an IR with non-function symbol ops, non-call symbol user ops or branch ops}}
memref.global "private" constant @__dont_touch_unacceptable_ir : memref<i32> = dense<0>
func.func @main(%arg0: i32) -> i32 {
return %arg0 : i32
}
}
```
https://github.com/llvm/llvm-project/pull/109990
More information about the Mlir-commits
mailing list