Skip to content

Commit 9029564

Browse files
author
Ivan A. Kosarev
committedOct 13, 2017
[CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info
This patch should not bring in any functional changes. Differential Revision: https://reviews.llvm.org/D38791 llvm-svn: 315704
1 parent 8d810fe commit 9029564

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
 

‎clang/lib/CodeGen/CGExpr.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -2165,7 +2165,11 @@ LValue CodeGenFunction::EmitLoadOfReferenceLValue(Address RefAddr,
21652165

21662166
Address CodeGenFunction::EmitLoadOfPointer(Address Ptr,
21672167
const PointerType *PtrTy,
2168-
LValueBaseInfo *BaseInfo) {
2168+
LValueBaseInfo *BaseInfo,
2169+
TBAAAccessInfo *TBAAInfo) {
2170+
if (TBAAInfo)
2171+
*TBAAInfo = CGM.getTBAAAccessInfo(PtrTy->getPointeeType());
2172+
21692173
llvm::Value *Addr = Builder.CreateLoad(Ptr);
21702174
return Address(Addr, getNaturalTypeAlignment(PtrTy->getPointeeType(),
21712175
BaseInfo,
@@ -2175,9 +2179,9 @@ Address CodeGenFunction::EmitLoadOfPointer(Address Ptr,
21752179
LValue CodeGenFunction::EmitLoadOfPointerLValue(Address PtrAddr,
21762180
const PointerType *PtrTy) {
21772181
LValueBaseInfo BaseInfo;
2178-
Address Addr = EmitLoadOfPointer(PtrAddr, PtrTy, &BaseInfo);
2179-
return MakeAddrLValue(Addr, PtrTy->getPointeeType(), BaseInfo,
2180-
CGM.getTBAAAccessInfo(PtrTy->getPointeeType()));
2182+
TBAAAccessInfo TBAAInfo;
2183+
Address Addr = EmitLoadOfPointer(PtrAddr, PtrTy, &BaseInfo, &TBAAInfo);
2184+
return MakeAddrLValue(Addr, PtrTy->getPointeeType(), BaseInfo, TBAAInfo);
21812185
}
21822186

21832187
static LValue EmitGlobalVarDeclLValue(CodeGenFunction &CGF,

‎clang/lib/CodeGen/CodeGenFunction.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,8 @@ class CodeGenFunction : public CodeGenTypeCache {
19481948
LValue EmitLoadOfReferenceLValue(Address Ref, const ReferenceType *RefTy);
19491949

19501950
Address EmitLoadOfPointer(Address Ptr, const PointerType *PtrTy,
1951-
LValueBaseInfo *BaseInfo = nullptr);
1951+
LValueBaseInfo *BaseInfo = nullptr,
1952+
TBAAAccessInfo *TBAAInfo = nullptr);
19521953
LValue EmitLoadOfPointerLValue(Address Ptr, const PointerType *PtrTy);
19531954

19541955
/// CreateTempAlloca - This creates an alloca and inserts it into the entry

0 commit comments

Comments
 (0)
Please sign in to comment.