This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimizing of explicit temporary storage



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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]