Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/rsz/src/Resizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2782,6 +2782,11 @@ bool Resizer::canRemoveBuffer(sta::Instance* buffer,
sta::Pin* output_pin = db_network_->findPin(buffer, output_port);
sta::Net* input_net = db_network_->net(input_pin);
sta::Net* output_net = db_network_->net(output_pin);
odb::dbModNet* input_modnet = db_network_->hierNet(input_pin);
odb::dbModNet* output_modnet = db_network_->hierNet(output_pin);
if (input_modnet != output_modnet) {
return false;
}
Comment thread
oharboe marked this conversation as resolved.
odb::dbNet* input_db_net = db_network_->findFlatDbNet(input_net);
odb::dbNet* output_db_net = db_network_->findFlatDbNet(output_net);
if ((input_db_net != nullptr && input_db_net->isDoNotTouch())
Expand Down Expand Up @@ -2902,7 +2907,8 @@ bool Resizer::removeBuffer(sta::Instance* buffer)

sta_->disconnectPin(input_pin);
sta_->disconnectPin(output_pin);
if (survivor_modnet != nullptr && removed_modnet != nullptr) {
if (survivor_modnet != nullptr && removed_modnet != nullptr
&& survivor_modnet != removed_modnet) {
survivor_modnet->mergeModNet(removed_modnet);
} else if (survivor_modnet != nullptr) {
Comment on lines +2910 to 2913

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If survivor_modnet == removed_modnet (and both are non-null), the current condition survivor_modnet != removed_modnet evaluates to false. This causes the execution to fall through to the else if (survivor_modnet != nullptr) branch, which will then execute survivor_modnet->connectTermsOf(db_removed). Since both nets are already part of the same hierarchical module net, calling connectTermsOf is redundant and potentially problematic.

Nesting the inequality check inside the if (survivor_modnet != nullptr && removed_modnet != nullptr) block avoids falling through to the else if branches when both modnets are identical.

  if (survivor_modnet != nullptr && removed_modnet != nullptr) {
    if (survivor_modnet != removed_modnet) {
      survivor_modnet->mergeModNet(removed_modnet);
    }
  } else if (survivor_modnet != nullptr) {

survivor_modnet->connectTermsOf(db_removed);
Expand Down
Loading