From d0dfb67fe18e24de6e45d6cfaca8ef91f36cbd26 Mon Sep 17 00:00:00 2001 From: Rong Xu Date: Mon, 8 Feb 2016 23:11:16 +0000 Subject: [PATCH] [PGO] Revert r260146 as it breaks Darwin platforms. r260146 | xur | 2016-02-08 13:07:46 -0800 (Mon, 08 Feb 2016) | 13 lines [PGO] Differentiate Clang instrumentation and IR level instrumentation profiles llvm-svn: 260170 --- .../llvm/ProfileData/InstrProfData.inc | 4 +-- .../llvm/ProfileData/InstrProfReader.h | 22 ++------------ .../llvm/ProfileData/InstrProfWriter.h | 12 -------- llvm/lib/ProfileData/InstrProfReader.cpp | 30 ++++--------------- llvm/lib/ProfileData/InstrProfWriter.cpp | 6 +--- .../Instrumentation/PGOInstrumentation.cpp | 22 -------------- .../PGOProfile/Inputs/branch1.proftext | 2 -- .../PGOProfile/Inputs/branch2.proftext | 2 -- .../PGOProfile/Inputs/criticaledge.proftext | 2 -- .../PGOProfile/Inputs/diag.proftext | 2 -- .../PGOProfile/Inputs/diag_FE.proftext | 5 ---- .../PGOProfile/Inputs/landingpad.proftext | 2 -- .../PGOProfile/Inputs/loop1.proftext | 2 -- .../PGOProfile/Inputs/loop2.proftext | 2 -- .../PGOProfile/Inputs/switch.proftext | 2 -- llvm/test/Transforms/PGOProfile/branch1.ll | 2 -- llvm/test/Transforms/PGOProfile/branch2.ll | 2 -- .../Transforms/PGOProfile/criticaledge.ll | 2 -- .../Transforms/PGOProfile/diag_FE_profile.ll | 12 -------- llvm/test/Transforms/PGOProfile/landingpad.ll | 2 -- llvm/test/Transforms/PGOProfile/loop1.ll | 2 -- llvm/test/Transforms/PGOProfile/loop2.ll | 2 -- llvm/test/Transforms/PGOProfile/single_bb.ll | 2 -- llvm/test/Transforms/PGOProfile/switch.ll | 2 -- llvm/tools/llvm-profdata/llvm-profdata.cpp | 15 +++------- 25 files changed, 13 insertions(+), 147 deletions(-) delete mode 100644 llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext delete mode 100644 llvm/test/Transforms/PGOProfile/diag_FE_profile.ll diff --git a/llvm/include/llvm/ProfileData/InstrProfData.inc b/llvm/include/llvm/ProfileData/InstrProfData.inc index 1d53c514ca9e..4f196c5f9f43 100644 --- a/llvm/include/llvm/ProfileData/InstrProfData.inc +++ b/llvm/include/llvm/ProfileData/InstrProfData.inc @@ -705,11 +705,9 @@ serializeValueProfDataFromRT(const ValueProfRuntimeRecord *Record, * version for other variants of profile. We set the lowest bit of the upper 8 * bits (i.e. bit 56) to 1 to indicate if this is an IR-level instrumentaiton * generated profile, and 0 if this is a Clang FE generated profile. - */ +*/ #define VARIANT_MASKS_ALL 0xff00000000000000ULL #define GET_VERSION(V) ((V) & ~VARIANT_MASKS_ALL) -#define VARIANT_MASK_IR_PROF (0x1ULL << 56) -#define IR_LEVEL_PROF_VERSION_VAR __llvm_profile_raw_version /* Runtime section names and name strings. */ #define INSTR_PROF_DATA_SECT_NAME __llvm_prf_data diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h index af715ccd06e5..ee824c83aa40 100644 --- a/llvm/include/llvm/ProfileData/InstrProfReader.h +++ b/llvm/include/llvm/ProfileData/InstrProfReader.h @@ -64,7 +64,6 @@ public: /// Iterator over profile data. InstrProfIterator begin() { return InstrProfIterator(this); } InstrProfIterator end() { return InstrProfIterator(); } - virtual bool isIRLevelProfile() const = 0; /// Return the PGO symtab. There are three different readers: /// Raw, Text, and Indexed profile readers. The first two types @@ -119,7 +118,6 @@ private: std::unique_ptr DataBuffer; /// Iterator over the profile data. line_iterator Line; - bool IsIRLevelProfile; TextInstrProfReader(const TextInstrProfReader &) = delete; TextInstrProfReader &operator=(const TextInstrProfReader &) = delete; @@ -127,14 +125,11 @@ private: public: TextInstrProfReader(std::unique_ptr DataBuffer_) - : DataBuffer(std::move(DataBuffer_)), Line(*DataBuffer, true, '#'), - IsIRLevelProfile(false) {} + : DataBuffer(std::move(DataBuffer_)), Line(*DataBuffer, true, '#') {} /// Return true if the given buffer is in text instrprof format. static bool hasFormat(const MemoryBuffer &Buffer); - bool isIRLevelProfile() const override { return IsIRLevelProfile; } - /// Read the header. std::error_code readHeader() override; /// Read a single record. @@ -159,10 +154,6 @@ private: /// The profile data file contents. std::unique_ptr DataBuffer; bool ShouldSwapBytes; - // The value of the version field of the raw profile data header. The lower 56 - // bits specifies the format version and the most significant 8 bits specify - // the variant types of the profile. - uint64_t Version; uint64_t CountersDelta; uint64_t NamesDelta; const RawInstrProf::ProfileData *Data; @@ -186,9 +177,6 @@ public: static bool hasFormat(const MemoryBuffer &DataBuffer); std::error_code readHeader() override; std::error_code readNextRecord(InstrProfRecord &Record) override; - bool isIRLevelProfile() const override { - return (Version & VARIANT_MASK_IR_PROF) != 0; - } InstrProfSymtab &getSymtab() override { assert(Symtab.get()); @@ -304,7 +292,6 @@ struct InstrProfReaderIndexBase { virtual void setValueProfDataEndianness(support::endianness Endianness) = 0; virtual ~InstrProfReaderIndexBase() {} virtual uint64_t getVersion() const = 0; - virtual bool isIRLevelProfile() const = 0; virtual void populateSymtab(InstrProfSymtab &) = 0; }; @@ -336,10 +323,7 @@ public: HashTable->getInfoObj().setValueProfDataEndianness(Endianness); } ~InstrProfReaderIndex() override {} - uint64_t getVersion() const override { return GET_VERSION(FormatVersion); } - bool isIRLevelProfile() const override { - return (FormatVersion & VARIANT_MASK_IR_PROF) != 0; - } + uint64_t getVersion() const override { return FormatVersion; } void populateSymtab(InstrProfSymtab &Symtab) override { Symtab.create(HashTable->keys()); } @@ -364,9 +348,7 @@ private: const unsigned char *Cur); public: - /// Return the profile version. uint64_t getVersion() const { return Index->getVersion(); } - bool isIRLevelProfile() const override { return Index->isIRLevelProfile(); } IndexedInstrProfReader(std::unique_ptr DataBuffer) : DataBuffer(std::move(DataBuffer)), Index(nullptr) {} diff --git a/llvm/include/llvm/ProfileData/InstrProfWriter.h b/llvm/include/llvm/ProfileData/InstrProfWriter.h index 8b02d3cc9ed3..282b3297b1a4 100644 --- a/llvm/include/llvm/ProfileData/InstrProfWriter.h +++ b/llvm/include/llvm/ProfileData/InstrProfWriter.h @@ -30,12 +30,10 @@ class InstrProfRecordWriterTrait; class InstrProfWriter { public: typedef SmallDenseMap ProfilingData; - enum ProfKind { PF_Unknown = 0, PF_FE, PF_IRLevel }; private: bool Sparse; StringMap FunctionData; - ProfKind ProfileKind; // Use raw pointer here for the incomplete type object. InstrProfRecordWriterTrait *InfoObj; @@ -57,16 +55,6 @@ public: /// Write the profile, returning the raw data. For testing. std::unique_ptr writeBuffer(); - /// Set the ProfileKind. Report error if mixing FE and IR level profiles. - std::error_code setIsIRLevelProfile(bool IsIRLevel) { - if (ProfileKind == PF_Unknown) { - ProfileKind = IsIRLevel ? PF_IRLevel: PF_FE; - return instrprof_error::success; - } - return (IsIRLevel == (ProfileKind == PF_IRLevel)) ? - instrprof_error::success : instrprof_error::unsupported_version; - } - // Internal interface for testing purpose only. void setValueProfDataEndianness(support::endianness Endianness); void setOutputSparse(bool Sparse); diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index 7968cf1f60d8..f189713c77ab 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -109,26 +109,8 @@ bool TextInstrProfReader::hasFormat(const MemoryBuffer &Buffer) { [](char c) { return ::isprint(c) || ::isspace(c); }); } -// Read the profile variant flag from the header: ":FE" means this is a FE -// generated profile. ":IR" means this is an IR level profile. Other strings -// with a leading ':' will be reported an error format. std::error_code TextInstrProfReader::readHeader() { Symtab.reset(new InstrProfSymtab()); - bool IsIRInstr = false; - if (!Line->startswith(":")) { - IsIRLevelProfile = false; - return success(); - } - StringRef Str = (Line)->substr(1); - if (Str.equals_lower("ir")) - IsIRInstr = true; - else if (Str.equals_lower("fe")) - IsIRInstr = false; - else - return instrprof_error::bad_header; - - ++Line; - IsIRLevelProfile = IsIRInstr; return success(); } @@ -311,8 +293,7 @@ void RawInstrProfReader::createSymtab(InstrProfSymtab &Symtab) { template std::error_code RawInstrProfReader::readHeader(const RawInstrProf::Header &Header) { - Version = swap(Header.Version); - if (GET_VERSION(Version) != RawInstrProf::Version) + if (swap(Header.Version) != RawInstrProf::Version) return error(instrprof_error::unsupported_version); CountersDelta = swap(Header.CountersDelta); @@ -489,10 +470,10 @@ data_type InstrProfLookupTrait::ReadData(StringRef K, const unsigned char *D, return data_type(); uint64_t Hash = endian::readNext(D); - // Initialize number of counters for GET_VERSION(FormatVersion) == 1. + // Initialize number of counters for FormatVersion == 1. uint64_t CountsSize = N / sizeof(uint64_t) - 1; // If format version is different then read the number of counters. - if (GET_VERSION(FormatVersion) != IndexedInstrProf::ProfVersion::Version1) { + if (FormatVersion != IndexedInstrProf::ProfVersion::Version1) { if (D + sizeof(uint64_t) > End) return data_type(); CountsSize = endian::readNext(D); @@ -509,7 +490,7 @@ data_type InstrProfLookupTrait::ReadData(StringRef K, const unsigned char *D, DataBuffer.emplace_back(K, Hash, std::move(CounterBuffer)); // Read value profiling data. - if (GET_VERSION(FormatVersion) > IndexedInstrProf::ProfVersion::Version2 && + if (FormatVersion > IndexedInstrProf::ProfVersion::Version2 && !readValueProfilingData(D, End)) { DataBuffer.clear(); return data_type(); @@ -622,8 +603,7 @@ std::error_code IndexedInstrProfReader::readHeader() { // Read the version. uint64_t FormatVersion = endian::byte_swap(Header->Version); - if (GET_VERSION(FormatVersion) > - IndexedInstrProf::ProfVersion::CurrentVersion) + if (FormatVersion > IndexedInstrProf::ProfVersion::CurrentVersion) return error(instrprof_error::unsupported_version); Cur = readSummary((IndexedInstrProf::ProfVersion)FormatVersion, Cur); diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp index 3e325718769b..a486d4eecb7d 100644 --- a/llvm/lib/ProfileData/InstrProfWriter.cpp +++ b/llvm/lib/ProfileData/InstrProfWriter.cpp @@ -142,7 +142,7 @@ public: } InstrProfWriter::InstrProfWriter(bool Sparse) - : Sparse(Sparse), FunctionData(), ProfileKind(PF_Unknown), + : Sparse(Sparse), FunctionData(), InfoObj(new InstrProfRecordWriterTrait()) {} InstrProfWriter::~InstrProfWriter() { delete InfoObj; } @@ -230,8 +230,6 @@ void InstrProfWriter::writeImpl(ProfOStream &OS) { IndexedInstrProf::Header Header; Header.Magic = IndexedInstrProf::Magic; Header.Version = IndexedInstrProf::ProfVersion::CurrentVersion; - if (ProfileKind == PF_IRLevel) - Header.Version |= VARIANT_MASK_IR_PROF; Header.Unused = 0; Header.HashType = static_cast(IndexedInstrProf::HashType); Header.HashOffset = 0; @@ -338,8 +336,6 @@ void InstrProfWriter::writeRecordInText(const InstrProfRecord &Func, } void InstrProfWriter::writeText(raw_fd_ostream &OS) { - if (ProfileKind == PF_IRLevel) - OS << "# IR level Instrumentation Flag\n:ir\n"; InstrProfSymtab Symtab; for (const auto &I : FunctionData) if (shouldEncodeData(I.getValue())) diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 99c9e3eab74a..f9e421df354f 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -713,22 +713,7 @@ void PGOUseFunc::setBranchWeights() { } } // end anonymous namespace -// Create a COMDAT variable IR_LEVEL_PROF_VARNAME to make the runtime -// aware this is an ir_level profile so it can set the version flag. -static void createIRLevelProfileFlagVariable(Module &M) { - Type *IntTy64 = Type::getInt64Ty(M.getContext()); - uint64_t ProfileVersion = (INSTR_PROF_RAW_VERSION | VARIANT_MASK_IR_PROF); - auto IRLevelVersionVariable = - new GlobalVariable(M, IntTy64, true, GlobalVariable::ExternalLinkage, - Constant::getIntegerValue(IntTy64, APInt(64, ProfileVersion)), - INSTR_PROF_QUOTE(IR_LEVEL_PROF_VERSION_VAR)); - IRLevelVersionVariable->setVisibility(GlobalValue::DefaultVisibility); - IRLevelVersionVariable->setComdat( - M.getOrInsertComdat(StringRef(INSTR_PROF_QUOTE(IR_LEVEL_PROF_VERSION_VAR)))); -} - bool PGOInstrumentationGen::runOnModule(Module &M) { - createIRLevelProfileFlagVariable(M); for (auto &F : M) { if (F.isDeclaration()) continue; @@ -766,13 +751,6 @@ bool PGOInstrumentationUse::runOnModule(Module &M) { "Cannot get PGOReader")); return false; } - // TODO: might need to change the warning once the clang option is finalized. - if (!PGOReader->isIRLevelProfile()) { - Ctx.diagnose(DiagnosticInfoPGOProfile( - ProfileFileName.data(), "Not an IR level instrumentation profile")); - return false; - } - for (auto &F : M) { if (F.isDeclaration()) diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext index 8ca9db9c0515..3e28112706f1 100644 --- a/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext +++ b/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext @@ -1,5 +1,3 @@ -# :ir is the flag to indicate this is IR level profile. -:ir test_br_1 25571299074 2 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext index b5fee2b6f4fa..7d9bd72b29f2 100644 --- a/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext +++ b/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext @@ -1,5 +1,3 @@ -# :ir is the flag to indicate this is IR level profile. -:ir test_br_2 29667547796 2 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext index 7613b643b163..f369ba7c3504 100644 --- a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext +++ b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext @@ -1,5 +1,3 @@ -# :ir is the flag to indicate this is IR level profile. -:ir test_criticalEdge 82323253069 8 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext b/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext index a38d7939ebdd..aaa137e3a420 100644 --- a/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext +++ b/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext @@ -1,5 +1,3 @@ -# :ir is the flag to indicate this is IR level profile. -:ir foo 12884999999 1 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext b/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext deleted file mode 100644 index aaa137e3a420..000000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext +++ /dev/null @@ -1,5 +0,0 @@ -foo -12884999999 -1 -1 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext b/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext index 07b1bf86fc7f..b2bd451611bf 100644 --- a/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext +++ b/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext @@ -1,5 +1,3 @@ -# :ir is the flag to indicate this is IR level profile. -:ir foo 59130013419 4 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext index c19737149ca2..58c05fbe1676 100644 --- a/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext +++ b/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext @@ -1,5 +1,3 @@ -# :ir is the flag to indicate this is IR level profile. -:ir test_simple_for 34137660316 2 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext index af3a71df1e6b..1c429ea5d5f4 100644 --- a/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext +++ b/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext @@ -1,5 +1,3 @@ -# :ir is the flag to indicate this is IR level profile. -:ir test_nested_for 53929068288 3 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext b/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext index bebd65fa4c9f..7b406b87ef70 100644 --- a/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext +++ b/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext @@ -1,5 +1,3 @@ -# :ir is the flag to indicate this is IR level profile. -:ir test_switch 46200943743 4 diff --git a/llvm/test/Transforms/PGOProfile/branch1.ll b/llvm/test/Transforms/PGOProfile/branch1.ll index c0da37efd606..cc354d3425c6 100644 --- a/llvm/test/Transforms/PGOProfile/branch1.ll +++ b/llvm/test/Transforms/PGOProfile/branch1.ll @@ -4,8 +4,6 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat ; GEN: @__profn_test_br_1 = private constant [9 x i8] c"test_br_1" define i32 @test_br_1(i32 %i) { diff --git a/llvm/test/Transforms/PGOProfile/branch2.ll b/llvm/test/Transforms/PGOProfile/branch2.ll index 95a3f1e4fe11..1e8bc5ec2a38 100644 --- a/llvm/test/Transforms/PGOProfile/branch2.ll +++ b/llvm/test/Transforms/PGOProfile/branch2.ll @@ -4,8 +4,6 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat ; GEN: @__profn_test_br_2 = private constant [9 x i8] c"test_br_2" define i32 @test_br_2(i32 %i) { diff --git a/llvm/test/Transforms/PGOProfile/criticaledge.ll b/llvm/test/Transforms/PGOProfile/criticaledge.ll index 371b6ef2791a..0089bbea1558 100644 --- a/llvm/test/Transforms/PGOProfile/criticaledge.ll +++ b/llvm/test/Transforms/PGOProfile/criticaledge.ll @@ -4,8 +4,6 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat ; GEN: @__profn_test_criticalEdge = private constant [17 x i8] c"test_criticalEdge" ; GEN: @__profn__stdin__bar = private constant [11 x i8] c":bar" diff --git a/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll b/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll deleted file mode 100644 index 30abe6d35190..000000000000 --- a/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/diag_FE.proftext -o %t.profdata -; RUN: not opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s - -; CHECK: Not an IR level instrumentation profile - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @foo() { -entry: - ret i32 0 -} diff --git a/llvm/test/Transforms/PGOProfile/landingpad.ll b/llvm/test/Transforms/PGOProfile/landingpad.ll index f614ec51f581..33fe62fbae03 100644 --- a/llvm/test/Transforms/PGOProfile/landingpad.ll +++ b/llvm/test/Transforms/PGOProfile/landingpad.ll @@ -6,8 +6,6 @@ target triple = "x86_64-unknown-linux-gnu" @val = global i32 0, align 4 @_ZTIi = external constant i8* -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat ; GEN: @__profn_bar = private constant [3 x i8] c"bar" ; GEN: @__profn_foo = private constant [3 x i8] c"foo" diff --git a/llvm/test/Transforms/PGOProfile/loop1.ll b/llvm/test/Transforms/PGOProfile/loop1.ll index 3284c16a6804..aa5aa86b1e54 100644 --- a/llvm/test/Transforms/PGOProfile/loop1.ll +++ b/llvm/test/Transforms/PGOProfile/loop1.ll @@ -4,8 +4,6 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat ; GEN: @__profn_test_simple_for = private constant [15 x i8] c"test_simple_for" define i32 @test_simple_for(i32 %n) { diff --git a/llvm/test/Transforms/PGOProfile/loop2.ll b/llvm/test/Transforms/PGOProfile/loop2.ll index 786a37d5edc0..ec3e16d461bc 100644 --- a/llvm/test/Transforms/PGOProfile/loop2.ll +++ b/llvm/test/Transforms/PGOProfile/loop2.ll @@ -4,8 +4,6 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat ; GEN: @__profn_test_nested_for = private constant [15 x i8] c"test_nested_for" define i32 @test_nested_for(i32 %r, i32 %s) { diff --git a/llvm/test/Transforms/PGOProfile/single_bb.ll b/llvm/test/Transforms/PGOProfile/single_bb.ll index 2538a9bab7ac..f904d09b8e7a 100644 --- a/llvm/test/Transforms/PGOProfile/single_bb.ll +++ b/llvm/test/Transforms/PGOProfile/single_bb.ll @@ -2,8 +2,6 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat ; GEN: @__profn_single_bb = private constant [9 x i8] c"single_bb" define i32 @single_bb() { diff --git a/llvm/test/Transforms/PGOProfile/switch.ll b/llvm/test/Transforms/PGOProfile/switch.ll index aba624ba5384..3177dc0bd040 100644 --- a/llvm/test/Transforms/PGOProfile/switch.ll +++ b/llvm/test/Transforms/PGOProfile/switch.ll @@ -4,8 +4,6 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 72057594037927939, comdat ; GEN: @__profn_test_switch = private constant [11 x i8] c"test_switch" define void @test_switch(i32 %i) { diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index c7760866b809..2b6eacfb48a6 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -128,10 +128,6 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs, exitWithErrorCode(ec, Input.Filename); auto Reader = std::move(ReaderOrErr.get()); - bool IsIRProfile = Reader->isIRLevelProfile(); - if (Writer.setIsIRLevelProfile(IsIRProfile)) - exitWithError("Merge IR generated profile with Clang generated profile."); - for (auto &I : *Reader) { if (std::error_code EC = Writer.addRecord(std::move(I), Input.Weight)) { // Only show hint the first time an error occurs. @@ -273,7 +269,6 @@ static int showInstrProfile(std::string Filename, bool ShowCounts, exitWithErrorCode(EC, Filename); auto Reader = std::move(ReaderOrErr.get()); - bool IsIRInstr = Reader->isIRLevelProfile(); size_t ShownFunctions = 0; for (const auto &Func : *Reader) { bool Show = @@ -300,9 +295,8 @@ static int showInstrProfile(std::string Filename, bool ShowCounts, OS << " " << Func.Name << ":\n" << " Hash: " << format("0x%016" PRIx64, Func.Hash) << "\n" - << " Counters: " << Func.Counts.size() << "\n"; - if (!IsIRInstr) - OS << " Function count: " << Func.Counts[0] << "\n"; + << " Counters: " << Func.Counts.size() << "\n" + << " Function count: " << Func.Counts[0] << "\n"; if (ShowIndirectCallTargets) OS << " Indirect Call Site Count: " @@ -310,9 +304,8 @@ static int showInstrProfile(std::string Filename, bool ShowCounts, if (ShowCounts) { OS << " Block counts: ["; - size_t Start = (IsIRInstr ? 0 : 1); - for (size_t I = Start, E = Func.Counts.size(); I < E; ++I) { - OS << (I == Start ? "" : ", ") << Func.Counts[I]; + for (size_t I = 1, E = Func.Counts.size(); I < E; ++I) { + OS << (I == 1 ? "" : ", ") << Func.Counts[I]; } OS << "]\n"; }