[llvm-bugs] [Bug 48530] New: [InlineCost] uninitialized InlineCost field cause behave different with Debug and Release mode

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 16 05:05:29 PST 2020


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: unassignedbugs at nondot.org
          Reporter: zhongyunde at tom.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201216/722a8acd/attachment.html>


More information about the llvm-bugs mailing list