[PATCH] D29169: Do not apply redundant LastCallToStaticBonus

Taewook Oh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 23:24:41 PST 2017


twoh created this revision.
Herald added a subscriber: mehdi_amini.

As written in the comments above, LastCallToStaticBonus is already applied to
the cost if Caller has only one user, so it is redundant to reapply the bonus
here.

If the only user is not a caller, TotalSecondaryCost will not be adjusted
anyway because callerWillBeRemoved is false. If there's no caller at all, we
don't need to care about TotalSecondaryCost because
inliningPreventsSomeOuterInline is false.


https://reviews.llvm.org/D29169

Files:
  lib/Transforms/IPO/Inliner.cpp


Index: lib/Transforms/IPO/Inliner.cpp
===================================================================
--- lib/Transforms/IPO/Inliner.cpp
+++ lib/Transforms/IPO/Inliner.cpp
@@ -326,7 +326,7 @@
   // one is set very low by getInlineCost, in anticipation that Caller will
   // be removed entirely.  We did not account for this above unless there
   // is only one caller of Caller.
-  if (callerWillBeRemoved && !Caller->use_empty())
+  if (callerWillBeRemoved && !Caller->hasOneUse())
     TotalSecondaryCost -= InlineConstants::LastCallToStaticBonus;
 
   if (inliningPreventsSomeOuterInline && TotalSecondaryCost < IC.getCost())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29169.85865.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170126/fa988d23/attachment.bin>


More information about the llvm-commits mailing list