[PATCH] D108123: [MemoryBuiltins] Mark user defined delete as nobuiltin

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 23 12:21:04 PDT 2021


efriedma added a comment.

> If the programmer provides operators new and delete in some translation unit other than the one being compiled, without LTO, the definitions are not available in the current translation unit.

I don't think there's a correctness issue in the case where the new and delete operators are defined in some other translation unit.  The C++ standard says all the optimizations we want to do on new/delete expressions are legal whether or not the user replaces the operators .  See [expr.new] (http://eel.is/c++draft/expr.new#12) .  The weird issues this patch is trying to fix only show up when the definitions are available.

> Adding options such as -fno-builtin-operator-new and -fno-builtin-operator-delete sounds like the best solution to me.

A flag that disables the optimizations allowed by [expr.new] might be nice to have, I guess.  But it wouldn't really fix anything.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108123/new/

https://reviews.llvm.org/D108123



More information about the llvm-commits mailing list