summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit13b860992a82ef5242e74103c1e080dfbd9d860f (patch)
treee49d3e871401ffe2bd3d4630100ab751f6411226 /llvm/lib/Analysis
parentcbc7b2654217f514777bba85481319bf3ece86bf (diff)
downloadbcm5719-llvm-13b860992a82ef5242e74103c1e080dfbd9d860f.tar.gz
bcm5719-llvm-13b860992a82ef5242e74103c1e080dfbd9d860f.zip
ZIV tester for LDA.
llvm-svn: 78157
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/LoopDependenceAnalysis.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/LoopDependenceAnalysis.cpp b/llvm/lib/Analysis/LoopDependenceAnalysis.cpp
index 5d593a97bf3..10a6a8eb06f 100644
--- a/llvm/lib/Analysis/LoopDependenceAnalysis.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud