[clang] Use unaligned atomic load and stores on x86 (PR #79191)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 23 11:01:44 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-codegen

Author: AtariDreams (AtariDreams)

<details>
<summary>Changes</summary>

The backend supports it now, so we can use it.

---
Full diff: https://github.com/llvm/llvm-project/pull/79191.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGObjC.cpp (+3-2) 


``````````diff
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 03fc0ec7ff54e1c..debfc84f49e4848 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -846,8 +846,9 @@ static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar,
 /// accesses.  They don't have to be fast, just faster than a function
 /// call and a mutex.
 static bool hasUnalignedAtomics(llvm::Triple::ArchType arch) {
-  // FIXME: Allow unaligned atomic load/store on x86.  (It is not
-  // currently supported by the backend.)
+  // x86 is the only one so far that we know support this as of now
+  if (arch == llvm::Triple::x86 || arch == llvm::Triple::x86_64)
+    return true;
   return false;
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list