<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114767>114767</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MLIR] -test-func-erase-arg triggers Assertion Failure `!NodePtr->isKnownSentinel()'
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xisang0
</td>
</tr>
</table>
<pre>
Test on commit: [c3edeaa61bf0e7faed6c26f693b4fcd9102ba1ec](url)
steps to reproduce:
```
mlir-opt test.mlir --test-func-erase-arg
```
test case:
```
module {
llvm.func @malloc(i64) -> !llvm.ptr
}
```
crash trace:
```
mlir-opt: /home/workdir/llvm-project-19/llvm/include/llvm/ADT/ilist_iterator.h:168: reference llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, true, false, void, false, void>, false, false>::operator*() const [OptionsT = llvm::ilist_detail::node_options<mlir::Block, true, false, void, false, void>, IsReverse = false, IsConst = false]: Assertion `!NodePtr->isKnownSentinel()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./mlir-opt /home/workdir/test8.mlir --test-func-erase-arg
#0 0x000063b409e46228 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x1062228)
#1 0x000063b409e43d4e llvm::sys::RunSignalHandlers() (./mlir-opt+0x105fd4e)
#2 0x000063b409e46c38 SignalHandler(int) Signals.cpp:0:0
#3 0x00007ab106485520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007ab1064d99fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007ab106485476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007ab10646b7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007ab10646b71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007ab10647ce96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000063b40f1c5bd4 (./mlir-opt+0x63e1bd4)
#10 0x000063b40cf4b114 (anonymous namespace)::TestFuncEraseArg::runOnOperation() TestFunc.cpp:0:0
#11 0x000063b40d06ee9f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x428ae9f)
#12 0x000063b40d06f682 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x428b682)
#13 0x000063b40d071e2e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x428de2e)
#14 0x000063b40d06a952 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#15 0x000063b40d06a5bb llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#16 0x000063b40d1142a5 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x43302a5)
#17 0x000063b40d0657b2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x42817b2)
#18 0x000063b40d065a63 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4281a63)
#19 0x000063b40d065c72 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4281c72)
#20 0x000063b409e25477 main (./mlir-opt+0x1041477)
#21 0x00007ab10646cd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#22 0x00007ab10646ce40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#23 0x000063b409e24fe5 _start (./mlir-opt+0x1040fe5)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWN1u47wRfRr6hrAhUdTfhS-cOEaDbpogyb1BkSOZDU2qJLWbvH1BybEtx87WH_q1aBcbWOLPmTPDM-SIzDnZaIA5Sm9Qupywzm-Mnb9Lx3QTTSojPuav4Dw2GnOz3UqPkgVG6Q1PQABjWVzVEeQ1A5FxktVZmVS05qKMI1KxGDhKl4gUnVWIlChaomjhPLQOe4MttNaIjgNKFkMXyqLd__51q6SdmtZjD87PwhueTsPztO40n4JlDqbMNmcnh3GYM3cZ3YhOAUb5zfCOsVI_t7MAjRGNtkwpwxEpZEYRKfEUJXcYkbgf1Hq7w8yXZ8G5ZW6DvWW_964PKFltzBYQWf0y9k1Ii8gqGJq21vwduJ_G5a4FkZXUXHUCDg2L5WtoVtL5tfRgmTd2tkHJIs6KgG6hBguaQ-9h4JMsxqNRcnvaJcAzqYYWbQSsTeul0Q4lt4H50HGjDH9D5BZ720H4rZly_cNPI8XXhuRu1DY8JHcDmGl3ZMgCkSLEnBvtfFDb42D7FaNk-cWJP5HpvXuGn2Ad9Ib3I-7d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