-
Notifications
You must be signed in to change notification settings - Fork 373
Open
Labels
Description
Hi, all! Let's consider a such Verilog
example:
module top (input clk, input rstn);
reg r1;
always @(posedge clk or negedge rstn) begin
r1 = 0;
end
endmodule
During llhd-desequentialize
pass circt-opt
tool segfaults using this pipeline:
circt-verilog test.sv | circt-opt --llhd-desequentialize
With such stacktrace:
PLEASE submit a bug report to https://github.com/llvm/circt and include the crash backtrace.
Stack dump:
0. Program arguments: ./circt-opt --llhd-desequentialize
#0 0x00005f1950d1c582 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./circt-opt+0x19b1582)
#1 0x00005f1950d19312 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x000073e5fec42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00005f19517f1f60 circt::hw::isHWIntegerType(mlir::Type) (./circt-opt+0x2486f60)
#4 0x00005f1950f4aa48 circt::comb::__mlir_ods_local_type_constraint_Comb1(mlir::Operation*, mlir::Type, llvm::StringRef, unsigned int) CombOps.cpp:0:0
#5 0x00005f1950f861df circt::comb::XorOp::verifyInvariantsImpl() (./circt-opt+0x1c1b1df)
#6 0x00005f1950fd06f8 mlir::Op<circt::comb::XorOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<circt::hw::TypeVariant<mlir::IntegerType, circt::hw::IntType>>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::OpTrait::IsCommutative, mlir::OpTrait::SameTypeOperands, mlir::OpTrait::SameOperandsAndResultType, mlir::InferIntRangeInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait>::verifyInvariants(mlir::Operation*) CombDialect.cpp:0:0
#7 0x00005f1950fcff9e mlir::RegisteredOperationName::Model<circt::comb::XorOp>::verifyInvariants(mlir::Operation*) CombDialect.cpp:0:0
#8 0x00005f1952540efa (anonymous namespace)::OperationVerifier::verifyOperation(mlir::Operation&) Verifier.cpp:0:0
#9 0x00005f19525426e8 mlir::verify(mlir::Operation*, bool) (./circt-opt+0x31d76e8)
#10 0x00005f195318ea65 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./circt-opt+0x3e23a65)
#11 0x00005f195318ec29 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./circt-opt+0x3e23c29)
#12 0x00005f195318dc1e mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (./circt-opt+0x3e22c1e)
#13 0x00005f195318e58f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./circt-opt+0x3e2358f)
#14 0x00005f195318ec29 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./circt-opt+0x3e23c29)
#15 0x00005f195318fc5b mlir::PassManager::run(mlir::Operation*) (./circt-opt+0x3e24c5b)
#16 0x00005f19529aa732 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#17 0x00005f19529ac006 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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#18 0x00005f19529e3476 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) (./circt-opt+0x3678476)
#19 0x00005f19529a963d mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#20 0x00005f19529ac6c8 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./circt-opt+0x36416c8)
#21 0x00005f19529ac8c2 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./circt-opt+0x36418c2)
#22 0x00005f1950c53ff8 main (./circt-opt+0x18e8ff8)
#23 0x000073e5fec29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#24 0x000073e5fec29e40 call_init ./csu/../csu/libc-start.c:128:20
#25 0x000073e5fec29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#26 0x00005f1950c53895 _start (./circt-opt+0x18e8895)
mlir generated by circt-verilog
presented below:
module {
hw.module @top(in %clk : i1, in %rstn : i1) {
%true = hw.constant true
%false = hw.constant false
%0:2 = llhd.process -> i1, i1 {
cf.br ^bb1(%clk, %rstn, %false, %false : i1, i1, i1, i1)
^bb1(%1: i1, %2: i1, %3: i1, %4: i1): // 3 preds: ^bb0, ^bb2, ^bb2
llhd.wait yield (%3, %4 : i1, i1), (%clk, %rstn : i1, i1), ^bb2(%1, %2 : i1, i1)
^bb2(%5: i1, %6: i1): // pred: ^bb1
%7 = comb.xor bin %5, %true : i1
%8 = comb.and bin %7, %clk : i1
%9 = comb.xor bin %rstn, %true : i1
%10 = comb.and bin %6, %9 : i1
%11 = comb.or bin %8, %10 : i1
cf.cond_br %11, ^bb1(%clk, %rstn, %false, %true : i1, i1, i1, i1), ^bb1(%clk, %rstn, %false, %false : i1, i1, i1, i1)
}
hw.output
}
}