[PATCH] D47700: DivergenceAnalysis: added debug output
Tim Renouf via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 4 03:13:49 PDT 2018
tpr created this revision.
Herald added a subscriber: llvm-commits.
This commit does two things:
1. modified the existing DivergenceAnalysis::dump() so it dumps the whole function with added DIVERGENT: annotations;
2. added code to do that dump if the appropriate -debug-only option is on.
Change-Id: Id97b605aab1fc6f5a11a20c58a99bbe8c565bf83
Repository:
rL LLVM
https://reviews.llvm.org/D47700
Files:
lib/Analysis/DivergenceAnalysis.cpp
Index: lib/Analysis/DivergenceAnalysis.cpp
===================================================================
--- lib/Analysis/DivergenceAnalysis.cpp
+++ lib/Analysis/DivergenceAnalysis.cpp
@@ -77,6 +77,8 @@
#include <vector>
using namespace llvm;
+#define DEBUG_TYPE "divergence"
+
namespace {
class DivergencePropagator {
@@ -299,6 +301,10 @@
PDT, DivergentValues);
DP.populateWithSourcesOfDivergence();
DP.propagate();
+ DEBUG(
+ dbgs() << "\nAfter divergence analysis on " << F.getName() << ":\n";
+ print(dbgs(), F.getParent())
+ );
return false;
}
@@ -318,12 +324,17 @@
// 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";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47700.149699.patch
Type: text/x-patch
Size: 1444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180604/e8ae9907/attachment.bin>
More information about the llvm-commits
mailing list