[FIRRTL] Dedup: crashes when fixing up class ports
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
```mlir
firrtl.circuit "Top" {
firrtl.module @Top() {
firrtl.instance foo @Foo(out a: !firrtl.class<@Spam()>)
firrtl.instance bar @Bar(out a: !firrtl.class<@Eggs()>)
}
firrtl.module private @Foo(out %a: !firrtl.class<@Spam()>) {}
firrtl.module private @Bar(out %a: !firrtl.class<@Eggs()>) {}
firrtl.class private @Spam() {}
firrtl.class private @Eggs() {}
}
```
running `bin/circt-opt --firrtl-dedup dedup.mlir --debug-only=firrtl-dedup --mlir-disable-threading` gives:
```
- Updating instance port "bar.a" from !firrtl.class<@Eggs()> to !firrtl.class<@Spam()>
circt-opt: /circt/include/circt/Dialect/FIRRTL/FIRRTLTypes.h:481: BaseTy circt::firrtl::type_cast(mlir::Type) [BaseTy = circt::firrtl::BundleType]: Assertion `type_isa(type) && "type must convert to requested type"' failed.
PLEASE submit a bug report to https://github.com/llvm/circt and include the crash backtrace.
Stack dump:
0. Program arguments: circt/build/bin/circt-opt --firrtl-dedup dedup.mlir --debug-only=firrtl-dedup --mlir-disable-threading
#0 0x00000000012d0d4e llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) circt/llvm/llvm/lib/Support/Unix/Signals.inc:842:13
#1 0x00000000012ce998 llvm::sys::RunSignalHandlers() circt/llvm/llvm/lib/Support/Signals.cpp:109:18
#2 0x00000000012d1d2b SignalHandler(int, siginfo_t*, void*)circt/llvm/llvm/lib/Support/Unix/Signals.inc:429:38
#3 0x00007f976b5e8990 __restore_rt (/lib64/libpthread.so.0+0x12990)
#4 0x00007f976a3ea52f raise (/lib64/libc.so.6+0x4e52f)
#5 0x00007f976a3bde65 abort (/lib64/libc.so.6+0x21e65)
#6 0x00007f976a3bdd39 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d39)
#7 0x00007f976a3e2e86 (/lib64/libc.so.6+0x46e86)
#8 0x000000000180cafd mlir::TypeStorage::getAbstractType() circt/llvm/llvm/../mlir/include/mlir/IR/TypeSupport.h:173:5
#9 0x000000000180cafd mlir::Type::getTypeID() circt/llvm/llvm/../mlir/include/mlir/IR/Types.h:101:37
#10 0x000000000180cafd bool mlir::detail::StorageUserBase::classof(mlir::Type) /circt/llvm/llvm/../mlir/include/mlir/IR/StorageUniquerSupport.h:113:16
#11 0x000000000180cafd llvm::CastInfo::isPossible(mlir::Type) circt/llvm/llvm/../mlir/include/mlir/IR/Types.h:377:14
#12 0x000000000180cafd bool llvm::isa(mlir::Type const&) circt/llvm/llvm/include/llvm/Support/Casting.h:548:11
#13 0x000000000180cafd circt::firrtl::BundleType circt::firrtl::type_cast(mlir::Type) circt/include/circt/Dialect/FIRRTL/FIRRTLTypes.h:484:7
#14 0x0000000001a99a19 fixupConnect(mlir::ImplicitLocOpBuilder&, mlir::Value, mlir::Value) circt/lib/Dialect/FIRRTL/Transforms/Dedup.cpp:1605:20
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in circt/lib/Dialect/FIRRTL/Transforms/Dedup.cpp at fixupConnect, identified at line 1605 in the stack trace, and inspect the failing type assertion in include/circt/Dialect/FIRRTL/FIRRTLTypes.h. Run bin/circt-opt with the supplied reproducer and command; done means the class-port deduplication case completes without the reported assertion crash.
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
- Mostly clear
- Newbie friendliness
- 48/100