cxxrtl: mark dead local wires as unused even with inlining disabled.
authorwhitequark <whitequark@whitequark.org>
Thu, 15 Jul 2021 22:27:27 +0000 (22:27 +0000)
committerwhitequark <whitequark@whitequark.org>
Thu, 15 Jul 2021 22:27:27 +0000 (22:27 +0000)
Fixes #2739.

backends/cxxrtl/cxxrtl_backend.cc

index 70a3add5d3852102f3f3463adca6dbc5ee717578..26c534bec1853438619bec37266ccede2ab23e75 100644 (file)
@@ -2733,12 +2733,14 @@ struct CxxrtlWorker {
                        for (auto wire : module->wires()) {
                                auto &wire_type = wire_types[wire];
                                if (!wire_type.is_local()) continue;
-                               if (!wire->name.isPublic() && !inline_internal) continue;
-                               if (wire->name.isPublic() && !inline_public) continue;
-
                                if (live_wires[wire].empty()) {
                                        wire_type = {WireType::UNUSED}; // wire never used
-                               } else if (flow.is_inlinable(wire, live_wires[wire])) {
+                                       continue;
+                               }
+
+                               if (!wire->name.isPublic() && !inline_internal) continue;
+                               if (wire->name.isPublic() && !inline_public) continue;
+                               if (flow.is_inlinable(wire, live_wires[wire])) {
                                        if (flow.wire_comb_defs[wire].size() > 1)
                                                log_cmd_error("Wire %s.%s has multiple drivers!\n", log_id(module), log_id(wire));
                                        log_assert(flow.wire_comb_defs[wire].size() == 1);