diff options
| author | Tobias Grosser <tobias@grosser.es> | 2017-08-17 22:04:53 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2017-08-17 22:04:53 +0000 |
| commit | fa03cb768773e5c22449cab38f71d2f009cab381 (patch) | |
| tree | 1ac8ddd43f80f1d621cd1aefb76ab209d9272fe9 | |
| parent | b46847c035703f1f3c6a6f8c6833daf7c381b8a1 (diff) | |
| download | bcm5719-llvm-fa03cb768773e5c22449cab38f71d2f009cab381.tar.gz bcm5719-llvm-fa03cb768773e5c22449cab38f71d2f009cab381.zip | |
[GPGPU] Only collect the access that belong to an array [NFC]
This avoid the construction of very large sets and in many cases also keeps the
number of parameters low. As a result, we see a compile time reduction from 5
minutes to only slightly above 1 minute for one of our larger test cases.
llvm-svn: 311127
| -rw-r--r-- | polly/include/polly/ScopInfo.h | 5 | ||||
| -rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 5 | ||||
| -rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 11 |
3 files changed, 15 insertions, 6 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index 07ac3f7d137..88f3410294d 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -2913,6 +2913,11 @@ public: /// Get a union map of all memory accesses performed in the SCoP. isl::union_map getAccesses(); + /// Get a union map of all memory accesses performed in the SCoP. + /// + /// @param Array The array to which the accesses should belong. + isl::union_map getAccesses(ScopArrayInfo *Array); + /// Get the schedule of all the statements in the SCoP. /// /// @return The schedule of all the statements in the SCoP, if the schedule of diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 621e9c94275..9181a0268ac 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -4705,6 +4705,11 @@ isl::union_map Scop::getAccesses() { return getAccessesOfType([](MemoryAccess &MA) { return true; }); } +isl::union_map Scop::getAccesses(ScopArrayInfo *Array) { + return getAccessesOfType( + [Array](MemoryAccess &MA) { return MA.getScopArrayInfo() == Array; }); +} + // Check whether @p Node is an extension node. // // @return true if @p Node is an extension node. diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index e44e8f716e9..a3388bd3fd2 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -2762,9 +2762,11 @@ public: /// @returns An isl_set describing the extent of the array. isl::set getExtent(ScopArrayInfo *Array) { unsigned NumDims = Array->getNumberOfDimensions(); - isl::union_map Accesses = S->getAccesses(); - Accesses = Accesses.intersect_domain(S->getDomains()); - Accesses = Accesses.detect_equalities(); + + if (Array->getNumberOfDimensions() == 0) + return isl::set::universe(Array->getSpace()); + + isl::union_map Accesses = S->getAccesses(Array); isl::union_set AccessUSet = Accesses.range(); AccessUSet = AccessUSet.coalesce(); AccessUSet = AccessUSet.detect_equalities(); @@ -2773,9 +2775,6 @@ public: if (AccessUSet.is_empty()) return isl::set::empty(Array->getSpace()); - if (Array->getNumberOfDimensions() == 0) - return isl::set::universe(Array->getSpace()); - isl::set AccessSet = AccessUSet.extract_set(Array->getSpace()); isl::local_space LS = isl::local_space(Array->getSpace()); |

