[PATCH] Merge metadata in the AliasSetTracker (and refactor merging)
hfinkel at anl.gov
hfinkel at anl.gov
Thu Apr 30 09:13:40 PDT 2015
Hi dberlin, chandlerc,
Refactor how AA metadata merging is done, and allow the AliasSetTracker to merge non-equal metadata when merging access sets instead of just dropping all AA metadata when unequal.
I no longer have an in-tree test case for this change, so I'll need to try making one.
http://reviews.llvm.org/D9396
Files:
include/llvm/Analysis/AliasSetTracker.h
include/llvm/IR/Metadata.h
lib/Analysis/TypeBasedAliasAnalysis.cpp
Index: include/llvm/Analysis/AliasSetTracker.h
===================================================================
--- include/llvm/Analysis/AliasSetTracker.h
+++ include/llvm/Analysis/AliasSetTracker.h
@@ -64,8 +64,7 @@
// We don't have a AAInfo yet. Set it to NewAAInfo.
AAInfo = NewAAInfo;
else if (AAInfo != NewAAInfo)
- // NewAAInfo conflicts with AAInfo.
- AAInfo = DenseMapInfo<AAMDNodes>::getTombstoneKey();
+ AAInfo.merge(NewAAInfo);
}
uint64_t getSize() const { return Size; }
Index: include/llvm/IR/Metadata.h
===================================================================
--- include/llvm/IR/Metadata.h
+++ include/llvm/IR/Metadata.h
@@ -546,6 +546,8 @@
explicit operator bool() const { return TBAA || Scope || NoAlias; }
+ void merge(const AAMDNodes &N);
+
/// \brief The tag for type-based alias analysis.
MDNode *TBAA;
Index: lib/Analysis/TypeBasedAliasAnalysis.cpp
===================================================================
--- lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -623,23 +623,22 @@
return MDNode::get(A->getContext(), Ops);
}
+void AAMDNodes::merge(const AAMDNodes &N) {
+ TBAA = MDNode::getMostGenericTBAA(TBAA, N.TBAA);
+ Scope = MDNode::getMostGenericAliasScope(Scope, N.Scope);
+ NoAlias = MDNode::intersect(NoAlias, N.NoAlias);
+}
+
void Instruction::getAAMetadata(AAMDNodes &N, bool Merge) const {
- if (Merge)
- N.TBAA =
- MDNode::getMostGenericTBAA(N.TBAA, getMetadata(LLVMContext::MD_tbaa));
- else
- N.TBAA = getMetadata(LLVMContext::MD_tbaa);
-
- if (Merge)
- N.Scope = MDNode::getMostGenericAliasScope(
- N.Scope, getMetadata(LLVMContext::MD_alias_scope));
- else
- N.Scope = getMetadata(LLVMContext::MD_alias_scope);
-
- if (Merge)
- N.NoAlias =
- MDNode::intersect(N.NoAlias, getMetadata(LLVMContext::MD_noalias));
- else
- N.NoAlias = getMetadata(LLVMContext::MD_noalias);
+ if (Merge) {
+ AAMDNodes M;
+ getAAMetadata(M);
+ N.merge(M);
+ return;
+ }
+
+ N.TBAA = getMetadata(LLVMContext::MD_tbaa);
+ N.Scope = getMetadata(LLVMContext::MD_alias_scope);
+ N.NoAlias = getMetadata(LLVMContext::MD_noalias);
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9396.24735.patch
Type: text/x-patch
Size: 2253 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150430/453706cc/attachment.bin>
More information about the llvm-commits
mailing list