[llvm-commits] [llvm] r78157 - in /llvm/trunk: include/llvm/Analysis/LoopDependenceAnalysis.h lib/Analysis/LoopDependenceAnalysis.cpp test/Analysis/LoopDependenceAnalysis/alias.ll test/Analysis/LoopDependenceAnalysis/ziv.ll
Andreas Bolka
a at bolka.at
Tue Aug 4 21:26:06 PDT 2009
Author: abolka
Date: Tue Aug 4 23:26:05 2009
New Revision: 78157
URL: http://llvm.org/viewvc/llvm-project?rev=78157&view=rev
Log:
ZIV tester for LDA.
Modified:
llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h
llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp
llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll
llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll
Modified: llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h?rev=78157&r1=78156&r2=78157&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopDependenceAnalysis.h Tue Aug 4 23:26:05 2009
@@ -77,6 +77,8 @@
bool isAffine(const SCEV*) const;
/// TODO: doc
+ bool isZIVPair(const SCEV*, const SCEV*) const;
+ DependenceResult analyseZIV(const SCEV*, const SCEV*, Subscript*) const;
DependenceResult analyseSubscript(const SCEV*, const SCEV*, Subscript*) const;
DependenceResult analysePair(DependencePair*) const;
Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=78157&r1=78156&r2=78157&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Tue Aug 4 23:26:05 2009
@@ -136,6 +136,19 @@
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 @@
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;
Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll?rev=78157&r1=78156&r2=78157&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll (original)
+++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/alias.ll Tue Aug 4 23:26:05 2009
@@ -34,7 +34,7 @@
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
%x = load i32* %x.ld.addr
store i32 %x, i32* %x.st.addr
-; CHECK: 0,1: dep
+; CHECK: 0,1: ind
%i.next = add i64 %i, 1
%exitcond = icmp eq i64 %i.next, 256
br i1 %exitcond, label %for.end, label %for.body
Modified: llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll?rev=78157&r1=78156&r2=78157&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll (original)
+++ llvm/trunk/test/Analysis/LoopDependenceAnalysis/ziv.ll Tue Aug 4 23:26:05 2009
@@ -12,7 +12,7 @@
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
%x = load i32* getelementptr ([256 x i32]* @x, i32 0, i64 6)
store i32 %x, i32* getelementptr ([256 x i32]* @x, i32 0, i64 5)
-; CHECK: 0,1: dep
+; CHECK: 0,1: ind
%i.next = add i64 %i, 1
%exitcond = icmp eq i64 %i.next, 256
br i1 %exitcond, label %for.end, label %for.body
@@ -34,7 +34,7 @@
%i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
%x = load i32* %x.ld.addr
store i32 %x, i32* %x.st.addr
-; CHECK: 0,1: dep
+; CHECK: 0,1: ind
%i.next = add i64 %i, 1
%exitcond = icmp eq i64 %i.next, 256
br i1 %exitcond, label %for.end, label %for.body
More information about the llvm-commits
mailing list