[llvm] r276407 - [llvm-profdata] Bring back reading profile data from STDIN.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 05:39:56 PDT 2016


Author: d0k
Date: Fri Jul 22 07:39:55 2016
New Revision: 276407

URL: http://llvm.org/viewvc/llvm-project?rev=276407&view=rev
Log:
[llvm-profdata] Bring back reading profile data from STDIN.

This feature was lost in r276197.

Modified:
    llvm/trunk/test/tools/llvm-profdata/inline-samples.test
    llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp

Modified: llvm/trunk/test/tools/llvm-profdata/inline-samples.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/inline-samples.test?rev=276407&r1=276406&r2=276407&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/inline-samples.test (original)
+++ llvm/trunk/test/tools/llvm-profdata/inline-samples.test Fri Jul 22 07:39:55 2016
@@ -23,6 +23,7 @@ RUN: diff %t-bintext %t-text
 4- Merge the binary and text encodings of the profile and check that the
    counters have doubled.
 RUN: llvm-profdata merge --sample --text %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1
+RUN: llvm-profdata merge --sample --text - < %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1
 MERGE1: main:733692:0
 MERGE1: 2.3: 120802
 MERGE1: 2.3: _Z3fool:492088

Modified: llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp?rev=276407&r1=276406&r2=276407&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp (original)
+++ llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp Fri Jul 22 07:39:55 2016
@@ -319,6 +319,13 @@ getInputFilenamesFileBuf(const StringRef
 static void addWeightedInput(WeightedFileVector &WNI, const WeightedFile &WF) {
   StringRef Filename = WF.Filename;
   uint64_t Weight = WF.Weight;
+
+  // If it's STDIN just pass it on.
+  if (Filename == "-") {
+    WNI.push_back({Filename, Weight});
+    return;
+  }
+
   llvm::sys::fs::file_status Status;
   llvm::sys::fs::status(Filename, Status);
   if (!llvm::sys::fs::exists(Status))




More information about the llvm-commits mailing list