[PATCH] D133984: [SDAG] Print divergence in SDNode::dump

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 11:36:44 PDT 2022


rampitec updated this revision to Diff 460835.
rampitec marked an inline comment as done.
rampitec added a comment.

Moved info right after the node and use the same style as -dag-dump-verbose.
Avoid info duplication if -dag-dump-verbose is used.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133984/new/

https://reviews.llvm.org/D133984

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  llvm/test/CodeGen/AMDGPU/sdag-print-divergence.ll


Index: llvm/test/CodeGen/AMDGPU/sdag-print-divergence.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/sdag-print-divergence.ll
@@ -0,0 +1,33 @@
+; RUN: llc -march=amdgcn -mcpu=gfx900 -O0 -verify-machineinstrs < %s -debug-only=isel -o /dev/null |& FileCheck --check-prefixes=GCN,GCN-DEFAULT %s
+; RUN: llc -march=amdgcn -mcpu=gfx900 -O0 -verify-machineinstrs < %s -debug-only=isel -dag-dump-verbose -o /dev/null |& FileCheck --check-prefixes=GCN,GCN-VERBOSE %s
+
+; REQUIRES: asserts
+
+; GCN-LABEL: === test_sdag_dump
+; GCN: Initial selection DAG: %bb.0 'test_sdag_dump:entry'
+; GCN: SelectionDAG has 10 nodes:
+
+; GCN-DEFAULT:  t0: ch = EntryToken
+; GCN-DEFAULT:  t2: f32,ch = CopyFromReg t0, Register:f32 %0
+; GCN-DEFAULT:      t5: f32 = fadd t2, t2
+; GCN-DEFAULT:      t4: f32,ch = CopyFromReg # D:1 t0, Register:f32 %1
+; GCN-DEFAULT:    t6: f32 = fadd # D:1 t5, t4
+; GCN-DEFAULT:  t8: ch,glue = CopyToReg # D:1 t0, Register:f32 $vgpr0, t6
+; GCN-DEFAULT:  t9: ch = RETURN_TO_EPILOG # D:1 t8, Register:f32 $vgpr0, t8:1
+
+; GCN-VERBOSE:  t0: ch = EntryToken # D:0
+; GCN-VERBOSE:  t2: f32,ch = CopyFromReg [ORD=1] # D:0 t0, Register:f32 %0 # D:0
+; GCN-VERBOSE:      t5: f32 = fadd [ORD=2] # D:0 t2, t2
+; GCN-VERBOSE:      t4: f32,ch = CopyFromReg [ORD=1] # D:1 t0, Register:f32 %1 # D:0
+; GCN-VERBOSE:    t6: f32 = fadd [ORD=3] # D:1 t5, t4
+; GCN-VERBOSE:  t8: ch,glue = CopyToReg [ORD=4] # D:1 t0, Register:f32 $vgpr0 # D:0, t6
+; GCN-VERBOSE:  t9: ch = RETURN_TO_EPILOG [ORD=4] # D:1 t8, Register:f32 $vgpr0 # D:0, t8:1
+
+define amdgpu_ps float @test_sdag_dump(float inreg %scalar, float %vector)  {
+entry:
+  %sadd = fadd float %scalar, %scalar
+  %ret = fadd float %sadd, %vector
+  ret float %ret
+}
+
+declare i32 @llvm.amdgcn.workitem.id.x()
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
@@ -1059,6 +1059,9 @@
 
 void SDNode::print(raw_ostream &OS, const SelectionDAG *G) const {
   printr(OS, G);
+  // Under VerboseDAGDumping divergence will be printed always.
+  if (isDivergent() && !VerboseDAGDumping)
+    OS << " # D:1";
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
     if (i) OS << ", "; else OS << " ";
     printOperand(OS, G, getOperand(i));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133984.460835.patch
Type: text/x-patch
Size: 2456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220916/46b66931/attachment.bin>


More information about the llvm-commits mailing list