[PATCH] A new HeapToStack allocation promotion pass

Chris Lattner clattner at apple.com
Mon Oct 7 07:31:25 PDT 2013


On Oct 5, 2013, at 3:29 PM, Hal Finkel <hfinkel at anl.gov> wrote:
>>> Yep, Nick also pointed this out; thanks for confirming!
>> 
>> No problem. Here's one with longjmp().
> 
> It seems in general that we have two situations to deal with:
> 
> 1. If the pointer (or some alias) is captured, and we (or some function we call) has some indefinite loop (including the use operating-system-assisted synchronization primitives), then some other thread might free the memory. Maybe I could call safe functions in this regard 'non-blocking'?

Have you considered changing your approach, to base it on nocapture instead?

>From one of your emails, you mentioned that you're mostly interested in the template case where the callee graph is pretty well known.  Given that, you should be able to turn this into a simple function pass that doesn't require interprocedural knowledge: only allow it to be passed to no-capture calls.  This is a very simple form of escape analysis.

-Chris



More information about the llvm-commits mailing list