[llvm-branch-commits] [llvm-branch] r228561 - Merging r228525:
Hans Wennborg
hans at hanshq.net
Sun Feb 8 19:35:36 PST 2015
Author: hans
Date: Sun Feb 8 21:35:35 2015
New Revision: 228561
URL: http://llvm.org/viewvc/llvm-project?rev=228561&view=rev
Log:
Merging r228525:
------------------------------------------------------------------------
r228525 | bsteinbr | 2015-02-08 09:07:14 -0800 (Sun, 08 Feb 2015) | 14 lines
Correctly combine alias.scope metadata by a union instead of intersecting
Summary:
The alias.scope metadata represents sets of things an instruction might
alias with. When generically combining the metadata from two
instructions the result must be the union of the original sets, because
the new instruction might alias with anything any of the original
instructions aliased with.
Reviewers: hfinkel
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D7490
------------------------------------------------------------------------
Added:
llvm/branches/release_36/test/Transforms/Util/combine-alias-scope-metadata.ll
- copied unchanged from r228525, llvm/trunk/test/Transforms/Util/combine-alias-scope-metadata.ll
Modified:
llvm/branches/release_36/ (props changed)
llvm/branches/release_36/include/llvm/IR/Metadata.h
llvm/branches/release_36/lib/Analysis/TypeBasedAliasAnalysis.cpp
llvm/branches/release_36/lib/IR/Metadata.cpp
llvm/branches/release_36/lib/Transforms/Utils/Local.cpp
llvm/branches/release_36/lib/Transforms/Vectorize/SLPVectorizer.cpp
Propchange: llvm/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 8 21:35:35 2015
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226664,226708,226711,226755,226809,227005,227085,227250,227260-227261,227290,227294,227299,227319,227339,227491,227584,227603,227628,227670,227809,227815,227903,227934,227972,227983,228049,228129,228168,228331,228411,228444,228490,228500,228507,228518
+/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226664,226708,226711,226755,226809,227005,227085,227250,227260-227261,227290,227294,227299,227319,227339,227491,227584,227603,227628,227670,227809,227815,227903,227934,227972,227983,228049,228129,228168,228331,228411,228444,228490,228500,228507,228518,228525
Modified: llvm/branches/release_36/include/llvm/IR/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/include/llvm/IR/Metadata.h?rev=228561&r1=228560&r2=228561&view=diff
==============================================================================
--- llvm/branches/release_36/include/llvm/IR/Metadata.h (original)
+++ llvm/branches/release_36/include/llvm/IR/Metadata.h Sun Feb 8 21:35:35 2015
@@ -693,6 +693,7 @@ public:
static AAMDNodes getMostGenericAA(const AAMDNodes &A, const AAMDNodes &B);
static MDNode *getMostGenericFPMath(MDNode *A, MDNode *B);
static MDNode *getMostGenericRange(MDNode *A, MDNode *B);
+ static MDNode *getMostGenericAliasScope(MDNode *A, MDNode *B);
};
/// \brief Uniquable metadata node.
Modified: llvm/branches/release_36/lib/Analysis/TypeBasedAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/Analysis/TypeBasedAliasAnalysis.cpp?rev=228561&r1=228560&r2=228561&view=diff
==============================================================================
--- llvm/branches/release_36/lib/Analysis/TypeBasedAliasAnalysis.cpp (original)
+++ llvm/branches/release_36/lib/Analysis/TypeBasedAliasAnalysis.cpp Sun Feb 8 21:35:35 2015
@@ -623,8 +623,8 @@ void Instruction::getAAMetadata(AAMDNode
N.TBAA = getMetadata(LLVMContext::MD_tbaa);
if (Merge)
- N.Scope =
- MDNode::intersect(N.Scope, getMetadata(LLVMContext::MD_alias_scope));
+ N.Scope = MDNode::getMostGenericAliasScope(
+ N.Scope, getMetadata(LLVMContext::MD_alias_scope));
else
N.Scope = getMetadata(LLVMContext::MD_alias_scope);
Modified: llvm/branches/release_36/lib/IR/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/IR/Metadata.cpp?rev=228561&r1=228560&r2=228561&view=diff
==============================================================================
--- llvm/branches/release_36/lib/IR/Metadata.cpp (original)
+++ llvm/branches/release_36/lib/IR/Metadata.cpp Sun Feb 8 21:35:35 2015
@@ -826,6 +826,28 @@ MDNode *MDNode::intersect(MDNode *A, MDN
return getOrSelfReference(A->getContext(), MDs);
}
+MDNode *MDNode::getMostGenericAliasScope(MDNode *A, MDNode *B) {
+ if (!A || !B)
+ return nullptr;
+
+ SmallVector<Metadata *, 4> MDs(B->op_begin(), B->op_end());
+ for (unsigned i = 0, ie = A->getNumOperands(); i != ie; ++i) {
+ Metadata *MD = A->getOperand(i);
+ bool insert = true;
+ for (unsigned j = 0, je = B->getNumOperands(); j != je; ++j)
+ if (MD == B->getOperand(j)) {
+ insert = false;
+ break;
+ }
+ if (insert)
+ MDs.push_back(MD);
+ }
+
+ // FIXME: This preserves long-standing behaviour, but is it really the right
+ // behaviour? Or was that an unintended side-effect of node uniquing?
+ return getOrSelfReference(A->getContext(), MDs);
+}
+
MDNode *MDNode::getMostGenericFPMath(MDNode *A, MDNode *B) {
if (!A || !B)
return nullptr;
Modified: llvm/branches/release_36/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/Transforms/Utils/Local.cpp?rev=228561&r1=228560&r2=228561&view=diff
==============================================================================
--- llvm/branches/release_36/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/branches/release_36/lib/Transforms/Utils/Local.cpp Sun Feb 8 21:35:35 2015
@@ -1328,6 +1328,8 @@ void llvm::combineMetadata(Instruction *
K->setMetadata(Kind, MDNode::getMostGenericTBAA(JMD, KMD));
break;
case LLVMContext::MD_alias_scope:
+ K->setMetadata(Kind, MDNode::getMostGenericAliasScope(JMD, KMD));
+ break;
case LLVMContext::MD_noalias:
K->setMetadata(Kind, MDNode::intersect(JMD, KMD));
break;
Modified: llvm/branches/release_36/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=228561&r1=228560&r2=228561&view=diff
==============================================================================
--- llvm/branches/release_36/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/branches/release_36/lib/Transforms/Vectorize/SLPVectorizer.cpp Sun Feb 8 21:35:35 2015
@@ -208,6 +208,8 @@ static Instruction *propagateMetadata(In
MD = MDNode::getMostGenericTBAA(MD, IMD);
break;
case LLVMContext::MD_alias_scope:
+ MD = MDNode::getMostGenericAliasScope(MD, IMD);
+ break;
case LLVMContext::MD_noalias:
MD = MDNode::intersect(MD, IMD);
break;
More information about the llvm-branch-commits
mailing list