[llvm] [FuncSpec] Update function specialization to handle phi-chains (PR #71442)

Alexandros Lamprineas via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 04:31:58 PST 2023


================
@@ -809,20 +908,40 @@ bool FunctionSpecializer::findSpecializations(Function *F, unsigned FuncSize,
       auto IsProfitable = [](Bonus &B, unsigned Score, unsigned FuncSize,
                              unsigned FuncGrowth) -> bool {
         // No check required.
-        if (ForceSpecialization)
+        if (ForceSpecialization) {
+          LLVM_DEBUG(dbgs() << "FnSpecialization: Force is on\n");
           return true;
+        }
         // Minimum inlining bonus.
-        if (Score > MinInliningBonus * FuncSize / 100)
+        if (Score > MinInliningBonus * FuncSize / 100) {
+          LLVM_DEBUG(dbgs()
+                     << "FnSpecialization: Sufficient inlining bonus( " << Score
+                     << " > " << MinInliningBonus * FuncSize / 100 << ")\n");
           return true;
+        }
         // Minimum codesize savings.
-        if (B.CodeSize < MinCodeSizeSavings * FuncSize / 100)
+        if (B.CodeSize < MinCodeSizeSavings * FuncSize / 100) {
+          LLVM_DEBUG(dbgs()
+                     << "FnSpecialization: Insufficinet CodeSize Saving("
----------------
labrinea wrote:

same here about spacing

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


More information about the llvm-commits mailing list