Skip to content

Commit a509cfe

Browse files
authored
[Synth][LowerVariadic] Fix a dialect dependency (#9118)
Add comb/hw/synth dialects as a dependency to the pass
1 parent 0fca2bd commit a509cfe

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

include/circt/Dialect/Synth/Transforms/SynthPasses.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ def LowerVariadic : Pass<"synth-lower-variadic", "hw::HWModuleOp"> {
9191
Option<"timingAware", "timing-aware", "bool", "true",
9292
"Lower operators with timing information">
9393
];
94+
let dependentDialects = [
95+
"circt::comb::CombDialect", "circt::hw::HWDialect",
96+
"circt::synth::SynthDialect"
97+
];
9498
}
9599

96100
def LowerWordToBits : Pass<"synth-lower-word-to-bits", "hw::HWModuleOp"> {

test/Dialect/Synth/lower-variadic.mlir

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: circt-opt %s --synth-lower-variadic | FileCheck %s --check-prefixes=COMMON,TIMING
2-
// RUN: circt-opt %s --synth-lower-variadic=timing-aware=false | FileCheck %s --check-prefixes=COMMON,NO-TIMING
1+
// RUN: circt-opt %s --synth-lower-variadic --split-input-file | FileCheck %s --check-prefixes=COMMON,TIMING
2+
// RUN: circt-opt %s --synth-lower-variadic=timing-aware=false --split-input-file | FileCheck %s --check-prefixes=COMMON,NO-TIMING
33
// COMMON-LABEL: hw.module @Basic
44
hw.module @Basic(in %a: i2, in %b: i2, in %c: i2, in %d: i2, in %e: i2, out f: i2) {
55
// COMMON-NEXT: %[[RES0:.+]] = synth.aig.and_inv not %a, %b : i2
@@ -61,3 +61,13 @@ hw.module @ChildRegion(in %x: i4, in %y: i4, in %z: i4) {
6161
%1 = comb.and %0, %y, %z : i4
6262
}
6363
}
64+
65+
// -----
66+
// Use a different file to check the dialect dependency.
67+
// COMMON-LABEL: hw.module @Issue9115
68+
hw.module @Issue9115(in %a : i16, in %b : i16, in %c : i16, in %d : i16, out product : i16) {
69+
%0 = comb.mul %a, %b, %c : i16
70+
// COMMON-NEXT: %[[TMP:.+]] = comb.mul %a, %b : i16
71+
// COMMON-NEXT: comb.mul %c, %[[TMP]] : i16
72+
hw.output %0 : i16
73+
}

0 commit comments

Comments
 (0)