summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-08-09 09:29:15 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-08-09 09:29:15 +0000
commit8756b3fbecfb54741298cb61dc68c849f5871692 (patch)
treecbb237ec8eae4a1023fed64adf353ff29e1c9319
parenta9033aaba22a601b255cb659ff6a58ad753756c3 (diff)
downloadbcm5719-llvm-8756b3fbecfb54741298cb61dc68c849f5871692.tar.gz
bcm5719-llvm-8756b3fbecfb54741298cb61dc68c849f5871692.zip
[ZoneAlgo] Add motivation for exception. NFC.
Suggested-by: Hongbin Zheng <etherzhhb@gmail.com> llvm-svn: 310455
-rw-r--r--polly/lib/Transform/ZoneAlgo.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/polly/lib/Transform/ZoneAlgo.cpp b/polly/lib/Transform/ZoneAlgo.cpp
index 6215199aeda..8ae5d9b64bd 100644
--- a/polly/lib/Transform/ZoneAlgo.cpp
+++ b/polly/lib/Transform/ZoneAlgo.cpp
@@ -281,6 +281,26 @@ ZoneAlgorithm::ZoneAlgorithm(const char *PassName, Scop *S, LoopInfo *LI)
/// Check if all stores in @p Stmt store the very same value.
///
+/// This covers a special situation occurring in Polybench's
+/// covariance/correlation (which is typical for algorithms that cover symmetric
+/// matrices):
+///
+/// for (int i = 0; i < n; i += 1)
+/// for (int j = 0; j <= i; j += 1) {
+/// double x = ...;
+/// C[i][j] = x;
+/// C[j][i] = x;
+/// }
+///
+/// For i == j, the same value is written twice to the same element.Double
+/// writes to the same element are not allowed in DeLICM because its algorithm
+/// does not see which of the writes is effective.But if its the same value
+/// anyway, it doesn't matter.
+///
+/// LLVM passes, however, cannot simplify this because the write is necessary
+/// for i != j (unless it would add a condition for one of the writes to occur
+/// only if i != j).
+///
/// TODO: In the future we may want to extent this to make the checks
/// specific to different memory locations.
static bool onlySameValueWrites(ScopStmt *Stmt) {
OpenPOWER on IntegriCloud