[llvm] 9e3ae8d - [FuncSpec] Rename internal option. NFC.

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 21 03:02:46 PST 2021


Author: Sjoerd Meijer
Date: 2021-12-21T11:02:01Z
New Revision: 9e3ae8d296aaff9d62cc0f28dceb72e8c3e230f6

URL: https://github.com/llvm/llvm-project/commit/9e3ae8d296aaff9d62cc0f28dceb72e8c3e230f6
DIFF: https://github.com/llvm/llvm-project/commit/9e3ae8d296aaff9d62cc0f28dceb72e8c3e230f6.diff

LOG: [FuncSpec] Rename internal option. NFC.

Rename option MaxConstantsThreshold to MaxClonesThreshold. Not only is this
more descriptive, this is also in preparation of introducing another threshold
to analyse more than just 1 constant argument as we currently do, and to better
distinguish these options/thresholds.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
    llvm/test/Transforms/FunctionSpecialization/function-specialization4.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
index c745760fa6dbc..2425646455bd9 100644
--- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -64,8 +64,8 @@ static cl::opt<unsigned> FuncSpecializationMaxIters(
     cl::desc("The maximum number of iterations function specialization is run"),
     cl::init(1));
 
-static cl::opt<unsigned> MaxConstantsThreshold(
-    "func-specialization-max-constants", cl::Hidden,
+static cl::opt<unsigned> MaxClonesThreshold(
+    "func-specialization-max-clones", cl::Hidden,
     cl::desc("The maximum number of clones allowed for a single function "
              "specialization"),
     cl::init(3));
@@ -394,14 +394,14 @@ class FunctionSpecializer {
         return L.Gain > R.Gain;
       });
 
-      // Truncate the worklist to 'MaxConstantsThreshold' candidates if
+      // Truncate the worklist to 'MaxClonesThreshold' candidates if
       // necessary.
-      if (Worklist.size() > MaxConstantsThreshold) {
-        LLVM_DEBUG(dbgs() << "FnSpecialization: number of constants exceed "
-                    << "the maximum number of constants threshold.\n"
-                    << "Truncating worklist to " << MaxConstantsThreshold
+      if (Worklist.size() > MaxClonesThreshold) {
+        LLVM_DEBUG(dbgs() << "FnSpecialization: number of candidates exceed "
+                    << "the maximum number of clones threshold.\n"
+                    << "Truncating worklist to " << MaxClonesThreshold
                     << " candidates.\n");
-        Worklist.erase(Worklist.begin() + MaxConstantsThreshold,
+        Worklist.erase(Worklist.begin() + MaxClonesThreshold,
                        Worklist.end());
       }
 

diff  --git a/llvm/test/Transforms/FunctionSpecialization/function-specialization4.ll b/llvm/test/Transforms/FunctionSpecialization/function-specialization4.ll
index 4f43d14a15c9f..f849a6096465e 100644
--- a/llvm/test/Transforms/FunctionSpecialization/function-specialization4.ll
+++ b/llvm/test/Transforms/FunctionSpecialization/function-specialization4.ll
@@ -1,8 +1,8 @@
 ; RUN: opt -function-specialization -force-function-specialization \
-; RUN:   -func-specialization-max-constants=2 -S < %s | FileCheck %s
+; RUN:   -func-specialization-max-clones=2 -S < %s | FileCheck %s
 
 ; RUN: opt -function-specialization -force-function-specialization \
-; RUN:   -func-specialization-max-constants=1 -S < %s | FileCheck %s --check-prefix=CONST1
+; RUN:   -func-specialization-max-clones=1 -S < %s | FileCheck %s --check-prefix=CONST1
 
 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
 


        


More information about the llvm-commits mailing list