[clang] e487ddc - [clang][OpaquePtr] Use proper Address constructor in AtomicInfo::getAtomicAddress()

Arthur Eubanks via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 10 18:34:59 PST 2022


Author: Arthur Eubanks
Date: 2022-02-10T18:29:51-08:00
New Revision: e487ddc5c6d38522b7a2cf2c686539aa74432f1e

URL: https://github.com/llvm/llvm-project/commit/e487ddc5c6d38522b7a2cf2c686539aa74432f1e
DIFF: https://github.com/llvm/llvm-project/commit/e487ddc5c6d38522b7a2cf2c686539aa74432f1e.diff

LOG: [clang][OpaquePtr] Use proper Address constructor in AtomicInfo::getAtomicAddress()

Added: 
    

Modified: 
    clang/lib/CodeGen/CGAtomic.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp
index 10569ae2c3f91..e17fd156229cd 100644
--- a/clang/lib/CodeGen/CGAtomic.cpp
+++ b/clang/lib/CodeGen/CGAtomic.cpp
@@ -149,7 +149,16 @@ namespace {
       return LVal.getExtVectorPointer();
     }
     Address getAtomicAddress() const {
-      return Address(getAtomicPointer(), getAtomicAlignment());
+      llvm::Type *ElTy;
+      if (LVal.isSimple())
+        ElTy = LVal.getAddress(CGF).getElementType();
+      else if (LVal.isBitField())
+        ElTy = LVal.getBitFieldAddress().getElementType();
+      else if (LVal.isVectorElt())
+        ElTy = LVal.getVectorAddress().getElementType();
+      else
+        ElTy = LVal.getExtVectorAddress().getElementType();
+      return Address(getAtomicPointer(), ElTy, getAtomicAlignment());
     }
 
     Address getAtomicAddressAsAtomicIntPointer() const {


        


More information about the cfe-commits mailing list