Skip to content

Assertion failure in Arc function splitting #9373

@sairam2661

Description

@sairam2661

Test commit
417a5112947d9889cad54cb5b2110b37978b86b8

Description
The --arc-split-funcs pass crashes when the module contains an external function declaration.

Steps to reproduce

  • Minimal MLIR program (test.mlir)
"builtin.module"() ({
  "func.func"() <{function_type = (i42) -> i9001, sym_name = "exit", sym_visibility = "private"}> ({}) : () -> ()
  "func.func"() <{function_type = () -> (), sym_name = "trigger"}> ({
    %0 = "arith.constant"() <{value = 1 : i32}> : () -> i32
    %1 = "arith.constant"() <{value = 2 : i32}> : () -> i32
    "func.return"() : () -> ()
  }) : () -> ()
}) : () -> ()

Command

circt-opt --arc-split-funcs=split-bound=2 test.mlir

Output

circt-opt: /workdir/sources/circt/llvm/llvm/include/llvm/ADT/ilist_iterator.h:168: llvm::ilist_iterator::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/circt and include the crash backtrace.
Stack dump:
0.      Program arguments: /workdir/builds/circt/bin/circt-opt --arc-split-funcs=split-bound=2 test.mlir
 #0 0x000055a67a2a294b backtrace (/workdir/builds/circt/bin/circt-opt+0x6f4e94b)
 #1 0x000055a67a432747 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /workdir/sources/circt/llvm/llvm/lib/Support/Unix/Signals.inc:834:13
 #2 0x000055a67a430373 llvm::sys::RunSignalHandlers() /workdir/sources/circt/llvm/llvm/lib/Support/Signals.cpp:105:18
 #3 0x000055a67a4334b5 SignalHandler(int, siginfo_t*, void*) /workdir/sources/circt/llvm/llvm/lib/Support/Unix/Signals.inc:426:38
 #4 0x00007f5f05587520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007f5f055db9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #6 0x00007f5f05587476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #7 0x00007f5f0556d7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #8 0x00007f5f0556d71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #9 0x00007f5f0557ee96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x000055a67a457bb0 llvm::ilist_detail::node_base_prevnext<llvm::ilist_node_base<true, void>, true>::getNext() const /workdir/sources/circt/llvm/llvm/include/llvm/ADT/ilist_node_base.h:42:38
#11 0x000055a67a457bb0 llvm::ilist_node_impl<llvm::ilist_detail::node_options<mlir::Block, true, false, void, false, void> >::getNext() /workdir/sources/circt/llvm/llvm/include/llvm/ADT/ilist_node.h:108:59
#12 0x000055a67a457bb0 llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, true, false, void, false, void>, false, false>::operator++() /workdir/sources/circt/llvm/llvm/include/llvm/ADT/ilist_iterator.h:187:57
#13 0x000055a67a457bb0 llvm::simple_ilist<mlir::Block>::begin() /workdir/sources/circt/llvm/llvm/include/llvm/ADT/simple_ilist.h:118:29
#14 0x000055a67a457bb0 llvm::simple_ilist<mlir::Block>::front() /workdir/sources/circt/llvm/llvm/include/llvm/ADT/simple_ilist.h:137:31
#15 0x000055a67a81a8ac mlir::Block::getOperations() /workdir/sources/circt/llvm/mlir/include/mlir/IR/Block.h:137:31
#16 0x000055a67a81a8ac (anonymous namespace)::SplitFuncsPass::lowerFunc(mlir::func::FuncOp) /workdir/sources/circt/lib/Dialect/Arc/Transforms/SplitFuncs.cpp:61:36
#17 0x000055a67a81954f llvm::failed(llvm::LogicalResult) /workdir/sources/circt/llvm/llvm/include/llvm/Support/LogicalResult.h:71:42
#18 0x000055a67a81954f (anonymous namespace)::SplitFuncsPass::runOnOperation() /workdir/sources/circt/lib/Dialect/Arc/Transforms/SplitFuncs.cpp:51:9
#19 0x000055a68101eb3a mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_44::operator()() const /workdir/sources/circt/llvm/mlir/lib/Pass/Pass.cpp:0:17
#20 0x000055a68101eb3a void llvm::function_ref<void ()>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_44>(long) /workdir/sources/circt/llvm/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:12
#21 0x000055a68101eb3a llvm::function_ref<void ()>::operator()() const /workdir/sources/circt/llvm/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:12
#22 0x000055a68101eb3a void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRef<mlir::IRUnit>, mlir::Pass&) /workdir/sources/circt/llvm/mlir/include/mlir/IR/MLIRContext.h:290:7
#23 0x000055a68101eb3a mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /workdir/sources/circt/llvm/mlir/lib/Pass/Pass.cpp:603:21
#24 0x000055a68101f8f9 llvm::LogicalResult::failed() const /workdir/sources/circt/llvm/llvm/include/llvm/Support/LogicalResult.h:43:43
#25 0x000055a68101f8f9 llvm::failed(llvm::LogicalResult) /workdir/sources/circt/llvm/llvm/include/llvm/Support/LogicalResult.h:71:58
#26 0x000055a68101f8f9 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /workdir/sources/circt/llvm/mlir/lib/Pass/Pass.cpp:682:9
#27 0x000055a681026298 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) /workdir/sources/circt/llvm/mlir/lib/Pass/Pass.cpp:1117:3
#28 0x000055a6810259d1 mlir::PassManager::run(mlir::Operation*) /workdir/sources/circt/llvm/mlir/lib/Pass/Pass.cpp:0:0
#29 0x000055a680882280 llvm::LogicalResult::failed() const /workdir/sources/circt/llvm/llvm/include/llvm/Support/LogicalResult.h:43:43
#30 0x000055a680882280 llvm::failed(llvm::LogicalResult) /workdir/sources/circt/llvm/llvm/include/llvm/Support/LogicalResult.h:71:58
#31 0x000055a680882280 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) /workdir/sources/circt/llvm/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:591:7
#32 0x000055a6808814ae processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) /workdir/sources/circt/llvm/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:673:12
#33 0x000055a6808814ae mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_3::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::MemoryBufferRef, llvm::raw_ostream&) const /workdir/sources/circt/llvm/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:771:12
#34 0x000055a6808814ae llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::MemoryBufferRef const&, 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&)::$_3>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::MemoryBufferRef const&, llvm::raw_ostream&) /workdir/sources/circt/llvm/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:12
#35 0x000055a6808aa77b llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, llvm::MemoryBufferRef const&, llvm::raw_ostream&) const /workdir/sources/circt/llvm/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:12
#36 0x000055a6808aa77b 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::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) /workdir/sources/circt/llvm/mlir/lib/Support/ToolUtilities.cpp:30:12
#37 0x000055a680878d52 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) /workdir/sources/circt/llvm/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:776:26
#38 0x000055a680879089 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) /workdir/sources/circt/llvm/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:822:14
#39 0x000055a6808792cd mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) /workdir/sources/circt/llvm/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:838:10
#40 0x000055a67a3285f3 llvm::failed(llvm::LogicalResult) /workdir/sources/circt/llvm/llvm/include/llvm/Support/LogicalResult.h:71:42
#41 0x000055a67a3285f3 main /workdir/sources/circt/tools/circt-opt/circt-opt.cpp:86:10
#42 0x00007f5f0556ed90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#43 0x00007f5f0556ee40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#44 0x000055a67a266e15 _start (/workdir/builds/circt/bin/circt-opt+0x6f12e15)
Aborted (core dumped)

Metadata

Metadata

Assignees

Labels

ArcInvolving the `arc` dialectbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions