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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 19 13:02:56 PDT 2021


efriedma added a comment.

See also https://bugs.llvm.org/show_bug.cgi?id=41039 .

The edge cases involving target library functions are rarely relevant... most of the functions are part of the C library, and that's usually built with -fno-builtin/-ffreestanding.  But this is one of the cases where someone can define a "library" function in their code.

Basically, optimizations have to consistently make a decision here: is the function a builtin function, or is it something we can perform interprocedural optimizations on?  Once we start doing interprocedural optimizations, we're potentially breaking the original semantics of the function, and therefore any optimization that treats the function as a builtin will get weird results.

Just saying "any function with a definition isn't a target library function" probably produces a sane result in most cases. If we're going to do that, though, we should do it in TargetLibraryInfo (in TargetLibraryInfo::getLibFunc?), not in llvm::isFreeCall.

(-fno-builtin-delete tells the compiler that a C library function named "delete" shouldn't be treated as builtin.  But clang doesn't know of any such function, so -fno-builtin-delete doesn't do anything.  The delete operator is not named "delete".)


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

https://reviews.llvm.org/D108123



More information about the llvm-commits mailing list