[PATCH] D115946: [DAG] Directed Acyclic Graph - DOT printer test

Shivam Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 20 03:53:48 PST 2021


xgupta created this revision.
Herald added a subscriber: ormris.
xgupta published this revision for review.
xgupta added a reviewer: bmahjour.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This adds a test to check the formatting of the dot file produced when using -view-sched-dags.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115946

Files:
  llvm/test/Other/print-dot-dag.ll


Index: llvm/test/Other/print-dot-dag.ll
===================================================================
--- /dev/null
+++ llvm/test/Other/print-dot-dag.ll
@@ -0,0 +1,62 @@
+; RUN: llc -fast-isel=false  -view-sched-dags < %s 2>&1 > /dev/null
+; RUN: FileCheck %s -input-file=main:entry.dot
+
+; Test the dot graph printer for a SelectionDAG graph generated from
+; the following test case.
+;
+; int main() {
+;   int a, b, c;
+;   c = a + b;
+;   return 0;
+; }
+
+; CHECK: digraph "scheduler input for main:entry"
+; CHECK-NEXT: rankdir="BT";
+; CHECK-NEXT: label="scheduler input for main:entry";
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{EntryToken|t0|{<d0>ch}}"];
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{MOV32r0|t1|{<d0>i32|<d1>i32}}"];
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{TargetConstant\<0\>|t14|{<d0>i32}}"];
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{Register $eax|t15|{<d0>i32}}"];
+; CHECK-NEXT: {{Node0x.*}}  [shape=record,shape=Mrecord,label="{{<s0>0|<s1>1|<s2>2|<s3>3|<s4>4|<s5>5|<s6>6}|MOV32mi\<Mem:(store (s32) into %ir.retval)\>|t5|{<d0>ch}}"];
+; CHECK-COUNT-7: {{Node0x.*}} -> {{Node0x.*}}
+; CHECK-NEXT: {{Node0x.*}} -> {{Node0x.*}}[color=blue,style=dashed]
+; CHECK: {{Node0x.*}} [shape=record,shape=Mrecord,label="{TargetFrameIndex\<3\>|t18|{<d0>i64}}"]
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{TargetConstant\<1\>|t19|{<d0>i8}}"]
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{Register $noreg|t20|{<d0>i64}}"]
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{Register $noreg|t21|{<d0>i16}}"]
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{Register $noreg|t22|{<d0>i32}}"]
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{TargetFrameIndex\<1\>|t23|{<d0>i64}}"]
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{TargetFrameIndex\<2\>|t24|{<d0>i64}}"]
+; CHECK-NEXT: {{Node0x.*}} [shape=record,shape=Mrecord,label="{TargetFrameIndex\<0\>|t25|{<d0>i64}}"]
+; CHECK-NEXT: {{Node0x.*}}[ plaintext=circle, label ="GraphRoot"]
+; CHECK-NEXT: {{Node0x}} -> {{Node0x.*}}[color=blue,style=dashed]
+
+; ModuleID = 'print-dot-dag.c'
+source_filename = "print-dot-dag.c"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Function Attrs: noinline nounwind optnone uwtable
+define dso_local i32 @main() #0 {
+entry:
+  %retval = alloca i32, align 4
+  %a = alloca i32, align 4
+  %b = alloca i32, align 4
+  %c = alloca i32, align 4
+  store i32 0, i32* %retval, align 4
+  %0 = load i32, i32* %a, align 4
+  %1 = load i32, i32* %b, align 4
+  %add = add nsw i32 %0, %1
+  store i32 %add, i32* %c, align 4
+  ret i32 0
+}
+
+attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+
+!llvm.module.flags = !{!0, !1, !2}
+!llvm.ident = !{!3}
+
+!0 = !{i32 1, !"wchar_size", i32 4}
+!1 = !{i32 7, !"uwtable", i32 1}
+!2 = !{i32 7, !"frame-pointer", i32 2}
+!3 = !{!"clang version 14.0.0 (https://github.com/llvm/llvm-project.git 36b0325c442a3669c2eb2c6fcaeb2cb57445c851)"}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115946.395151.patch
Type: text/x-patch
Size: 3372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211220/860c3050/attachment.bin>


More information about the llvm-commits mailing list