summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorIvan A. Kosarev <ikosarev@accesssoftek.com>2017-10-02 11:10:04 +0000
committerIvan A. Kosarev <ikosarev@accesssoftek.com>2017-10-02 11:10:04 +0000
commit80dc32ec8be97d83ab183c40d08288f650ea1d0f (patch)
tree33ca9d6ec214347eb12ff6f07a2296686f7aeae2 /lib/CodeGen/CGExpr.cpp
parentc6e3259e7046af28706e8c7477bc522875d15956 (diff)
[CodeGen] Have a special function to get TBAA info for may-alias accesses
This is part of D37826 reworked to be a separate patch to simplify review. Differential Revision: https://reviews.llvm.org/D38408 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index b37036659c..ba970b9bde 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -1522,7 +1522,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
if (TBAAAccessType) {
bool MayAlias = BaseInfo.getMayAlias();
llvm::MDNode *TBAA = MayAlias
- ? CGM.getTBAATypeInfo(getContext().CharTy)
+ ? CGM.getTBAAMayAliasTypeInfo()
: CGM.getTBAAStructTagInfo(TBAABaseType, TBAAAccessType, TBAAOffset);
if (TBAA)
CGM.DecorateInstructionWithTBAA(Load, TBAA, MayAlias);
@@ -1613,7 +1613,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
if (TBAAAccessType) {
bool MayAlias = BaseInfo.getMayAlias();
llvm::MDNode *TBAA = MayAlias
- ? CGM.getTBAATypeInfo(getContext().CharTy)
+ ? CGM.getTBAAMayAliasTypeInfo()
: CGM.getTBAAStructTagInfo(TBAABaseType, TBAAAccessType, TBAAOffset);
if (TBAA)
CGM.DecorateInstructionWithTBAA(Store, TBAA, MayAlias);
@@ -3724,11 +3724,8 @@ LValue CodeGenFunction::EmitLValueForField(LValue base,
// Loading the reference will disable path-aware TBAA.
TBAAPath = false;
if (CGM.shouldUseTBAA()) {
- llvm::MDNode *tbaa;
- if (mayAlias)
- tbaa = CGM.getTBAATypeInfo(getContext().CharTy);
- else
- tbaa = CGM.getTBAATypeInfo(type);
+ llvm::MDNode *tbaa = mayAlias ? CGM.getTBAAMayAliasTypeInfo() :
+ CGM.getTBAATypeInfo(type);
if (tbaa)
CGM.DecorateInstructionWithTBAA(load, tbaa);
}
@@ -3780,7 +3777,7 @@ LValue CodeGenFunction::EmitLValueForField(LValue base,
// FIXME: this should get propagated down through anonymous structs
// and unions.
if (mayAlias && LV.getTBAAAccessType())
- LV.setTBAAAccessType(CGM.getTBAATypeInfo(getContext().CharTy));
+ LV.setTBAAAccessType(CGM.getTBAAMayAliasTypeInfo());
return LV;
}