[llvm] [SelectionDAG] Add space-optimized forms of OPC_CheckPredicate (PR #73488)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 19:02:44 PST 2024


================
@@ -125,6 +128,39 @@ class MatcherTableEmitter {
          [](const auto &A, const auto &B) { return A.second > B.second; });
     for (const auto &PatternPredicate : PatternPredicateList)
       PatternPredicates.push_back(PatternPredicate.first);
+
+    // Sort Predicates by usage.
+    // Merge predicates with same code.
+    for (const auto &Usage : PredicateUsage) {
+      TreePattern *TP = Usage.first;
+      TreePredicateFn Pred(TP);
+      NodePredicatesByCodeToRun[Pred.getCodeToRunOnSDNode()].push_back(TP);
----------------
MaskRay wrote:

Iterating over `PredicateUsage` and creating `StringMap NodePredicatesByCodeToRun` can cause non-determinism.



https://github.com/llvm/llvm-project/pull/73488


More information about the llvm-commits mailing list