[polly] r299352 - [PollyIRBuilder] Bound size of alias metadata

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 00:42:50 PDT 2017


Author: grosser
Date: Mon Apr  3 02:42:50 2017
New Revision: 299352

URL: http://llvm.org/viewvc/llvm-project?rev=299352&view=rev
Log:
[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.

Modified:
    polly/trunk/lib/CodeGen/IRBuilder.cpp

Modified: polly/trunk/lib/CodeGen/IRBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IRBuilder.cpp?rev=299352&r1=299351&r2=299352&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IRBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IRBuilder.cpp Mon Apr  3 02:42:50 2017
@@ -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(Sco
   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()] =




More information about the llvm-commits mailing list