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 | 9c61abafb856367492d45c0ec2fb858d5014dbc5 (patch) | |
tree | 5355772ee91e6ae30d8073344496e2bac580fee5 /lib/CodeGen/CodeGenModule.cpp | |
parent | c64aa1bff66eaa08d18f0704502ac0b45610f218 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 86153cc7d9..a16f350f9d 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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( |