diff options
author | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-05 11:05:43 +0000 |
---|---|---|
committer | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-05 11:05:43 +0000 |
commit | afc074cc4149d8e16230fc0870458ed455c5e3ba (patch) | |
tree | b5662b30e602ab0041638809dac208cd825007b4 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 6fa20cfea320bfcc45e7fa70a2ead481df8a4ce8 (diff) | |
download | bcm5719-llvm-afc074cc4149d8e16230fc0870458ed455c5e3ba.tar.gz bcm5719-llvm-afc074cc4149d8e16230fc0870458ed455c5e3ba.zip |
Revert r314977 "[CodeGen] Unify generation of scalar and struct-path TBAA tags"
D37826 has been mistakenly committed where it should be the patch from D38503.
Differential Revision: https://reviews.llvm.org/D38503
llvm-svn: 314978
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 86153cc7d92..a16f350f9d5 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -578,14 +578,10 @@ llvm::MDNode *CodeGenModule::getTBAATypeInfo(QualType QTy) { return TBAA->getTypeInfo(QTy); } -TBAAAccessInfo CodeGenModule::getTBAAAccessInfo(QualType AccessType) { - return TBAAAccessInfo(getTBAATypeInfo(AccessType)); -} - -TBAAAccessInfo CodeGenModule::getTBAAVTablePtrAccessInfo() { +llvm::MDNode *CodeGenModule::getTBAAInfoForVTablePtr() { if (!TBAA) - return TBAAAccessInfo(); - return TBAA->getVTablePtrAccessInfo(); + return nullptr; + return TBAA->getTBAAInfoForVTablePtr(); } llvm::MDNode *CodeGenModule::getTBAAStructInfo(QualType QTy) { @@ -594,28 +590,30 @@ llvm::MDNode *CodeGenModule::getTBAAStructInfo(QualType QTy) { return TBAA->getTBAAStructInfo(QTy); } -llvm::MDNode *CodeGenModule::getTBAABaseTypeInfo(QualType QTy) { +llvm::MDNode *CodeGenModule::getTBAAStructTagInfo(TBAAAccessInfo Info) { if (!TBAA) return nullptr; - return TBAA->getBaseTypeInfo(QTy); + return TBAA->getTBAAStructTagInfo(Info); } -llvm::MDNode *CodeGenModule::getTBAAAccessTagInfo(TBAAAccessInfo Info) { +llvm::MDNode *CodeGenModule::getTBAAMayAliasTypeInfo() { if (!TBAA) return nullptr; - return TBAA->getAccessTagInfo(Info); -} - -TBAAAccessInfo CodeGenModule::getTBAAMayAliasAccessInfo() { - if (!TBAA) - return TBAAAccessInfo(); - return TBAA->getMayAliasAccessInfo(); + return TBAA->getMayAliasTypeInfo(); } +/// Decorate the instruction with a TBAA tag. For both scalar TBAA +/// and struct-path aware TBAA, the tag has the same format: +/// base type, access type and offset. +/// When ConvertTypeToTag is true, we create a tag based on the scalar type. void CodeGenModule::DecorateInstructionWithTBAA(llvm::Instruction *Inst, - TBAAAccessInfo TBAAInfo) { - if (llvm::MDNode *Tag = getTBAAAccessTagInfo(TBAAInfo)) - Inst->setMetadata(llvm::LLVMContext::MD_tbaa, Tag); + llvm::MDNode *TBAAInfo, + bool ConvertTypeToTag) { + if (ConvertTypeToTag && TBAA) + Inst->setMetadata(llvm::LLVMContext::MD_tbaa, + TBAA->getTBAAScalarTagInfo(TBAAInfo)); + else + Inst->setMetadata(llvm::LLVMContext::MD_tbaa, TBAAInfo); } void CodeGenModule::DecorateInstructionWithInvariantGroup( |