@@ -278,6 +278,15 @@ OptimizationContext::GetSourcesSetTreeNodeInfoForFunction(
278278 return sources_set_tree_node_infos_by_function_.at (in_function).get ();
279279}
280280
281+ const xls::LeafTypeTree<std::monostate>&
282+ OptimizationContext::GetBlankTypeTreeForType (xls::Type* type) {
283+ CHECK_NE (type, nullptr );
284+ auto [param_tree_it, _] = param_tree_cache_.try_emplace (type, type);
285+ xls::LeafTypeTree<std::monostate>& found = param_tree_it->second ;
286+ CHECK (found.type ()->IsEqualTo (type));
287+ return found;
288+ }
289+
281290absl::StatusOr<bool > OptimizationContext::CheckNodeSourcesInSet (
282291 xls::FunctionBase* in_function, xls::Node* node,
283292 absl::flat_hash_set<const xls::Param*> sources_set,
@@ -1270,12 +1279,10 @@ absl::Status RemoveUnusedContinuationInputs(GeneratedFunction& func,
12701279 }
12711280
12721281 CHECK_EQ (continuation_in.input_node ->function_base (), slice.function );
1273-
12741282 if (return_value_from_params.contains (continuation_in.input_node )) {
12751283 ++cont_in_it;
12761284 continue ;
12771285 }
1278-
12791286 // There may still be uses like forming a tuple, the element of which is
12801287 // never indexed
12811288 XLS_RETURN_IF_ERROR (
@@ -1349,8 +1356,8 @@ FindPassThroughs(GeneratedFunction& func, OptimizationContext& context) {
13491356
13501357 // Check that param has the same number of elements as
13511358 // continuation_out. This avoids marking slices as pass-throughs.
1352- xls::LeafTypeTree<std::monostate> param_tree (
1353- source_node->GetType ());
1359+ const xls::LeafTypeTree<std::monostate>& param_tree =
1360+ context. GetBlankTypeTreeForType ( source_node->GetType ());
13541361 if (param_tree.elements ().size () != sources.elements ().size ()) {
13551362 disallowed = true ;
13561363 break ;
0 commit comments