diff options
| author | Tobias Grosser <tobias@grosser.es> | 2017-08-22 21:58:48 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2017-08-22 21:58:48 +0000 |
| commit | 4a07bbe3f67c1f78da4522a1e9674ab89944653d (patch) | |
| tree | 73ba116de55b1a62413fbe427500f23808243ae1 /polly/lib/CodeGen/IRBuilder.cpp | |
| parent | e158f7c329b599dfb0b481f8ce25d520e940a3d7 (diff) | |
| download | bcm5719-llvm-4a07bbe3f67c1f78da4522a1e9674ab89944653d.tar.gz bcm5719-llvm-4a07bbe3f67c1f78da4522a1e9674ab89944653d.zip | |
[IRBuilder] Only emit alias scop metadata for arrays, but not scalars
Summary:
There is no need to emit alias metadata for scalars, as basicaa will easily
distinguish them from arrays. This reduces the size of the metadata we generate.
This is especially useful after we moved to -polly-position=before-vectorizer,
where a lot more scalar dependences are introduced, which increased the size of
the alias analysis metadata and made us commonly reach the limits after which
we do not emit alias metadata that have been introduced to prevent quadratic
growth of this alias metadata.
This improves 2mm performance from 1.5 seconds to 0.17 seconds.
Reviewers: Meinersbur, bollu, singam-sanjay
Reviewed By: Meinersbur
Subscribers: pollydev, llvm-commits
Tags: #polly
Differential Revision: https://reviews.llvm.org/D37028
llvm-svn: 311498
Diffstat (limited to 'polly/lib/CodeGen/IRBuilder.cpp')
| -rw-r--r-- | polly/lib/CodeGen/IRBuilder.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/polly/lib/CodeGen/IRBuilder.cpp b/polly/lib/CodeGen/IRBuilder.cpp index 1ad01a4a98b..be808851ca7 100644 --- a/polly/lib/CodeGen/IRBuilder.cpp +++ b/polly/lib/CodeGen/IRBuilder.cpp @@ -15,6 +15,7 @@ #include "polly/CodeGen/IRBuilder.h" #include "polly/ScopInfo.h" #include "polly/Support/ScopHelper.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/IR/Metadata.h" #include "llvm/Support/Debug.h" @@ -60,21 +61,28 @@ void ScopAnnotator::buildAliasScopes(Scop &S) { AliasScopeMap.clear(); OtherAliasScopeListMap.clear(); + // We are only interested in arrays, but no scalar references. Scalars should + // be handled easily by basicaa. + SmallVector<ScopArrayInfo *, 10> Arrays; + for (ScopArrayInfo *Array : S.arrays()) + if (Array->isArrayKind()) + Arrays.push_back(Array); + // The construction of alias scopes is quadratic in the number of arrays // involved. In case of too many arrays, skip the construction of alias // information to avoid quadratic increases in compile time and code size. - if (std::distance(S.array_begin(), S.array_end()) > MaxArraysInAliasScops) + if (Arrays.size() > MaxArraysInAliasScops) return; std::string AliasScopeStr = "polly.alias.scope."; - for (const ScopArrayInfo *Array : S.arrays()) { + for (const ScopArrayInfo *Array : Arrays) { assert(Array->getBasePtr() && "Base pointer must be present"); AliasScopeMap[Array->getBasePtr()] = getID(Ctx, AliasScopeDomain, MDString::get(Ctx, (AliasScopeStr + Array->getName()).c_str())); } - for (const ScopArrayInfo *Array : S.arrays()) { + for (const ScopArrayInfo *Array : Arrays) { MDNode *AliasScopeList = MDNode::get(Ctx, {}); for (const auto &AliasScopePair : AliasScopeMap) { if (Array->getBasePtr() == AliasScopePair.first) |

