[FIRRTL][LowerToHW] Dont touching registers with deleted names crashing
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
```
circuit Top: %[[
{
"class": "firrtl.transforms.DontTouchAnnotation",
"target": "~Top|Top>_T_0"
}
]]
module Top:
input clock : Clock
reg _T_0 : UInt<1>, clock with:
reset => (UInt<1>(0), _T_0)
```
```
./bin/firtool ./test.fir
Assertion failed: (!sym.getValue().empty() && "symbol name must be non-empty"), function get, file /Users/andrewyoung/wsp/circt/build-release/tools/circt/include/circt/Dialect/HW/HWAttributes.cpp.inc, line 402.
PLEASE submit a bug report to https://github.com/llvm/circt and include the crash backtrace.
Stack dump:
0. Program arguments: ./bin/firtool ./test.fir
e #0 0x0000000100c21098 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10007d098)
#1 0x0000000100c1f4a4 llvm::sys::RunSignalHandlers() (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10007b4a4)
#2 0x0000000100c21724 SignalHandler(int) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10007d724)
#3 0x0000000190cfea24 (/usr/lib/system/libsystem_platform.dylib+0x18042ea24)
#4 0x0000000190ccfc28 (/usr/lib/system/libsystem_pthread.dylib+0x1803ffc28)
#5 0x0000000190bddae8 (/usr/lib/system/libsystem_c.dylib+0x18030dae8)
#6 0x0000000190bdce44 (/usr/lib/system/libsystem_c.dylib+0x18030ce44)
#7 0x00000001012463e0 circt::hw::InnerSymPropertiesAttr::get(mlir::MLIRContext*, mlir::StringAttr, unsigned long long, mlir::StringAttr) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x1006a23e0)
#8 0x0000000100f3a3a4 circt::firrtl::DeclVisitor<(anonymous namespace)::FIRRTLLowering, mlir::LogicalResult>::dispatchDeclVisitor(mlir::Operation*) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x1003963a4)
#9 0x0000000100f30420 circt::firrtl::StmtVisitor<(anonymous namespace)::FIRRTLLowering, mlir::LogicalResult>::dispatchStmtVisitor(mlir::Operation*) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10038c420)
#10 0x0000000100f21594 circt::firrtl::ExprVisitor<(anonymous namespace)::FIRRTLLowering, mlir::LogicalResult>::dispatchExprVisitor(mlir::Operation*) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10037d594)
#11 0x0000000100f1883c (anonymous namespace)::FIRRTLModuleLowering::lowerModuleBody(circt::firrtl::FModuleOp, (anonymous namespace)::CircuitLoweringState&) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10037483c)
#12 0x0000000100f11ce8 (anonymous namespace)::FIRRTLModuleLowering::runOnOperation() (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10036dce8)
#13 0x00000001013efe3c mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10084be3c)
#14 0x00000001013f2188 mlir::PassManager::run(mlir::Operation*) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10084e188)
#15 0x0000000100bb4254 processBuffer(mlir::MLIRContext&, mlir::TimingScope&, llvm::SourceMgr&, std::__1::optional>>&) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x100010254)
#16 0x0000000100bb3880 processInputSplit(mlir::MLIRContext&, mlir::TimingScope&, std::__1::unique_ptr>, std::__1::optional>>&) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x10000f880)
#17 0x0000000100ba9d84 executeFirtool(mlir::MLIRContext&) (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x100005d84)
#18 0x0000000100ba84c0 main (/Users/andrewyoung/wsp/circt/build-release/bin/firtool+0x1000044c0)
#19 0x0000000190977f28
fish: Job 1, './bin/firtool ./test.fir' terminated by signal SIGABRT (Abort)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the crash with the provided test.fir and ./bin/firtool, then inspect FIRRTLModuleLowering and the HWAttributes.cpp.inc assertion shown in the backtrace. Trace how the deleted register name reaches InnerSymPropertiesAttr::get and add a regression test showing that the input no longer aborts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100