[libcxx-commits] [clang] [libcxxabi] [clang] respect Ty addrspace when making an alloca (PR #181390)

Jameson Nash via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 1 05:09:28 PDT 2026


================
@@ -298,11 +298,13 @@ namespace {
 }
 
 Address AtomicInfo::CreateTempAlloca() const {
-  Address TempAlloca = CGF.CreateMemTemp(
-      (LVal.isBitField() && ValueSizeInBits > AtomicSizeInBits) ? ValueTy
-                                                                : AtomicTy,
-      getAtomicAlignment(),
-      "atomic-temp");
+  // Remove addrspace info from the atomic pointer element when making the
----------------
vtjnash wrote:

The result of atomic functions is not qualified with the input pointer's element attributes when computing the output type. It is similar to what `auto` means here:

```
auto L = atomic_load(p);
```

In this example, the attributes do not transfer from `*p` to `&L` here, especially since `p` is heap memory and `L` is stack memory.

https://github.com/llvm/llvm-project/pull/181390


More information about the libcxx-commits mailing list