diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 |
commit | eb11fae6d08f479c0799db45860a98af528fa6e7 (patch) | |
tree | 44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /lib/Analysis/DivergenceAnalysis.cpp | |
parent | b8a2042aa938069e862750553db0e4d82d25822c (diff) |
Notes
Diffstat (limited to 'lib/Analysis/DivergenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/DivergenceAnalysis.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/Analysis/DivergenceAnalysis.cpp b/lib/Analysis/DivergenceAnalysis.cpp index ac684ec18466..f5f1874c9303 100644 --- a/lib/Analysis/DivergenceAnalysis.cpp +++ b/lib/Analysis/DivergenceAnalysis.cpp @@ -77,6 +77,8 @@ #include <vector> using namespace llvm; +#define DEBUG_TYPE "divergence" + namespace { class DivergencePropagator { @@ -299,6 +301,10 @@ bool DivergenceAnalysis::runOnFunction(Function &F) { PDT, DivergentValues); DP.populateWithSourcesOfDivergence(); DP.propagate(); + LLVM_DEBUG( + dbgs() << "\nAfter divergence analysis on " << F.getName() << ":\n"; + print(dbgs(), F.getParent()) + ); return false; } @@ -318,12 +324,17 @@ void DivergenceAnalysis::print(raw_ostream &OS, const Module *) const { // Dumps all divergent values in F, arguments and then instructions. for (auto &Arg : F->args()) { - if (DivergentValues.count(&Arg)) - OS << "DIVERGENT: " << Arg << "\n"; + OS << (DivergentValues.count(&Arg) ? "DIVERGENT: " : " "); + OS << Arg << "\n"; } // Iterate instructions using instructions() to ensure a deterministic order. - for (auto &I : instructions(F)) { - if (DivergentValues.count(&I)) - OS << "DIVERGENT:" << I << "\n"; + for (auto BI = F->begin(), BE = F->end(); BI != BE; ++BI) { + auto &BB = *BI; + OS << "\n " << BB.getName() << ":\n"; + for (auto &I : BB.instructionsWithoutDebug()) { + OS << (DivergentValues.count(&I) ? "DIVERGENT: " : " "); + OS << I << "\n"; + } } + OS << "\n"; } |