From 911ced6bf384dfcb9da007434a951ed2270e8993 Mon Sep 17 00:00:00 2001 From: Nathan Slingerland Date: Thu, 12 Nov 2015 18:39:26 +0000 Subject: reverting r252916 to investigate test failure llvm-svn: 252921 --- llvm/lib/ProfileData/InstrProfReader.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'llvm/lib/ProfileData/InstrProfReader.cpp') diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index 6f20124..bf10b44 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -54,10 +54,8 @@ InstrProfReader::create(std::unique_ptr Buffer) { Result.reset(new RawInstrProfReader64(std::move(Buffer))); else if (RawInstrProfReader32::hasFormat(*Buffer)) Result.reset(new RawInstrProfReader32(std::move(Buffer))); - else if (TextInstrProfReader::hasFormat(*Buffer)) - Result.reset(new TextInstrProfReader(std::move(Buffer))); else - return instrprof_error::unrecognized_format; + Result.reset(new TextInstrProfReader(std::move(Buffer))); // Initialize the reader and return the result. if (std::error_code EC = initializeReader(*Result)) @@ -99,15 +97,6 @@ void InstrProfIterator::Increment() { *this = InstrProfIterator(); } -bool TextInstrProfReader::hasFormat(const MemoryBuffer &Buffer) { - // Verify that this really looks like plain ASCII text by checking a - // 'reasonable' number of characters (up to profile magic size). - size_t count = std::min(Buffer.getBufferSize(), sizeof(uint64_t)); - StringRef buffer = Buffer.getBufferStart(); - return count == 0 || std::all_of(buffer.begin(), buffer.begin() + count, - [](char c) { return ::isprint(c) || ::isspace(c); }); -} - std::error_code TextInstrProfReader::readNextRecord(InstrProfRecord &Record) { // Skip empty lines and comments. while (!Line.is_at_end() && (Line->empty() || Line->startswith("#"))) -- cgit v1.1