]> granicus.if.org Git - clang/commitdiff
[CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info
authorIvan A. Kosarev <ikosarev@accesssoftek.com>
Fri, 13 Oct 2017 16:50:50 +0000 (16:50 +0000)
committerIvan A. Kosarev <ikosarev@accesssoftek.com>
Fri, 13 Oct 2017 16:50:50 +0000 (16:50 +0000)
This patch should not bring in any functional changes.

Differential Revision: https://reviews.llvm.org/D38793

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315705 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h

index bb2e8550bd24a24676ffb9d7e5ebc3d47be25137..2e609deabfe7b5d4af9019a565490c4e0be8730a 100644 (file)
@@ -2149,7 +2149,11 @@ static LValue EmitThreadPrivateVarDeclLValue(
 
 Address CodeGenFunction::EmitLoadOfReference(Address Addr,
                                              const ReferenceType *RefTy,
-                                             LValueBaseInfo *BaseInfo) {
+                                             LValueBaseInfo *BaseInfo,
+                                             TBAAAccessInfo *TBAAInfo) {
+  if (TBAAInfo)
+    *TBAAInfo = CGM.getTBAAAccessInfo(RefTy->getPointeeType());
+
   llvm::Value *Ptr = Builder.CreateLoad(Addr);
   return Address(Ptr, getNaturalTypeAlignment(RefTy->getPointeeType(),
                                               BaseInfo, /*forPointee*/ true));
@@ -2158,9 +2162,9 @@ Address CodeGenFunction::EmitLoadOfReference(Address Addr,
 LValue CodeGenFunction::EmitLoadOfReferenceLValue(Address RefAddr,
                                                   const ReferenceType *RefTy) {
   LValueBaseInfo BaseInfo;
-  Address Addr = EmitLoadOfReference(RefAddr, RefTy, &BaseInfo);
-  return MakeAddrLValue(Addr, RefTy->getPointeeType(), BaseInfo,
-                        CGM.getTBAAAccessInfo(RefTy->getPointeeType()));
+  TBAAAccessInfo TBAAInfo;
+  Address Addr = EmitLoadOfReference(RefAddr, RefTy, &BaseInfo, &TBAAInfo);
+  return MakeAddrLValue(Addr, RefTy->getPointeeType(), BaseInfo, TBAAInfo);
 }
 
 Address CodeGenFunction::EmitLoadOfPointer(Address Ptr,
index 2b8720a5dee69bcf13858e50cc8f481bb8de074b..1f046faaa741885df2ea239f7bbaf0bfc5d1573a 100644 (file)
@@ -1944,7 +1944,8 @@ public:
                                            LValueBaseInfo *BaseInfo = nullptr);
 
   Address EmitLoadOfReference(Address Ref, const ReferenceType *RefTy,
-                              LValueBaseInfo *BaseInfo = nullptr);
+                              LValueBaseInfo *BaseInfo = nullptr,
+                              TBAAAccessInfo *TBAAInfo = nullptr);
   LValue EmitLoadOfReferenceLValue(Address Ref, const ReferenceType *RefTy);
 
   Address EmitLoadOfPointer(Address Ptr, const PointerType *PtrTy,