[PATCH] D31519: [XRay][tools] Remove some assertions in llvm-xray graph

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 19:09:16 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL299150: [XRay][tools] Remove some assertions in llvm-xray graph (authored by dberris).

Changed prior to commit:
  https://reviews.llvm.org/D31519?vs=93569&id=93576#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31519

Files:
  llvm/trunk/test/tools/llvm-xray/X86/graph-zero-latency-calls.yaml
  llvm/trunk/tools/llvm-xray/xray-graph.cc


Index: llvm/trunk/tools/llvm-xray/xray-graph.cc
===================================================================
--- llvm/trunk/tools/llvm-xray/xray-graph.cc
+++ llvm/trunk/tools/llvm-xray/xray-graph.cc
@@ -259,7 +259,7 @@
 
 template <typename U>
 void GraphRenderer::getStats(U begin, U end, GraphRenderer::TimeStat &S) {
-  assert(begin != end);
+  if (begin == end) return;
   std::ptrdiff_t MedianOff = S.Count / 2;
   std::nth_element(begin, begin + MedianOff, end);
   S.Median = *(begin + MedianOff);
@@ -287,25 +287,20 @@
   for (auto &E : G.edges()) {
     auto &A = E.second;
     assert(!A.Timings.empty());
-    assert((A.Timings[0] > 0));
     getStats(A.Timings.begin(), A.Timings.end(), A.S);
-    assert(A.S.Sum > 0);
     updateMaxStats(A.S, G.GraphEdgeMax);
   }
 }
 
 void GraphRenderer::calculateVertexStatistics() {
   std::vector<uint64_t> TempTimings;
   for (auto &V : G.vertices()) {
-    assert((V.first == 0 || G[V.first].S.Sum != 0) &&
-           "Every non-root vertex should have at least one call");
     if (V.first != 0) {
       for (auto &E : G.inEdges(V.first)) {
         auto &A = E.second;
         TempTimings.insert(TempTimings.end(), A.Timings.begin(),
                            A.Timings.end());
       }
-      assert(!TempTimings.empty() && TempTimings[0] > 0);
       getStats(TempTimings.begin(), TempTimings.end(), G[V.first].S);
       updateMaxStats(G[V.first].S, G.GraphVertexMax);
       TempTimings.clear();
Index: llvm/trunk/test/tools/llvm-xray/X86/graph-zero-latency-calls.yaml
===================================================================
--- llvm/trunk/test/tools/llvm-xray/X86/graph-zero-latency-calls.yaml
+++ llvm/trunk/test/tools/llvm-xray/X86/graph-zero-latency-calls.yaml
@@ -0,0 +1,20 @@
+#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml | FileCheck %s
+
+---
+header:
+  version: 1
+  type: 0
+  constant-tsc: true
+  nonstop-tsc: true
+  cycle-frequency: 2601000000
+records:
+  - { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-enter, tsc: 10001 }
+  - { type: 0, func-id: 2, cpu: 1, thread: 111, kind: function-enter, tsc: 10002 }
+  - { type: 0, func-id: 2, cpu: 1, thread: 111, kind: function-exit, tsc: 10002 }
+  - { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-exit, tsc: 10100 }
+...
+
+#CHECK:     digraph xray {
+#CHECK-DAG:   F0 -> F1 [{{.*}}];
+#CHECK-DAG:   F1 -> F2 [{{.*}}];
+#CHECK-DAG: }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31519.93576.patch
Type: text/x-patch
Size: 2423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170331/7289dc79/attachment.bin>


More information about the llvm-commits mailing list