aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorAndreas Bolka <a@bolka.at>2009-08-05 04:26:05 +0000
committerAndreas Bolka <a@bolka.at>2009-08-05 04:26:05 +0000
commit831f6f6d2ae5a1ad988c8328404b052b7985ce31 (patch)
treed46d7b70cb5ace9f6ec717b9731e1728a499e686 /lib/Analysis
parent58bed8fc29b6e55e7014dcb537808043c946cd73 (diff)
downloadexternal_llvm-831f6f6d2ae5a1ad988c8328404b052b7985ce31.zip
external_llvm-831f6f6d2ae5a1ad988c8328404b052b7985ce31.tar.gz
external_llvm-831f6f6d2ae5a1ad988c8328404b052b7985ce31.tar.bz2
ZIV tester for LDA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/LoopDependenceAnalysis.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Analysis/LoopDependenceAnalysis.cpp b/lib/Analysis/LoopDependenceAnalysis.cpp
index 5d593a9..10a6a8e 100644
--- a/lib/Analysis/LoopDependenceAnalysis.cpp
+++ b/lib/Analysis/LoopDependenceAnalysis.cpp
@@ -136,6 +136,19 @@ bool LoopDependenceAnalysis::isAffine(const SCEV *S) const {
return isLoopInvariant(S) || (rec && rec->isAffine());
}
+bool LoopDependenceAnalysis::isZIVPair(const SCEV *A, const SCEV *B) const {
+ return isLoopInvariant(A) && isLoopInvariant(B);
+}
+
+LoopDependenceAnalysis::DependenceResult
+LoopDependenceAnalysis::analyseZIV(const SCEV *A,
+ const SCEV *B,
+ Subscript *S) const {
+ assert(isZIVPair(A, B));
+ const SCEV *diff = SE->getMinusSCEV(A, B);
+ return diff->isZero() ? Dependent : Independent;
+}
+
LoopDependenceAnalysis::DependenceResult
LoopDependenceAnalysis::analyseSubscript(const SCEV *A,
const SCEV *B,
@@ -152,7 +165,10 @@ LoopDependenceAnalysis::analyseSubscript(const SCEV *A,
return Unknown;
}
- // TODO: Implement ZIV/SIV/MIV testers.
+ if (isZIVPair(A, B))
+ return analyseZIV(A, B, S);
+
+ // TODO: Implement SIV/MIV testers.
DEBUG(errs() << " -> [?] cannot analyse subscript\n");
return Unknown;