summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/tools/llvm-profdata/inline-samples.test1
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-profdata/inline-samples.test b/llvm/test/tools/llvm-profdata/inline-samples.test
index 421f002da9f..d97d82ea644 100644
--- a/llvm/test/tools/llvm-profdata/inline-samples.test
+++ b/llvm/test/tools/llvm-profdata/inline-samples.test
@@ -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
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 85106ec98d4..aec689b623f 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -319,6 +319,13 @@ getInputFilenamesFileBuf(const StringRef &InputFilenamesFile) {
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))
OpenPOWER on IntegriCloud