[PATCH] D20603: [Inline] Add ability to restrict inlining pass to hinted functions only

Easwaran Raman via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 16:03:04 PDT 2016


eraman added a comment.

In http://reviews.llvm.org/D20603#460461, @Ilod wrote:

> It's an equivalent of /Ob1 on MSVC. We usually use this option on build where we want only optimizations that do not hinder debugging. I want to use this to add support for /Ob1 in clang-cl mode.
>  It seems I could push -mllvm -inline-threshold=-1000 args or something like this when I get the /Ob1 argument instead of adding an API control in LLVM. It feels a little hackish to me (mainly because of the "arbitrary negative enough threshold" I would need to hardcode in clang), the inlining pass would need to compute the size even if it could be avoided, but it would work just fine. I would rather have an API access than pushing -mllvm command line parameters from clang, but I can live with it if you think it's better to keep it this way.
>
> Fixed the typo, moved the test checks.


Ah! I saw the mention of /Ob 1, but ignored it due to my unfamiliarity with MSVC options. Now the patch makes more sense to me.  I also see that you have another patch to add inline hints to implicitly defined functions.


================
Comment at: lib/Transforms/IPO/InlineSimple.cpp:61
@@ -55,1 +60,3 @@
       : Inliner(ID), DefaultThreshold(Threshold) {
+    RestrictToHinted = RestrictInlineToHinted.getNumOccurrences() > 0 ?
+      RestrictInlineToHinted : OnlyHint;
----------------
davidxl wrote:
> 
> RestrictedToHinted = (OnlyHint || RestrictedInlinetoHinted);
This is not equivalent. The expected behavior when --inline-restrict-to-hint=false is to disable this even when the OnlyHint param is true. This is documented above.


http://reviews.llvm.org/D20603





More information about the llvm-commits mailing list