From 696a1ee99d716ae2e931eb886ffc982e9da188df Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Mon, 3 Apr 2017 07:42:50 +0000 Subject: [PATCH] [PollyIRBuilder] Bound size of alias metadata No-alias metadata grows quadratic in the size of arrays involved, which can become very costly for large programs. This commit bounds the number of arrays for which we construct no-alias information to ten. This is conservatively correct, as we just provide less information to LLVM and speeds up the compile time of one of my internal test cases from 'does-not-terminate' to 'finishes-in-less-than-a-minute'. In the future we might try to be more clever here, but this change should provide a good baseline. llvm-svn: 299352 --- polly/lib/CodeGen/IRBuilder.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/polly/lib/CodeGen/IRBuilder.cpp b/polly/lib/CodeGen/IRBuilder.cpp index 1077515..a8fb1fd 100644 --- a/polly/lib/CodeGen/IRBuilder.cpp +++ b/polly/lib/CodeGen/IRBuilder.cpp @@ -21,6 +21,8 @@ using namespace llvm; using namespace polly; +static const int MaxArraysInAliasScops = 10; + /// Get a self referencing id metadata node. /// /// The MDNode looks like this (if arg0/arg1 are not null): @@ -58,6 +60,12 @@ void ScopAnnotator::buildAliasScopes(Scop &S) { AliasScopeMap.clear(); OtherAliasScopeListMap.clear(); + // 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) + return; + std::string AliasScopeStr = "polly.alias.scope."; for (const ScopArrayInfo *Array : S.arrays()) AliasScopeMap[Array->getBasePtr()] = -- 2.7.4