summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorIvan A. Kosarev <ikosarev@accesssoftek.com>2017-10-13 16:58:30 +0000
committerIvan A. Kosarev <ikosarev@accesssoftek.com>2017-10-13 16:58:30 +0000
commit78f486d1366394e23862d47199dc7c1321ad7f75 (patch)
treec5207a513d6c0fea22a42ccd9a1f24981d8b0e21 /clang/lib/CodeGen/CGExpr.cpp
parent65fa869c233fef855606cbbe90d3ede44b5bb8cf (diff)
downloadbcm5719-llvm-78f486d1366394e23862d47199dc7c1321ad7f75.tar.gz
bcm5719-llvm-78f486d1366394e23862d47199dc7c1321ad7f75.zip
[CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base info
This patch should not bring in any functional changes. Differential Revision: https://reviews.llvm.org/D38794 llvm-svn: 315708
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 2e609deabfe..a936211a05b 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2151,12 +2151,10 @@ Address CodeGenFunction::EmitLoadOfReference(Address Addr,
const ReferenceType *RefTy,
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));
+ BaseInfo, TBAAInfo,
+ /* forPointeeType= */ true));
}
LValue CodeGenFunction::EmitLoadOfReferenceLValue(Address RefAddr,
@@ -2171,12 +2169,9 @@ Address CodeGenFunction::EmitLoadOfPointer(Address Ptr,
const PointerType *PtrTy,
LValueBaseInfo *BaseInfo,
TBAAAccessInfo *TBAAInfo) {
- if (TBAAInfo)
- *TBAAInfo = CGM.getTBAAAccessInfo(PtrTy->getPointeeType());
-
llvm::Value *Addr = Builder.CreateLoad(Ptr);
return Address(Addr, getNaturalTypeAlignment(PtrTy->getPointeeType(),
- BaseInfo,
+ BaseInfo, TBAAInfo,
/*forPointeeType=*/true));
}
@@ -2315,8 +2310,10 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
// FIXME: Eventually we will want to emit vector element references.
// Should we be using the alignment of the constant pointer we emitted?
- CharUnits Alignment = getNaturalTypeAlignment(E->getType(), nullptr,
- /*pointee*/ true);
+ CharUnits Alignment = getNaturalTypeAlignment(E->getType(),
+ /* BaseInfo= */ nullptr,
+ /* TBAAInfo= */ nullptr,
+ /* forPointeeType= */ true);
return MakeAddrLValue(Address(Val, Alignment), T, AlignmentSource::Decl);
}
@@ -3729,7 +3726,8 @@ LValue CodeGenFunction::EmitLValueForField(LValue base,
type = refType->getPointeeType();
CharUnits alignment =
- getNaturalTypeAlignment(type, &FieldBaseInfo, /*pointee*/ true);
+ getNaturalTypeAlignment(type, &FieldBaseInfo, /* TBAAInfo= */ nullptr,
+ /* forPointeeType= */ true);
FieldBaseInfo.setMayAlias(false);
addr = Address(load, alignment);
OpenPOWER on IntegriCloud