diff options
| author | James Y Knight <jyknight@google.com> | 2024-07-22 14:20:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-22 14:20:25 -0400 |
| commit | 511e93b96ee74438cbd643cec63281aff0663933 (patch) | |
| tree | 3918f5661fefd65611266cfc3601d4736c0bd4a1 /lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp | |
| parent | 146fd7cd454d71afb94d5d7ad7a3dbd6f3344d04 (diff) | |
Handle constant "pointers" for `__atomic_always_lock_free`/`__atomic_is_lock_free`. (#99340)
The second argument passed to these builtins is used to validate whether
the object's alignment is sufficient for atomic operations of the given
size.
Currently, the builtins can be folded at compile time only when the
argument is 0/nullptr, or if the _type_ of the pointer guarantees
appropriate alignment.
This change allows the compiler to also evaluate non-null constant
pointers, which enables callers to check a specified alignment, instead
of only the type or an exact object. E.g.:
`__atomic_is_lock_free(sizeof(T), (void*)4)`
can be potentially evaluated to true at compile time, instead of
generating a libcall. This is also supported by GCC, and used by
libstdc++, and is also useful for libc++'s atomic_ref.
Also helps with (but doesn't fix) issue #75081.
This also fixes a crash bug, when the second argument was a non-pointer
implicitly convertible to a pointer (such as an array, or a function).
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp')
0 files changed, 0 insertions, 0 deletions
