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);
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);
// 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);
}
// 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;
}
return TBAA->getTBAAStructTagInfo(BaseTy, AccessN, O);
}
+llvm::MDNode *CodeGenModule::getTBAAMayAliasTypeInfo() {
+ if (!TBAA)
+ return nullptr;
+ 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.
llvm::MDNode *getTBAAStructTagInfo(QualType BaseTy, llvm::MDNode *AccessN,
uint64_t O);
+ /// getTBAAMayAliasTypeInfo - Get TBAA information that represents
+ /// may-alias accesses.
+ llvm::MDNode *getTBAAMayAliasTypeInfo();
+
bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor);
bool isPaddedAtomicType(QualType type);
/// Get the scalar tag MDNode for a given scalar type.
llvm::MDNode *getTBAAScalarTagInfo(llvm::MDNode *AccessNode);
+
+ /// getMayAliasTypeInfo - Get TBAA information that represents may-alias
+ /// accesses.
+ llvm::MDNode *getMayAliasTypeInfo();
};
} // end namespace CodeGen