Revert r191586 and r191695. They cause crashes when building with

-relaxed-aliasing.

llvm-svn: 191725
This commit is contained in:
Richard Smith
2013-10-01 02:20:23 +00:00
parent 6aada32dc4
commit e4aaac506c
12 changed files with 41 additions and 48 deletions

View File

@@ -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);