[PATCH] D92816: [llvm-profgen][NFC] Fix test failure by making unwinder's output deterministic
    Lei Wang via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Dec  7 22:37:51 PST 2020
    
    
  
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeea67baf8706: [llvm-profgen][NFC] Fix test failure by making unwinder's output deterministic (authored by wlei).
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92816/new/
https://reviews.llvm.org/D92816
Files:
  llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
  llvm/tools/llvm-profgen/PerfReader.cpp
Index: llvm/tools/llvm-profgen/PerfReader.cpp
===================================================================
--- llvm/tools/llvm-profgen/PerfReader.cpp
+++ llvm/tools/llvm-profgen/PerfReader.cpp
@@ -199,7 +199,10 @@
 }
 
 static void printSampleCounter(ContextRangeCounter &Counter) {
-  for (auto Range : Counter) {
+  // Use ordered map to make the output deterministic
+  std::map<std::string, RangeSample> OrderedCounter(Counter.begin(),
+                                                    Counter.end());
+  for (auto Range : OrderedCounter) {
     outs() << Range.first << "\n";
     for (auto I : Range.second) {
       outs() << "  (" << format("%" PRIx64, I.first.first) << ", "
Index: llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
===================================================================
--- llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
+++ llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
@@ -10,13 +10,14 @@
 ; CHECK: 1: 14
 
 ; CHECK-UNWINDER: Binary(inline-cs-noprobe.perfbin)'s Range Counter:
-; CHECK-UNWINDER: main:1 @ foo:3.2 @ bar
-; CHECK-UNWINDER:   (6af, 6bb): 14
 ; CHECK-UNWINDER: main:1 @ foo
 ; CHECK-UNWINDER:   (670, 6ad): 1
 ; CHECK-UNWINDER:   (67e, 69b): 1
 ; CHECK-UNWINDER:   (67e, 6ad): 13
 ; CHECK-UNWINDER:   (6bd, 6c8): 14
+; CHECK-UNWINDER: main:1 @ foo:3.2 @ bar
+; CHECK-UNWINDER:   (6af, 6bb): 14
+
 
 ; CHECK-UNWINDER: Binary(inline-cs-noprobe.perfbin)'s Branch Counter:
 ; CHECK-UNWINDER: main:1 @ foo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92816.310091.patch
Type: text/x-patch
Size: 1478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201208/a2165781/attachment.bin>
    
    
More information about the llvm-commits
mailing list