[PATCH] D47700: DivergenceAnalysis: added debug output
Tim Renouf via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 13 06:18:50 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL336998: DivergenceAnalysis: added debug output (authored by tpr, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D47700?vs=149699&id=155367#toc
Repository:
rL LLVM
https://reviews.llvm.org/D47700
Files:
llvm/trunk/lib/Analysis/DivergenceAnalysis.cpp
llvm/trunk/test/Analysis/DivergenceAnalysis/AMDGPU/phi-undef.ll
Index: llvm/trunk/test/Analysis/DivergenceAnalysis/AMDGPU/phi-undef.ll
===================================================================
--- llvm/trunk/test/Analysis/DivergenceAnalysis/AMDGPU/phi-undef.ll
+++ llvm/trunk/test/Analysis/DivergenceAnalysis/AMDGPU/phi-undef.ll
@@ -2,9 +2,12 @@
; CHECK-LABEL: 'test1':
; CHECK-NEXT: DIVERGENT: i32 %bound
+; CHECK: {{^ *}}%counter =
; CHECK-NEXT: DIVERGENT: %break = icmp sge i32 %counter, %bound
; CHECK-NEXT: DIVERGENT: br i1 %break, label %footer, label %body
-; CHECK-NEXT: DIVERGENT: br i1 %break, label %end, label %header
+; CHECK: {{^ *}}%counter.next =
+; CHECK: {{^ *}}%counter.footer =
+; CHECK: DIVERGENT: br i1 %break, label %end, label %header
; Note: %counter is not divergent!
define amdgpu_ps void @test1(i32 %bound) {
entry:
Index: llvm/trunk/lib/Analysis/DivergenceAnalysis.cpp
===================================================================
--- llvm/trunk/lib/Analysis/DivergenceAnalysis.cpp
+++ llvm/trunk/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();
+ LLVM_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.155367.patch
Type: text/x-patch
Size: 2284 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180713/d5f32860/attachment.bin>
More information about the llvm-commits
mailing list