summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DependenceAnalysis.cpp
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
commit3eb156306a156a24b935a2ecb4277a289c270005 (patch)
treedde7546290eb72dc49eeb411e7fc7e6789ac7ff4 /llvm/lib/Analysis/DependenceAnalysis.cpp
parent108c88c5b7cf7d8ebfd03750b148a13b4cc2de13 (diff)
downloadbcm5719-llvm-3eb156306a156a24b935a2ecb4277a289c270005.tar.gz
bcm5719-llvm-3eb156306a156a24b935a2ecb4277a289c270005.zip
DependenceAnalysis: Print all dependency pairs when dumping. Update all testcases.
Part of a patch by Preston Briggs. llvm-svn: 167827
Diffstat (limited to 'llvm/lib/Analysis/DependenceAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/DependenceAnalysis.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 95ac5ea233b..29a6f96cb23 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/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;
}
}
}
OpenPOWER on IntegriCloud