summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/CommandGuide/index.rst1
-rw-r--r--docs/CommandGuide/llvm-profdata.rst29
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/lit.cfg1
-rw-r--r--test/tools/llvm-profdata/Inputs/bad-function-count.profdata2
-rw-r--r--test/tools/llvm-profdata/Inputs/bar3-1.profdata4
-rw-r--r--test/tools/llvm-profdata/Inputs/empty.profdata0
-rw-r--r--test/tools/llvm-profdata/Inputs/extra-word.profdata2
-rw-r--r--test/tools/llvm-profdata/Inputs/foo3-1.profdata4
-rw-r--r--test/tools/llvm-profdata/Inputs/foo3-2.profdata4
-rw-r--r--test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata9
-rw-r--r--test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata9
-rw-r--r--test/tools/llvm-profdata/Inputs/foo4-1.profdata5
-rw-r--r--test/tools/llvm-profdata/Inputs/foo4-2.profdata5
-rw-r--r--test/tools/llvm-profdata/Inputs/invalid-count-later.profdata2
-rw-r--r--test/tools/llvm-profdata/Inputs/overflow.profdata2
-rw-r--r--test/tools/llvm-profdata/Inputs/three-words-long.profdata1
-rw-r--r--test/tools/llvm-profdata/errors.test22
-rw-r--r--test/tools/llvm-profdata/simple.test25
-rw-r--r--tools/CMakeLists.txt1
-rw-r--r--tools/LLVMBuild.txt2
-rw-r--r--tools/Makefile2
-rw-r--r--tools/llvm-profdata/CMakeLists.txt5
-rw-r--r--tools/llvm-profdata/LLVMBuild.txt22
-rw-r--r--tools/llvm-profdata/Makefile17
-rw-r--r--tools/llvm-profdata/llvm-profdata.cpp178
26 files changed, 353 insertions, 2 deletions
diff --git a/docs/CommandGuide/index.rst b/docs/CommandGuide/index.rst
index d799941aea..ab4788aee7 100644
--- a/docs/CommandGuide/index.rst
+++ b/docs/CommandGuide/index.rst
@@ -25,6 +25,7 @@ Basic Commands
llvm-config
llvm-diff
llvm-cov
+ llvm-profdata
llvm-stress
llvm-symbolizer
diff --git a/docs/CommandGuide/llvm-profdata.rst b/docs/CommandGuide/llvm-profdata.rst
new file mode 100644
index 0000000000..6b8e4d7ed5
--- /dev/null
+++ b/docs/CommandGuide/llvm-profdata.rst
@@ -0,0 +1,29 @@
+llvm-profdata - work with profile data
+======================================
+
+SYNOPSIS
+--------
+
+:program:`llvm-profdata` [-output=output] file1 file2
+
+DESCRIPTION
+-----------
+
+The experimental :program:`llvm-profdata` tool reads two profile data files
+generated by PGO instrumentation and generates a file with merged data.
+
+The profile data format itself is currently textual.
+
+OPTIONS
+-------
+
+.. option:: -output=output
+
+ This option selects the output filename. If not specified, output is to
+ stdout.
+
+EXIT STATUS
+-----------
+
+:program:`llvm-profdata` returns 1 if it cannot read input files or there is a
+mismatch between their data.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 835579c8f6..d26d0f3a1a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -37,6 +37,7 @@ set(LLVM_TEST_DEPENDS
llvm-mcmarkup
llvm-nm
llvm-objdump
+ llvm-profdata
llvm-readobj
llvm-rtdyld
llvm-symbolizer
diff --git a/test/lit.cfg b/test/lit.cfg
index 962728d0cb..ac8d4497f0 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -234,6 +234,7 @@ for pattern in [r"\bbugpoint\b(?!-)",
r"\bllvm-mcmarkup\b",
r"\bllvm-nm\b",
r"\bllvm-objdump\b",
+ r"\bllvm-profdata\b",
r"\bllvm-ranlib\b",
r"\bllvm-readobj\b",
r"\bllvm-rtdyld\b",
diff --git a/test/tools/llvm-profdata/Inputs/bad-function-count.profdata b/test/tools/llvm-profdata/Inputs/bad-function-count.profdata
new file mode 100644
index 0000000000..7d247626e5
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/bad-function-count.profdata
@@ -0,0 +1,2 @@
+function_count_not 1count
+1
diff --git a/test/tools/llvm-profdata/Inputs/bar3-1.profdata b/test/tools/llvm-profdata/Inputs/bar3-1.profdata
new file mode 100644
index 0000000000..cb8b409891
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/bar3-1.profdata
@@ -0,0 +1,4 @@
+bar 3
+1
+2
+3
diff --git a/test/tools/llvm-profdata/Inputs/empty.profdata b/test/tools/llvm-profdata/Inputs/empty.profdata
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/empty.profdata
diff --git a/test/tools/llvm-profdata/Inputs/extra-word.profdata b/test/tools/llvm-profdata/Inputs/extra-word.profdata
new file mode 100644
index 0000000000..67a662909c
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/extra-word.profdata
@@ -0,0 +1,2 @@
+extra 1 word
+1
diff --git a/test/tools/llvm-profdata/Inputs/foo3-1.profdata b/test/tools/llvm-profdata/Inputs/foo3-1.profdata
new file mode 100644
index 0000000000..d6f9f648b7
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo3-1.profdata
@@ -0,0 +1,4 @@
+foo 3
+1
+2
+3
diff --git a/test/tools/llvm-profdata/Inputs/foo3-2.profdata b/test/tools/llvm-profdata/Inputs/foo3-2.profdata
new file mode 100644
index 0000000000..94fd034391
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo3-2.profdata
@@ -0,0 +1,4 @@
+foo 3
+7
+5
+3
diff --git a/test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata b/test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata
new file mode 100644
index 0000000000..85b702d497
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata
@@ -0,0 +1,9 @@
+foo 3
+2
+3
+5
+
+bar 3
+7
+11
+13
diff --git a/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata b/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata
new file mode 100644
index 0000000000..d652781a35
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata
@@ -0,0 +1,9 @@
+foo 3
+17
+19
+23
+
+bar 3
+29
+31
+37
diff --git a/test/tools/llvm-profdata/Inputs/foo4-1.profdata b/test/tools/llvm-profdata/Inputs/foo4-1.profdata
new file mode 100644
index 0000000000..4d694080bf
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo4-1.profdata
@@ -0,0 +1,5 @@
+foo 4
+11
+22
+33
+44
diff --git a/test/tools/llvm-profdata/Inputs/foo4-2.profdata b/test/tools/llvm-profdata/Inputs/foo4-2.profdata
new file mode 100644
index 0000000000..8d91d8bbef
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/foo4-2.profdata
@@ -0,0 +1,5 @@
+foo 4
+7
+6
+5
+4
diff --git a/test/tools/llvm-profdata/Inputs/invalid-count-later.profdata b/test/tools/llvm-profdata/Inputs/invalid-count-later.profdata
new file mode 100644
index 0000000000..5575df3fda
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/invalid-count-later.profdata
@@ -0,0 +1,2 @@
+invalid_count 1
+1later
diff --git a/test/tools/llvm-profdata/Inputs/overflow.profdata b/test/tools/llvm-profdata/Inputs/overflow.profdata
new file mode 100644
index 0000000000..bfb9a52d2e
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/overflow.profdata
@@ -0,0 +1,2 @@
+overflow 1
+9223372036854775808
diff --git a/test/tools/llvm-profdata/Inputs/three-words-long.profdata b/test/tools/llvm-profdata/Inputs/three-words-long.profdata
new file mode 100644
index 0000000000..a4d45fb3bf
--- /dev/null
+++ b/test/tools/llvm-profdata/Inputs/three-words-long.profdata
@@ -0,0 +1 @@
+three words long
diff --git a/test/tools/llvm-profdata/errors.test b/test/tools/llvm-profdata/errors.test
new file mode 100644
index 0000000000..6335ea95f9
--- /dev/null
+++ b/test/tools/llvm-profdata/errors.test
@@ -0,0 +1,22 @@
+RUN: not llvm-profdata %p/Inputs/empty.profdata %p/Inputs/foo3-1.profdata 2>&1 | FileCheck %s --check-prefix=LENGTH
+RUN: not llvm-profdata %p/Inputs/foo3-1.profdata %p/Inputs/foo3bar3-1.profdata 2>&1 | FileCheck %s --check-prefix=LENGTH
+RUN: not llvm-profdata %p/Inputs/foo4-1.profdata %p/Inputs/empty.profdata 2>&1 | FileCheck %s --check-prefix=LENGTH
+LENGTH: error: {{.*}}: truncated file
+
+RUN: not llvm-profdata %p/Inputs/foo3-1.profdata %p/Inputs/bar3-1.profdata 2>&1 | FileCheck %s --check-prefix=NAME
+NAME: error: {{.*}}: function name mismatch
+
+RUN: not llvm-profdata %p/Inputs/foo3-1.profdata %p/Inputs/foo4-1.profdata 2>&1 | FileCheck %s --check-prefix=COUNT
+COUNT: error: {{.*}}: function count mismatch
+
+RUN: not llvm-profdata %p/Inputs/overflow.profdata %p/Inputs/overflow.profdata 2>&1 | FileCheck %s --check-prefix=OVERFLOW
+OVERFLOW: error: {{.*}}: counter overflow
+
+RUN: not llvm-profdata %p/Inputs/invalid-count-later.profdata %p/Inputs/invalid-count-later.profdata 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER
+INVALID-COUNT-LATER: error: {{.*}}: invalid counter
+
+RUN: not llvm-profdata %p/Inputs/bad-function-count.profdata %p/Inputs/bad-function-count.profdata 2>&1 | FileCheck %s --check-prefix=BAD-FUNCTION-COUNT
+BAD-FUNCTION-COUNT: error: {{.*}}: bad function count
+
+RUN: not llvm-profdata %p/Inputs/three-words-long.profdata %p/Inputs/three-words-long.profdata 2>&1 | FileCheck %s --check-prefix=INVALID-DATA
+INVALID-DATA: error: {{.*}}: invalid data
diff --git a/test/tools/llvm-profdata/simple.test b/test/tools/llvm-profdata/simple.test
new file mode 100644
index 0000000000..87073fad9c
--- /dev/null
+++ b/test/tools/llvm-profdata/simple.test
@@ -0,0 +1,25 @@
+RUN: llvm-profdata %p/Inputs/foo3-1.profdata %p/Inputs/foo3-2.profdata 2>&1 | FileCheck %s --check-prefix=FOO3
+RUN: llvm-profdata %p/Inputs/foo3-2.profdata %p/Inputs/foo3-1.profdata 2>&1 | FileCheck %s --check-prefix=FOO3
+FOO3: {{^foo 3$}}
+FOO3-NEXT: {{^8$}}
+FOO3-NEXT: {{^7$}}
+FOO3-NEXT: {{^6$}}
+
+RUN: llvm-profdata %p/Inputs/foo4-1.profdata %p/Inputs/foo4-2.profdata 2>&1 | FileCheck %s --check-prefix=FOO4
+RUN: llvm-profdata %p/Inputs/foo4-2.profdata %p/Inputs/foo4-1.profdata 2>&1 | FileCheck %s --check-prefix=FOO4
+FOO4: {{^foo 4$}}
+FOO4-NEXT: {{^18$}}
+FOO4-NEXT: {{^28$}}
+FOO4-NEXT: {{^38$}}
+FOO4-NEXT: {{^48$}}
+
+RUN: llvm-profdata %p/Inputs/foo3bar3-1.profdata %p/Inputs/foo3bar3-2.profdata 2>&1 | FileCheck %s --check-prefix=FOO3BAR3
+RUN: llvm-profdata %p/Inputs/foo3bar3-2.profdata %p/Inputs/foo3bar3-1.profdata 2>&1 | FileCheck %s --check-prefix=FOO3BAR3
+FOO3BAR3: {{^foo 3$}}
+FOO3BAR3-NEXT: {{^19$}}
+FOO3BAR3-NEXT: {{^22$}}
+FOO3BAR3-NEXT: {{^28$}}
+FOO3BAR3: {{^bar 3$}}
+FOO3BAR3-NEXT: {{^36$}}
+FOO3BAR3-NEXT: {{^42$}}
+FOO3BAR3-NEXT: {{^50$}}
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 12e10fd0bb..5f006594c5 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -15,6 +15,7 @@ add_llvm_tool_subdirectory(llvm-nm)
add_llvm_tool_subdirectory(llvm-size)
add_llvm_tool_subdirectory(llvm-cov)
+add_llvm_tool_subdirectory(llvm-profdata)
add_llvm_tool_subdirectory(llvm-link)
add_llvm_tool_subdirectory(lli)
diff --git a/tools/LLVMBuild.txt b/tools/LLVMBuild.txt
index 93b8d98dcb..1b537a372d 100644
--- a/tools/LLVMBuild.txt
+++ b/tools/LLVMBuild.txt
@@ -16,7 +16,7 @@
;===------------------------------------------------------------------------===;
[common]
-subdirectories = bugpoint llc lli llvm-ar llvm-as llvm-bcanalyzer llvm-cov llvm-diff llvm-dis llvm-dwarfdump llvm-extract llvm-jitlistener llvm-link llvm-lto llvm-mc llvm-nm llvm-objdump llvm-rtdyld llvm-size macho-dump opt llvm-mcmarkup
+subdirectories = bugpoint llc lli llvm-ar llvm-as llvm-bcanalyzer llvm-cov llvm-diff llvm-dis llvm-dwarfdump llvm-extract llvm-jitlistener llvm-link llvm-lto llvm-mc llvm-nm llvm-objdump llvm-profdata llvm-rtdyld llvm-size macho-dump opt llvm-mcmarkup
[component_0]
type = Group
diff --git a/tools/Makefile b/tools/Makefile
index be872548e3..2b8c32ee32 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -31,7 +31,7 @@ PARALLEL_DIRS := opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link \
lli llvm-extract llvm-mc bugpoint llvm-bcanalyzer llvm-diff \
macho-dump llvm-objdump llvm-readobj llvm-rtdyld \
llvm-dwarfdump llvm-cov llvm-size llvm-stress llvm-mcmarkup \
- llvm-symbolizer obj2yaml yaml2obj llvm-c-test
+ llvm-profdata llvm-symbolizer obj2yaml yaml2obj llvm-c-test
# If Intel JIT Events support is configured, build an extra tool to test it.
ifeq ($(USE_INTEL_JITEVENTS), 1)
diff --git a/tools/llvm-profdata/CMakeLists.txt b/tools/llvm-profdata/CMakeLists.txt
new file mode 100644
index 0000000000..4b1357d87e
--- /dev/null
+++ b/tools/llvm-profdata/CMakeLists.txt
@@ -0,0 +1,5 @@
+set(LLVM_LINK_COMPONENTS core support )
+
+add_llvm_tool(llvm-profdata
+ llvm-profdata.cpp
+ )
diff --git a/tools/llvm-profdata/LLVMBuild.txt b/tools/llvm-profdata/LLVMBuild.txt
new file mode 100644
index 0000000000..fc9e469199
--- /dev/null
+++ b/tools/llvm-profdata/LLVMBuild.txt
@@ -0,0 +1,22 @@
+;===- ./tools/llvm-profdata/LLVMBuild.txt ----------------------*- Conf -*--===;
+;
+; The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+; http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Tool
+name = llvm-profdata
+parent = Tools
+required_libraries = Support
diff --git a/tools/llvm-profdata/Makefile b/tools/llvm-profdata/Makefile
new file mode 100644
index 0000000000..9d7ad527b1
--- /dev/null
+++ b/tools/llvm-profdata/Makefile
@@ -0,0 +1,17 @@
+##===- tools/llvm-profdata/Makefile ------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL := ../..
+TOOLNAME := llvm-profdata
+LINK_COMPONENTS := core support
+
+# This tool has no plugins, optimize startup time.
+TOOL_NO_EXPORTS := 1
+
+include $(LEVEL)/Makefile.common
diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp
new file mode 100644
index 0000000000..df10356eef
--- /dev/null
+++ b/tools/llvm-profdata/llvm-profdata.cpp
@@ -0,0 +1,178 @@
+//===- llvm-profdata.cpp - LLVM profile data tool -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// llvm-profdata merges .profdata files.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/OwningPtr.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+static cl::opt<std::string> Filename1(cl::Positional, cl::Required,
+ cl::desc("file1"));
+static cl::opt<std::string> Filename2(cl::Positional, cl::Required,
+ cl::desc("file2"));
+
+static cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
+ cl::init("-"),
+ cl::desc("Output file"));
+static cl::alias OutputFilenameA("o", cl::desc("Alias for --output"),
+ cl::aliasopt(OutputFilename));
+
+static bool readLine(const char *&Start, const char *End, StringRef &S) {
+ if (Start == End)
+ return false;
+
+ for (const char *I = Start; I != End; ++I) {
+ assert(*I && "unexpected binary data");
+ if (*I == '\n') {
+ S = StringRef(Start, I - Start);
+ Start = I + 1;
+ return true;
+ }
+ }
+
+ S = StringRef(Start, End - Start);
+ Start = End;
+ return true;
+}
+
+static StringRef getWord(const char *&Start, const char *End) {
+ for (const char *I = Start; I != End; ++I)
+ if (*I == ' ') {
+ StringRef S(Start, I - Start);
+ Start = I + 1;
+ return S;
+ }
+ StringRef S(Start, End - Start);
+ Start = End;
+ return S;
+}
+
+static size_t splitWords(const StringRef &Line, std::vector<StringRef> &Words) {
+ const char *Start = Line.data();
+ const char *End = Line.data() + Line.size();
+ Words.clear();
+ while (Start != End)
+ Words.push_back(getWord(Start, End));
+ return Words.size();
+}
+
+static bool getNumber(const StringRef &S, uint64_t &N) {
+ N = 0;
+ for (StringRef::iterator I = S.begin(), E = S.end(); I != E; ++I)
+ if (*I >= '0' && *I <= '9')
+ N = N * 10 + (*I - '0');
+ else
+ return false;
+
+ return true;
+}
+
+static void exitWithError(const std::string &Message,
+ const std::string &Filename, int64_t Line = -1) {
+ errs() << "error: " << Filename;
+ if (Line >= 0)
+ errs() << ":" << Line;
+ errs() << ": " << Message << "\n";
+ ::exit(1);
+}
+
+//===----------------------------------------------------------------------===//
+int main(int argc, char **argv) {
+ // Print a stack trace if we signal out.
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+
+ cl::ParseCommandLineOptions(argc, argv, "LLVM profile data merger\n");
+
+ OwningPtr<MemoryBuffer> File1;
+ OwningPtr<MemoryBuffer> File2;
+ if (error_code ec = MemoryBuffer::getFile(Filename1, File1))
+ exitWithError(ec.message(), Filename1);
+ if (error_code ec = MemoryBuffer::getFile(Filename2, File2))
+ exitWithError(ec.message(), Filename2);
+
+ if (OutputFilename.empty())
+ OutputFilename = "-";
+
+ std::string ErrorInfo;
+ raw_fd_ostream Output(OutputFilename.data(), ErrorInfo);
+ if (!ErrorInfo.empty())
+ exitWithError(ErrorInfo, OutputFilename);
+
+ const char *Start1 = File1->getBufferStart();
+ const char *Start2 = File2->getBufferStart();
+ const char *End1 = File1->getBufferEnd();
+ const char *End2 = File2->getBufferEnd();
+ const char *P1 = Start1;
+ const char *P2 = Start2;
+
+ StringRef Line1, Line2;
+ int64_t Num = 0;
+ while (readLine(P1, End1, Line1)) {
+ ++Num;
+ if (!readLine(P2, End2, Line2))
+ exitWithError("truncated file", Filename2, Num);
+
+ std::vector<StringRef> Words1, Words2;
+ if (splitWords(Line1, Words1) != splitWords(Line2, Words2))
+ exitWithError("data mismatch", Filename2, Num);
+
+ if (Words1.size() > 2)
+ exitWithError("invalid data", Filename1, Num);
+
+ if (Words1.empty()) {
+ Output << "\n";
+ continue;
+ }
+
+ if (Words1.size() == 2) {
+ if (Words1[0] != Words2[0])
+ exitWithError("function name mismatch", Filename2, Num);
+
+ uint64_t N1, N2;
+ if (!getNumber(Words1[1], N1))
+ exitWithError("bad function count", Filename1, Num);
+ if (!getNumber(Words2[1], N2))
+ exitWithError("bad function count", Filename2, Num);
+
+ if (N1 != N2)
+ exitWithError("function count mismatch", Filename2, Num);
+
+ Output << Line1 << "\n";
+ continue;
+ }
+
+ uint64_t N1, N2;
+ if (!getNumber(Words1[0], N1))
+ exitWithError("invalid counter", Filename1, Num);
+ if (!getNumber(Words2[0], N2))
+ exitWithError("invalid counter", Filename2, Num);
+
+ uint64_t Sum = N1 + N2;
+ if (Sum < N1)
+ exitWithError("counter overflow", Filename2, Num);
+
+ Output << N1 + N2 << "\n";
+ }
+ if (readLine(P2, End2, Line2))
+ exitWithError("truncated file", Filename1, Num + 1);
+
+ return 0;
+}