diff options
author | Andreas Bolka <a@bolka.at> | 2009-08-05 04:26:05 +0000 |
---|---|---|
committer | Andreas Bolka <a@bolka.at> | 2009-08-05 04:26:05 +0000 |
commit | 831f6f6d2ae5a1ad988c8328404b052b7985ce31 (patch) | |
tree | d46d7b70cb5ace9f6ec717b9731e1728a499e686 /lib/Analysis/LoopDependenceAnalysis.cpp | |
parent | 58bed8fc29b6e55e7014dcb537808043c946cd73 (diff) |
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/LoopDependenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/LoopDependenceAnalysis.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Analysis/LoopDependenceAnalysis.cpp b/lib/Analysis/LoopDependenceAnalysis.cpp index 5d593a97bf..10a6a8eb06 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; |