[PATCH] A new HeapToStack allocation promotion pass
s at pahtak.org
Sat Oct 5 13:37:44 PDT 2013
On Oct 5, 2013, at 4:30 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> ----- Stephen Checkoway <s at pahtak.org> wrote:
>> In addition to not working with standard library functions that except things in the heap (malloc_usable_size, mallinfo) as I mentioned previously, it also doesn't work if the allocated memory escapes via exceptions (I think someone else mentioned that previously).
> Yep, Nick also pointed this out; thanks for confirming!
No problem. Here's one with longjmp().
static void *q;
static jmp_buf env;
static __attribute__((noinline)) void bar(int a)
if (a > 1)
static __attribute__((noinline)) void foo(int a)
void *p = malloc(10);
q = p;
int main(int argc, char *argv)
if (argc > 1)
> I'll work up a more conservative version and post it soon.
Great! This seems like a useful optimization.
More information about the llvm-commits