[PATCH] D38793: [CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info
Ivan A. Kosarev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 11 03:12:00 PDT 2017
kosarev created this revision.
kosarev added a project: clang.
Repository:
rL LLVM
https://reviews.llvm.org/D38793
Files:
CodeGen/CGExpr.cpp
CodeGen/CodeGenFunction.h
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,
Index: CodeGen/CGExpr.cpp
===================================================================
--- CodeGen/CGExpr.cpp
+++ 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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38793.118578.patch
Type: text/x-patch
Size: 2125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171011/8395e2db/attachment.bin>
More information about the cfe-commits
mailing list