Skip to content

Commit

Permalink
[Comb] Handle type aliases in comb.concat (#6588)
Browse files Browse the repository at this point in the history
* [Comb] Handle type aliases in `comb.concat`

* [Comb] Add regression test (#5772)

* [Comb] Adhere to convention

* [Comb] Test for presence of `comb.concat` in output
  • Loading branch information
hovind committed Jan 19, 2024
1 parent 28d430d commit 86a6b74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Dialect/Comb/CombOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ bool XorOp::isBinaryNot() {
static unsigned getTotalWidth(ValueRange inputs) {
unsigned resultWidth = 0;
for (auto input : inputs) {
resultWidth += input.getType().cast<IntegerType>().getWidth();
resultWidth += hw::type_cast<IntegerType>(input.getType()).getWidth();
}
return resultWidth;
}
Expand Down
12 changes: 12 additions & 0 deletions test/Dialect/Comb/basic.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: circt-opt %s | FileCheck %s

hw.type_scope @__hw_typedecls {
hw.typedecl @foo : i1
}

// https://github.com/llvm/circt/issues/5772
// CHECK-LABEL: @Issue5772
hw.module @Issue5772(in %arg0: !hw.typealias<@__hw_typedecls::@foo,i1>) {
// CHECK: comb.concat %arg0 : !hw.typealias<@__hw_typedecls::@foo, i1>
%0 = comb.concat %arg0 : !hw.typealias<@__hw_typedecls::@foo,i1>
}

0 comments on commit 86a6b74

Please sign in to comment.