https://bugs.llvm.org/show_bug.cgi?id=48530

            Bug ID: 48530
           Summary: [InlineCost] uninitialized InlineCost field cause
                    behave different with Debug and Release mode
           Product: libraries
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: zhongyu...@tom.com
                CC: llvm-bugs@lists.llvm.org

In the commit 2094d5a03, Add a new field InRecursiveFunction without default
value. so for a non-recursive function, the value Params.InRecursiveFunction is
not uninitialized, which is used in function updateThreshold.


@@ -178,6 +179,9 @@ struct InlineParams {

   /// Compute inline cost even when the cost has exceeded the threshold.
   Optional<bool> ComputeFullInlineCost;
+
+  /// Inside recursive function
+  bool InRecursiveFunction;
 };


@@ -1252,6 +1253,12 @@ void InlineCostCallAnalyzer::updateThreshold(CallBase
&Call, Function &Callee) {
   // Cost in updateThreshold, but the bonus depends on the logic in this
method.
   if (OnlyOneCallAndLocalLinkage)
     Cost -= LastCallToStaticBonus;
+
+  // Add bonus to callsites within recursive functions
+  if (Call.getCaller() != Call.getCalledFunction() &&
+      Params.InRecursiveFunction) {
+    Cost -= CallerRecursiveBonus;
+  }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to