[llvm] [FuncSpec] Enable SpecializeLiteralConstant by default (PR #113442)

Alexandros Lamprineas via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 08:50:13 PDT 2024


================
@@ -682,10 +679,9 @@ bool FunctionSpecializer::run() {
         (RequireMinSize && Metrics.NumInsts < MinFunctionSize))
       continue;
 
-    // TODO: For now only consider recursive functions when running multiple
-    // times. This should change if specialization on literal constants gets
-    // enabled.
-    if (!Inserted && !Metrics.isRecursive && !SpecializeLiteralConstant)
+    // When specialization on literal constants is disabled, only consider
+    // recursive functions when running multiple times.
+    if (!SpecializeLiteralConstant && !Inserted && !Metrics.isRecursive)
----------------
labrinea wrote:

Hmm, that did not occur to me before good point. Would it be too much to ask adding a regression test? :) We already have one for tracking return values, perhaps you could use that as a template?
https://github.com/llvm/llvm-project/blob/main/llvm/test/Transforms/FunctionSpecialization/track-return.ll

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


More information about the llvm-commits mailing list