mirror of https://github.com/llvm/circt.git
[Moore][NFC] Fix warning when building Moore components (#7566)
The corresponding code snippet has a problem for checking whether the pointer pointing to a module op is a nullptr. This commit rewrites its code to fix the warning.
This commit is contained in:
parent
c0a77be1f4
commit
b441059067
|
@ -518,17 +518,17 @@ LogicalResult AssignedVariableOp::canonicalize(AssignedVariableOp op,
|
|||
|
||||
// Eliminate variables that feed an output port of the same name.
|
||||
for (auto &use : op->getUses()) {
|
||||
auto outputOp = dyn_cast<OutputOp>(use.getOwner());
|
||||
if (!outputOp)
|
||||
continue;
|
||||
auto moduleOp = dyn_cast<SVModuleOp>(outputOp.getParentOp());
|
||||
if (!moduleOp)
|
||||
break;
|
||||
auto moduleType = moduleOp.getModuleType();
|
||||
auto portName = moduleType.getOutputNameAttr(use.getOperandNumber());
|
||||
if (portName == op.getNameAttr()) {
|
||||
rewriter.replaceOp(op, op.getInput());
|
||||
return success();
|
||||
auto *useOwner = use.getOwner();
|
||||
if (auto outputOp = dyn_cast<OutputOp>(useOwner)) {
|
||||
if (auto moduleOp = dyn_cast<SVModuleOp>(outputOp->getParentOp())) {
|
||||
auto moduleType = moduleOp.getModuleType();
|
||||
auto portName = moduleType.getOutputNameAttr(use.getOperandNumber());
|
||||
if (portName == op.getNameAttr()) {
|
||||
rewriter.replaceOp(op, op.getInput());
|
||||
return success();
|
||||
}
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue