Optimizing of explicit temporary storage
Daniel Berlin
dberlin@dberlin.org
Wed Oct 13 13:22:00 GMT 2004
>>
>> I believe LLVM actually does all kinds of promotion that ends up removing
>> malloc calls. Maybe i'm just misremembering.
>
> Yes, LLVM deletes dead malloc calls and does other things as well. The C
> spec defines the behavior of malloc/free, and from this description I
> believe that it is safe to do this (e.g. C99 second 7.20.3). Note,
> however, that Mark's point above about calling sbrk is beyond the
> standard: conformant programs can't know anything about sbrk.
>
> Assuming standards compliant programs, this can still cause changes in
> observable behavior. In particular, something like this:
>
> malloc(HEAPSIZE-100); // dead
> P = malloc(1000); // not dead
> *P = x;
>> Chris, am i on crack?
>
> I don't know Dan, it's hard for me to say, are you? :-)
:)
Also, isn't your thesis on automatic conversion of programs to use pool
allocation?
Won't that change malloc->pool_alloc?
Or is this something you didn't plan on making the default in LLVM?
More information about the Gcc
mailing list