This revision was automatically updated to reflect the committed changes. Closed by commit rL315705: [CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base⦠(authored by kosarev).
Changed prior to commit: https://reviews.llvm.org/D38793?vs=118578&id=118933#toc Repository: rL LLVM https://reviews.llvm.org/D38793 Files: cfe/trunk/lib/CodeGen/CGExpr.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h Index: cfe/trunk/lib/CodeGen/CGExpr.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGExpr.cpp +++ cfe/trunk/lib/CodeGen/CGExpr.cpp @@ -2149,18 +2149,22 @@ 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)); } 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: cfe/trunk/lib/CodeGen/CodeGenFunction.h =================================================================== --- cfe/trunk/lib/CodeGen/CodeGenFunction.h +++ cfe/trunk/lib/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,
Index: cfe/trunk/lib/CodeGen/CGExpr.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGExpr.cpp +++ cfe/trunk/lib/CodeGen/CGExpr.cpp @@ -2149,18 +2149,22 @@ 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)); } 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: cfe/trunk/lib/CodeGen/CodeGenFunction.h =================================================================== --- cfe/trunk/lib/CodeGen/CodeGenFunction.h +++ cfe/trunk/lib/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,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits