FranckQC commented on code in PR #11574:
URL: https://github.com/apache/tvm/pull/11574#discussion_r891875556


##########
src/tir/transforms/common_subexpr_elim_tools.cc:
##########
@@ -762,21 +807,40 @@ std::vector<std::pair<PrimExpr, size_t>> 
SyntacticToSemanticComputations(
          return a_stream.str().compare(b_stream.str()) < 0;
        });
 
-  // For each element in the hashtable
-  for (auto elem : sorted_map_items) {
-    // We try to see if a semantically equivalent term is already in the 
resulting vector
-    auto it_found = std::find_if(result.begin(), result.end(),
-                                 [elem](std::pair<PrimExpr, size_t> 
already_seen) {
-                                   return EquivalentTerms(already_seen.first, 
elem.first);
-                                 });
-    // And if so, we increase (by `elem.second`) its count
-    if (it_found != result.end()) {
-      it_found->second += elem.second;
+  for (const auto& elem : sorted_items_of_table) {
+    PrimExpr norm_elem = NormalizeTerm(elem.first, identify_equiv_terms);
+    // If the normalized term is not already a key in the normalized table
+    auto it_found = norm_table.find(norm_elem);

Review Comment:
   Done with 
https://github.com/apache/tvm/pull/11574/commits/c701e51889279da8726ecbaad112e09e9fe613a3



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to