[all-commits] [llvm/llvm-project] 01c93f: [Clang] Mark new as inaccessiblememonly if sane (#...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Fri May 29 00:00:58 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 01c93f511b4b5f734ac420709266036497610014
https://github.com/llvm/llvm-project/commit/01c93f511b4b5f734ac420709266036497610014
Author: Nikita Popov <npopov at redhat.com>
Date: 2026-05-29 (Fri, 29 May 2026)
Changed paths:
M clang/lib/CodeGen/CGCall.cpp
M clang/test/CodeGenCXX/new_hot_cold.cpp
M clang/test/CodeGenCXX/operator-new.cpp
Log Message:
-----------
[Clang] Mark new as inaccessiblememonly if sane (#197199)
If `-fassume-sane-operator-new` (the default), assume that `operator
new` does not read or write accessible memory.
Currently, this assumption already exists due to special treatment in
BasicAA. I'd like to remove this special treatment (see
https://github.com/llvm/llvm-project/pull/197180), and instead rely only
on the `memory` attribute.
It's worth noting that this is consistent with GCC's interpretation of
the flag (where it is also enabled by default):
> [...] With -fassume-sane-operators-new-delete option GCC may assume
that calls to the replaceable global operators from new or delete
expressions or from __builtin_operator_new or __builtin_operator_delete
calls don’t read or modify any global variables or variables whose
address could escape to the operators (global state; except for errno
for the new and new[] operators). [...]
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list