[PATCH] D79215: [llvm][NFC] Inliner: simplify inlining decision logic

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 20:15:32 PDT 2020


davidxl added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:457
+    setInlineRemark(CB, inlineCostStr(IC));
+    return None;
   }
----------------
mtrofin wrote:
> mtrofin wrote:
> > mtrofin wrote:
> > > davidxl wrote:
> > > > Returning None simplifies the check of the return value a little, but it drops information. Perhaps just return IC in case the user needs to check it in different context?
> > > That's the thing, the user doesn't use the IC in the 'don't inline' case.
> > Or you mean return InlineCost, not Optional<InlineCost> - and fabricate a 'never' if needed?
> Actually, looking at it, returning InlineCost (not Optional) won't work, we would equally lose information in the deferred case. I could wrap shouldInline, if we expect other users of it (but seems unnecessarily complex?)
I meant return Optional<InlineCost> -- basically does not change the behavior of shouldInline(..) in terms of what is returned. It is not super important -- just feels like the info is computed, used in place and dropped before returning seems unnecessary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79215/new/

https://reviews.llvm.org/D79215





More information about the llvm-commits mailing list