[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:13:16 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:

It isn't the size of the type that changed, it is the kind of the pointer that changes. This starts as a user pointer, and then the result of the atomic call is being stored into a pointer to temporary stack memory to bitcast it. We could perhaps solve this better semantically in several ways, such as defining atomics with arbitrary FCA in LangRef or defining an arbitrary in-register cast function (https://github.com/llvm/llvm-project/pull/186835), but both would be far out of scope for this PR.

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


More information about the libcxx-commits mailing list