mirror of https://github.com/llvm/circt.git
[Transforms][HierarchicalRunner] Run passes only on HWModuleOp (#8495)
This avoids crash due to passes being scheduled on HWMouleExtern op
This commit is contained in:
parent
d5660dc552
commit
cc25d8a174
|
@ -11,6 +11,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "circt/Dialect/HW/HWOps.h"
|
||||
#include "circt/Support/InstanceGraph.h"
|
||||
#include "circt/Transforms/Passes.h"
|
||||
#include "mlir/IR/Operation.h"
|
||||
|
@ -88,7 +89,7 @@ void HierarchicalRunnerPass::runOnOperation() {
|
|||
auto *node = worklist.pop_back_val();
|
||||
assert(node && "node should not be null");
|
||||
auto op = node->getModule();
|
||||
if (!op || !visited.insert(op))
|
||||
if (!isa_and_nonnull<hw::HWModuleOp>(op) || !visited.insert(op))
|
||||
continue;
|
||||
|
||||
// Ensure an analysis manager has been constructed for each of the nodes.
|
||||
|
|
|
@ -11,10 +11,14 @@ hw.module @bound(out out: i8) {
|
|||
hw.output %add : i8
|
||||
}
|
||||
|
||||
// CHECK-LABEL: hw.module.extern @extern
|
||||
hw.module.extern @extern()
|
||||
|
||||
// CHECK-LABEL: hw.module @top
|
||||
hw.module @top(out out: i8) {
|
||||
%c1_i8 = hw.constant 1 : i8
|
||||
%add = comb.add %c1_i8, %c1_i8 : i8
|
||||
hw.instance "extern" @extern() -> ()
|
||||
%0 = hw.instance "child" @child() -> (out: i8)
|
||||
// CHECK: hw.output %c2_i8
|
||||
hw.output %add : i8
|
||||
|
|
Loading…
Reference in New Issue