aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-11-13 12:12:02 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-11-13 12:12:02 +0000
commit563e8fce2ee22b21beb40ac65a6eaf2199d30414 (patch)
tree128c879a8ead7124b679c72dbaeb09556bd46963 /lib
parentad1cc1d1bfc0accd3f1af5c02ac367ff46a4bfdf (diff)
downloadexternal_llvm-563e8fce2ee22b21beb40ac65a6eaf2199d30414.zip
external_llvm-563e8fce2ee22b21beb40ac65a6eaf2199d30414.tar.gz
external_llvm-563e8fce2ee22b21beb40ac65a6eaf2199d30414.tar.bz2
DependenceAnalysis: Print all dependency pairs when dumping. Update all testcases.
Part of a patch by Preston Briggs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/DependenceAnalysis.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Analysis/DependenceAnalysis.cpp b/lib/Analysis/DependenceAnalysis.cpp
index 95ac5ea..29a6f96 100644
--- a/lib/Analysis/DependenceAnalysis.cpp
+++ b/lib/Analysis/DependenceAnalysis.cpp
@@ -145,22 +145,20 @@ void DependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
// Used to test the dependence analyzer.
-// Looks through the function, noting the first store instruction
-// and the first load instruction
-// (which always follows the first load in our tests).
-// Calls depends() and prints out the result.
+// Looks through the function, noting loads and stores.
+// Calls depends() on every possible pair and prints out the result.
// Ignores all other instructions.
static
void dumpExampleDependence(raw_ostream &OS, Function *F,
DependenceAnalysis *DA) {
for (inst_iterator SrcI = inst_begin(F), SrcE = inst_end(F);
SrcI != SrcE; ++SrcI) {
- if (const StoreInst *Src = dyn_cast<StoreInst>(&*SrcI)) {
+ if (isa<StoreInst>(*SrcI) || isa<LoadInst>(*SrcI)) {
for (inst_iterator DstI = SrcI, DstE = inst_end(F);
DstI != DstE; ++DstI) {
- if (const LoadInst *Dst = dyn_cast<LoadInst>(&*DstI)) {
+ if (isa<StoreInst>(*DstI) || isa<LoadInst>(*DstI)) {
OS << "da analyze - ";
- if (Dependence *D = DA->depends(Src, Dst, true)) {
+ if (Dependence *D = DA->depends(&*SrcI, &*DstI, true)) {
D->dump(OS);
for (unsigned Level = 1; Level <= D->getLevels(); Level++) {
if (D->isSplitable(Level)) {
@@ -173,7 +171,6 @@ void dumpExampleDependence(raw_ostream &OS, Function *F,
}
else
OS << "none!\n";
- return;
}
}
}