Revert r191586 and r191695. They cause crashes when building with
-relaxed-aliasing. llvm-svn: 191725
This commit is contained in:
@@ -50,11 +50,16 @@ llvm::MDNode *CodeGenTBAA::getRoot() {
|
||||
return Root;
|
||||
}
|
||||
|
||||
// For both scalar TBAA and struct-path aware TBAA, the scalar type has the
|
||||
// same format: name, parent node, and offset.
|
||||
// For struct-path aware TBAA, the scalar type has the same format as
|
||||
// the struct type: name, offset, pointer to another node in the type DAG.
|
||||
// For scalar TBAA, the scalar type is the same as the scalar tag:
|
||||
// name and a parent pointer.
|
||||
llvm::MDNode *CodeGenTBAA::createTBAAScalarType(StringRef Name,
|
||||
llvm::MDNode *Parent) {
|
||||
return MDHelper.createTBAAScalarTypeNode(Name, Parent);
|
||||
if (CodeGenOpts.StructPathTBAA)
|
||||
return MDHelper.createTBAAScalarTypeNode(Name, Parent);
|
||||
else
|
||||
return MDHelper.createTBAANode(Name, Parent);
|
||||
}
|
||||
|
||||
llvm::MDNode *CodeGenTBAA::getChar() {
|
||||
@@ -206,7 +211,8 @@ CodeGenTBAA::CollectFields(uint64_t BaseOffset,
|
||||
uint64_t Offset = BaseOffset;
|
||||
uint64_t Size = Context.getTypeSizeInChars(QTy).getQuantity();
|
||||
llvm::MDNode *TBAAInfo = MayAlias ? getChar() : getTBAAInfo(QTy);
|
||||
llvm::MDNode *TBAATag = getTBAAScalarTagInfo(TBAAInfo);
|
||||
llvm::MDNode *TBAATag = CodeGenOpts.StructPathTBAA ?
|
||||
getTBAAScalarTagInfo(TBAAInfo) : TBAAInfo;
|
||||
Fields.push_back(llvm::MDBuilder::TBAAStructField(Offset, Size, TBAATag));
|
||||
return true;
|
||||
}
|
||||
@@ -287,12 +293,11 @@ CodeGenTBAA::getTBAAStructTypeInfo(QualType QTy) {
|
||||
return StructMetadataCache[Ty] = NULL;
|
||||
}
|
||||
|
||||
/// Return a TBAA tag node for both scalar TBAA and struct-path aware TBAA.
|
||||
llvm::MDNode *
|
||||
CodeGenTBAA::getTBAAStructTagInfo(QualType BaseQTy, llvm::MDNode *AccessNode,
|
||||
uint64_t Offset) {
|
||||
if (!CodeGenOpts.StructPathTBAA)
|
||||
return getTBAAScalarTagInfo(AccessNode);
|
||||
return AccessNode;
|
||||
|
||||
const Type *BTy = Context.getCanonicalType(BaseQTy).getTypePtr();
|
||||
TBAAPathTag PathTag = TBAAPathTag(BTy, AccessNode, Offset);
|
||||
|
||||
Reference in New Issue
Block a user