[PATCH] D139346: [FuncSpec] Global ranking of specialisations

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 22:59:59 PST 2022


ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.

I didn't take part in the previous reviewing due to limited time. But this change is relatively independent and pretty good.



================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:413-418
 /// This function decides whether it's worthwhile to specialize function
 /// \p F based on the known constant values its arguments can take on. It
 /// only discovers potential specialization opportunities without actually
 /// applying them.
 ///
 /// \returns true if any specializations have been found.
----------------
The comment here didn't get changed. It would be better to copy the comments in the declaration to here or remove the comments here simply.


================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:465
     }
-    Added = false;
-  }
-
-  // Remove unprofitable specializations.
-  if (!ForceFunctionSpecialization)
-    Specializations.remove_if(
-        [](const auto &Entry) { return Entry.second.Gain <= 0; });
-
-  // Clear the MapVector and return the underlying vector.
-  WorkList = Specializations.takeVector();
-
-  // Sort the candidates in descending order.
-  llvm::stable_sort(WorkList, [](const auto &L, const auto &R) {
-    return L.second.Gain > R.second.Gain;
-  });
+    if (!S.Args.size())
+      continue;
----------------



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139346/new/

https://reviews.llvm.org/D139346



More information about the llvm-commits mailing list