diff options
| author | Adam Nemet <anemet@apple.com> | 2015-03-10 17:40:43 +0000 |
|---|---|---|
| committer | Adam Nemet <anemet@apple.com> | 2015-03-10 17:40:43 +0000 |
| commit | 58913d65ad1661482009f33ba0afcb76e133fc56 (patch) | |
| tree | d050d950f991f5013eb9fdb3a94dc22530995e3f /llvm/lib | |
| parent | 9c92657971cac4cba4278dec11753b018e62e649 (diff) | |
| download | bcm5719-llvm-58913d65ad1661482009f33ba0afcb76e133fc56.tar.gz bcm5719-llvm-58913d65ad1661482009f33ba0afcb76e133fc56.zip | |
[LoopAccesses 3/3] Print the dependences with -analyze
The dependences are now expose through the new getInterestingDependences
API so we can use that with -analyze too and fix the FIXME.
This lets us remove the test that relied on -debug to check the
dependences.
llvm-svn: 231807
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index a8f80545adc..b0553364b6c 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -835,6 +835,18 @@ bool MemoryDepChecker::areDepsSafe(DepCandidates &AccessSets, return SafeForVectorization; } +const char *MemoryDepChecker::Dependence::DepName[] = { + "NoDep", "Unknown", "Forward", "ForwardButPreventsForwarding", "Backward", + "BackwardVectorizable", "BackwardVectorizableButPreventsForwarding"}; + +void MemoryDepChecker::Dependence::print( + raw_ostream &OS, unsigned Depth, + const SmallVectorImpl<Instruction *> &Instrs) const { + OS.indent(Depth) << DepName[Type] << ":\n"; + OS.indent(Depth + 2) << *Instrs[Source] << " -> \n"; + OS.indent(Depth + 2) << *Instrs[Destination] << "\n"; +} + bool LoopAccessInfo::canAnalyzeLoop() { // We can only analyze innermost loops. if (!TheLoop->empty()) { @@ -1281,7 +1293,14 @@ void LoopAccessInfo::print(raw_ostream &OS, unsigned Depth) const { if (Report) OS.indent(Depth) << "Report: " << Report->str() << "\n"; - // FIXME: Print unsafe dependences + if (auto *InterestingDependences = DepChecker.getInterestingDependences()) { + OS.indent(Depth) << "Interesting Dependences:\n"; + for (auto &Dep : *InterestingDependences) { + Dep.print(OS, Depth + 2, DepChecker.getMemoryInstructions()); + OS << "\n"; + } + } else + OS.indent(Depth) << "Too many interesting dependences, not recorded\n"; // List the pair of accesses need run-time checks to prove independence. PtrRtCheck.print(OS, Depth); |

