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

Hari Limaye via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 08:35:22 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)
----------------
hazzlim wrote:

Ah yep thank you for clarifying this point, I have updated the comment to be clearer on this point. I reordered the checks because it seemed to make more sense to check SpecializeLiteralConstant=false, given that it is only in this case that we limit multiple iterations to recursive functions.

On this point, I was actually thinking - is it not hypothetically possible that a specialized function could also be found to return a constant _pointer_, e.g. a function pointer?

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


More information about the llvm-commits mailing list