[PATCH] D37028: [IRBuilder] Only emit alias scop metadata for arrays, but not scalars

Tobias Grosser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 15:02:00 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL311498: [IRBuilder] Only emit alias scop metadata for arrays, but not scalars (authored by grosser).

Changed prior to commit:
  https://reviews.llvm.org/D37028?vs=112230&id=112235#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37028

Files:
  polly/trunk/lib/CodeGen/IRBuilder.cpp
  polly/trunk/test/Isl/CodeGen/MemAccess/create_arrays.ll
  polly/trunk/test/ScheduleOptimizer/pattern-matching-based-opts_10.ll


Index: polly/trunk/test/ScheduleOptimizer/pattern-matching-based-opts_10.ll
===================================================================
--- polly/trunk/test/ScheduleOptimizer/pattern-matching-based-opts_10.ll
+++ polly/trunk/test/ScheduleOptimizer/pattern-matching-based-opts_10.ll
@@ -12,13 +12,13 @@
 ; This test case checks whether Polly generates second level alias metadata
 ; to distinguish the specific accesses in case of the ublas gemm kernel.
 ;
-; CHECK: !13 = distinct !{!13, !0, !"second level alias metadata"}
+; CHECK: !11 = distinct !{!11, !0, !"second level alias metadata"}
+; CHECK: !12 = distinct !{!12, !0, !"second level alias metadata"}
+; CHECK: !13 = !{!3, !4, !5, !6, !11}
 ; CHECK: !14 = distinct !{!14, !0, !"second level alias metadata"}
-; CHECK: !15 = !{!3, !4, !5, !6, !7, !8, !13}
+; CHECK: !15 = !{!3, !4, !5, !6, !11, !12}
 ; CHECK: !16 = distinct !{!16, !0, !"second level alias metadata"}
-; CHECK: !17 = !{!3, !4, !5, !6, !7, !8, !13, !14}
-; CHECK: !18 = distinct !{!18, !0, !"second level alias metadata"}
-; CHECK: !19 = !{!3, !4, !5, !6, !7, !8, !13, !14, !16}
+; CHECK: !17 = !{!3, !4, !5, !6, !11, !12, !14}
 ;
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-unknown"
Index: polly/trunk/test/Isl/CodeGen/MemAccess/create_arrays.ll
===================================================================
--- polly/trunk/test/Isl/CodeGen/MemAccess/create_arrays.ll
+++ polly/trunk/test/Isl/CodeGen/MemAccess/create_arrays.ll
@@ -32,15 +32,14 @@
 ; CODEGEN:  {{%.*}} = load double, double* %polly.access.E, align 8, !alias.scope [[TAG0:![0-9]+]], !noalias [[TAG2:![0-9]+]]
 ; CODEGEN:  store double {{%.*}}, double* %scevgep36, align 8, !alias.scope [[TAG5:![0-9]+]], !noalias [[TAG8:![0-9]+]]
 ;
-; CODEGEN-DAG: [[TAG0]] = distinct !{[[TAG0]], [[TAG1:![0-9]+]], !"polly.alias.scope.E"}
-; CODEGEN-DAG: [[TAG1]] = distinct !{[[TAG1]], !"polly.alias.scope.domain"}
-; CODEGEN-DAG: [[TAG2]] = !{[[TAG3:![0-9]+]], [[TAG4:![0-9]+]], [[TAG5:![0-9]+]], [[TAG6:![0-9]+]], [[TAG7:![0-9]+]]}
-; CODEGEN-DAG: [[TAG3]] = distinct !{[[TAG3]], [[TAG1]], !"polly.alias.scope.MemRef_B"}
-; CODEGEN-DAG: [[TAG4]] = distinct !{[[TAG4]], [[TAG1]], !"polly.alias.scope.MemRef_beta"}
-; CODEGEN-DAG: [[TAG5]] = distinct !{[[TAG5]], [[TAG1]], !"polly.alias.scope.MemRef_A"}
-; CODEGEN-DAG: [[TAG6]] = distinct !{[[TAG6]], [[TAG1]], !"polly.alias.scope.D"}
-; CODEGEN-DAG: [[TAG7]] = distinct !{[[TAG7]], [[TAG1]], !"polly.alias.scope.F"}
-; CODEGEN-DAG: [[TAG8]] = !{[[TAG3]], [[TAG4]], [[TAG6]], [[TAG0]], [[TAG7]]}
+; CODEGEN: [[TAG0]] = distinct !{[[TAG0]], [[TAG1:![0-9]+]], !"polly.alias.scope.E"}
+; CODEGEN: [[TAG1]] = distinct !{[[TAG1]], !"polly.alias.scope.domain"}
+; CODEGEN: [[TAG2]] = !{[[TAG3:![0-9]+]], [[TAG4:![0-9]+]], [[TAG5:![0-9]+]], [[TAG6:![0-9]+]]}
+; CODEGEN: [[TAG3]] = distinct !{[[TAG3]], [[TAG1]], !"polly.alias.scope.MemRef_B"}
+; CODEGEN: [[TAG4]] = distinct !{[[TAG4]], [[TAG1]], !"polly.alias.scope.MemRef_A"}
+; CODEGEN: [[TAG5]] = distinct !{[[TAG5]], [[TAG1]], !"polly.alias.scope.D"}
+; CODEGEN: [[TAG6]] = distinct !{[[TAG6]], [[TAG1]], !"polly.alias.scope.F"}
+; CODEGEN: [[TAG7:![0-9]+]] = !{[[TAG3]], [[TAG5]], [[TAG0]], [[TAG6]]}
 ;
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-unknown"
Index: polly/trunk/lib/CodeGen/IRBuilder.cpp
===================================================================
--- polly/trunk/lib/CodeGen/IRBuilder.cpp
+++ polly/trunk/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 @@
   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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37028.112235.patch
Type: text/x-patch
Size: 5138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170822/d5a34200/attachment.bin>


More information about the llvm-commits mailing list