[PATCH] D14148: [GlobalOpt] Demote globals to locals more aggressively

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 11:00:35 PDT 2015



> On 2015-Oct-28, at 09:45, Manman Ren <manman.ren at gmail.com> wrote:
> 
> manmanren added a subscriber: manmanren.
> manmanren added a comment.
> 
> Thanks for working on this!

+1, I think it would be great to generalize this.  Just one idea
below...

> Do you have any performance number?
> 
> 
> ================
> Comment at: lib/Transforms/IPO/GlobalOpt.cpp:100
> @@ -90,2 +99,3 @@
>     SmallSet<const Comdat *, 8> NotDiscardableComdats;
> +    DenseMap<const Function *, bool> FunctionsKnownNotToRecurse;
>   };
> ----------------
> Comments will be great.
> It is a little strange to name it "FunctionsKnownNotToRecurse" with a bool that tells if the function will recurse.

I imagine this property would be useful in other optimizations as well.

What about adding an LLVM attribute "norecurse" or some such?
Assuming we can solve the indirect calls problem conservatively
(e.g., should we be worried about function pointers escaping via
atexit()?), this could be fairly easily propagated by an SCC pass.


More information about the llvm-commits mailing list