Index: CodeGen/CGExpr.cpp =================================================================== --- CodeGen/CGExpr.cpp +++ CodeGen/CGExpr.cpp @@ -2149,7 +2149,11 @@ 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 @@ 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: CodeGen/CodeGenFunction.h =================================================================== --- CodeGen/CodeGenFunction.h +++ CodeGen/CodeGenFunction.h @@ -1944,7 +1944,8 @@ 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,