[Mlir-commits] [mlir] [mlir] Make eraseFunctionArguments fail instead of crash on used args (PR #203367)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Jun 12 03:45:02 PDT 2026


================
@@ -68,8 +68,10 @@ void insertFunctionResults(FunctionOpInterface op,
                            unsigned originalNumResults, Type newType);
 
 /// Erase the specified arguments and update the function type attribute.
-void eraseFunctionArguments(FunctionOpInterface op, const BitVector &argIndices,
-                            Type newType);
+/// Returns failure if the function cannot be updated to have the new signature,
+/// e.g. because one of the erased arguments still has uses.
----------------
lijinpei-amd wrote:

I agree that user should ensure argIndices is  meaningful, for
1. it's not useful. I don't think users want to blindly erase arguments and recover from failure.
2. the check is not not exhausive, for example, `argIndices` index  out of bound is not diagnosed.
3. in line with block argument erasure. https://github.com/llvm/llvm-project/blob/4a3946fc690c461417d38b6264a1f7a70f5dd364/mlir/include/mlir/IR/Block.h#L128

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


More information about the Mlir-commits mailing list