summaryrefslogtreecommitdiffstats
path: root/polly/lib/Transform/Simplify.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2017-08-08 06:15:15 +0000
committerTobias Grosser <tobias@grosser.es>2017-08-08 06:15:15 +0000
commit327e9ecb0d7ee4a9841c67c72f3f890bd65832ea (patch)
tree1f09543f66866f6b6cbf345e6c5363c3f5789f1f /polly/lib/Transform/Simplify.cpp
parent03aa3aee114ff345c51527dd04602752958e71db (diff)
downloadbcm5719-llvm-327e9ecb0d7ee4a9841c67c72f3f890bd65832ea.tar.gz
bcm5719-llvm-327e9ecb0d7ee4a9841c67c72f3f890bd65832ea.zip
[ScheduleOptimizer] Make matmul pattern detection work with delicm output
In certain cases delicm might decide to not leave the original array write in the loop body, but to remove it and instead leave a transformed phi node as write access. This commit teached the matmul pattern detection to order the memory accesses according to when the access actually happens and use this information to detect the new pattern. This makes pattern based matmul optimization work for 2mm and 3mm in polybench 4 after polly-position=before-vectorizer has been enabled. llvm-svn: 310338
Diffstat (limited to 'polly/lib/Transform/Simplify.cpp')
-rw-r--r--polly/lib/Transform/Simplify.cpp54
1 files changed, 21 insertions, 33 deletions
diff --git a/polly/lib/Transform/Simplify.cpp b/polly/lib/Transform/Simplify.cpp
index 6f8a27f46e6..e172d839b03 100644
--- a/polly/lib/Transform/Simplify.cpp
+++ b/polly/lib/Transform/Simplify.cpp
@@ -98,39 +98,6 @@ static isl::union_map underapproximatedAddMap(isl::union_map UMap,
return UResult;
}
-/// Return a vector that contains MemoryAccesses in the order in
-/// which they are executed.
-///
-/// The order is:
-/// - Implicit reads (BlockGenerator::generateScalarLoads)
-/// - Explicit reads and writes (BlockGenerator::generateArrayLoad,
-/// BlockGenerator::generateArrayStore)
-/// - In block statements, the accesses are in order in which their
-/// instructions are executed.
-/// - In region statements, that order of execution is not predictable at
-/// compile-time.
-/// - Implicit writes (BlockGenerator::generateScalarStores)
-/// The order in which implicit writes are executed relative to each other is
-/// undefined.
-static SmallVector<MemoryAccess *, 32> getAccessesInOrder(ScopStmt &Stmt) {
-
- SmallVector<MemoryAccess *, 32> Accesses;
-
- for (MemoryAccess *MemAcc : Stmt)
- if (isImplicitRead(MemAcc))
- Accesses.push_back(MemAcc);
-
- for (MemoryAccess *MemAcc : Stmt)
- if (isExplicitAccess(MemAcc))
- Accesses.push_back(MemAcc);
-
- for (MemoryAccess *MemAcc : Stmt)
- if (isImplicitWrite(MemAcc))
- Accesses.push_back(MemAcc);
-
- return Accesses;
-}
-
class Simplify : public ScopPass {
private:
/// The last/current SCoP that is/has been processed.
@@ -700,6 +667,27 @@ public:
char Simplify::ID;
} // anonymous namespace
+namespace polly {
+SmallVector<MemoryAccess *, 32> getAccessesInOrder(ScopStmt &Stmt) {
+
+ SmallVector<MemoryAccess *, 32> Accesses;
+
+ for (MemoryAccess *MemAcc : Stmt)
+ if (isImplicitRead(MemAcc))
+ Accesses.push_back(MemAcc);
+
+ for (MemoryAccess *MemAcc : Stmt)
+ if (isExplicitAccess(MemAcc))
+ Accesses.push_back(MemAcc);
+
+ for (MemoryAccess *MemAcc : Stmt)
+ if (isImplicitWrite(MemAcc))
+ Accesses.push_back(MemAcc);
+
+ return Accesses;
+}
+} // namespace polly
+
Pass *polly::createSimplifyPass() { return new Simplify(); }
INITIALIZE_PASS_BEGIN(Simplify, "polly-simplify", "Polly - Simplify", false,
OpenPOWER on IntegriCloud