[llvm-dev] Bug 50482 - optimizer malloc

Dennis Luehring via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 17 05:43:19 PST 2021


Am 17.11.2021 um 14:08 schrieb Joerg Sonnenberger via llvm-dev:
> On Tue, Nov 16, 2021 at 09:18:09PM -0600, Victor Yodaiken via llvm-dev wrote:
> > What exactly is being optimized here? Does program performance improve?
>
> Consider a program that allocates memory, computes something in it and
> frees the memory. If the computation can be done at compile time and all
> stores are removed by Dead Store Elimination and the address doesn't
> otherwise leak, the program can be reduced to malloc + free (or
> new+delete). That makes it very beneficial to be able to remove the
> allocation pair as well.


isn't that something clang does already very good?


see clang/gcc comparison: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58483


clang removed the new/deletes completely around the compile time calculation




More information about the llvm-dev mailing list