diff --git a/llvm/include/llvm/Support/GCOV.h b/llvm/include/llvm/Support/GCOV.h index 188c4126f1f0..6111d3aebec5 100644 --- a/llvm/include/llvm/Support/GCOV.h +++ b/llvm/include/llvm/Support/GCOV.h @@ -250,7 +250,6 @@ public: private: GCOVFile &Parent; uint32_t Ident; - uint32_t Checksum; uint32_t LineNumber; StringRef Name; StringRef Filename; diff --git a/llvm/lib/IR/GCOV.cpp b/llvm/lib/IR/GCOV.cpp index 14eb71f0300d..64d53e4251ad 100644 --- a/llvm/lib/IR/GCOV.cpp +++ b/llvm/lib/IR/GCOV.cpp @@ -125,7 +125,7 @@ bool GCOVFunction::readGCNO(GCOVBuffer &Buff, GCOV::GCOVVersion Version) { uint32_t Dummy; if (!Buff.readInt(Dummy)) return false; // Function header length if (!Buff.readInt(Ident)) return false; - if (!Buff.readInt(Checksum)) return false; + if (!Buff.readInt(Dummy)) return false; // Checksum #1 if (Version != GCOV::V402) { uint32_t CfgChecksum; if (!Buff.readInt(CfgChecksum)) return false; @@ -212,7 +212,6 @@ bool GCOVFunction::readGCNO(GCOVBuffer &Buff, GCOV::GCOVVersion Version) { bool GCOVFunction::readGCDA(GCOVBuffer &Buff, GCOV::GCOVVersion Version) { uint32_t Dummy; if (!Buff.readInt(Dummy)) return false; // Function header length - uint32_t GCDAIdent; if (!Buff.readInt(GCDAIdent)) return false; if (Ident != GCDAIdent) { @@ -221,13 +220,8 @@ bool GCOVFunction::readGCDA(GCOVBuffer &Buff, GCOV::GCOVVersion Version) { return false; } - uint32_t GCDAChecksum; - if (!Buff.readInt(GCDAChecksum)) return false; - if (Checksum != GCDAChecksum) { - errs() << "Function checksums do not match: " << Checksum << " != " - << GCDAChecksum << " (in " << Name << ").\n"; - return false; - } + if (!Buff.readInt(Dummy)) return false; // Checksum #1 + uint32_t CfgChecksum; if (Version != GCOV::V402) { diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 488f451944bb..fb5bee2ede2d 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -314,18 +314,12 @@ namespace { this->os = os; Function *F = SP.getFunction(); - DEBUG(dbgs() << "Function: " << getFunctionName(SP) << "\n"); + DEBUG(dbgs() << "Function: " << F->getName() << "\n"); uint32_t i = 0; for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { Blocks[BB] = new GCOVBlock(i++, os); } ReturnBlock = new GCOVBlock(i++, os); - - std::string FunctionNameAndLine; - raw_string_ostream FNLOS(FunctionNameAndLine); - FNLOS << getFunctionName(SP) << SP.getLineNumber(); - FNLOS.flush(); - FuncChecksum = hash_value(FunctionNameAndLine); } ~GCOVFunction() { @@ -353,10 +347,6 @@ namespace { return EdgeDestinations; } - uint32_t getFuncChecksum() { - return FuncChecksum; - } - void setCfgChecksum(uint32_t Checksum) { CfgChecksum = Checksum; } @@ -369,7 +359,7 @@ namespace { ++BlockLen; write(BlockLen); write(Ident); - write(FuncChecksum); + write(0); // lineno checksum if (UseCfgChecksum) write(CfgChecksum); writeGCOVString(getFunctionName(SP)); @@ -411,7 +401,6 @@ namespace { private: DISubprogram SP; uint32_t Ident; - uint32_t FuncChecksum; bool UseCfgChecksum; uint32_t CfgChecksum; DenseMap Blocks; @@ -742,7 +731,6 @@ Constant *GCOVProfiler::getEmitFunctionFunc() { Type *Args[] = { Type::getInt32Ty(*Ctx), // uint32_t ident Type::getInt8PtrTy(*Ctx), // const char *function_name - Type::getInt32Ty(*Ctx), // uint32_t func_checksum Type::getInt8Ty(*Ctx), // uint8_t use_extra_checksum Type::getInt32Ty(*Ctx), // uint32_t cfg_checksum }; @@ -825,12 +813,11 @@ Function *GCOVProfiler::insertCounterWriteout( Builder.getInt32(CfgChecksum)); for (unsigned j = 0, e = CountersBySP.size(); j != e; ++j) { DISubprogram SP(CountersBySP[j].second); - Builder.CreateCall5( + Builder.CreateCall4( EmitFunction, Builder.getInt32(j), Options.FunctionNamesInData ? Builder.CreateGlobalStringPtr(getFunctionName(SP)) : Constant::getNullValue(Builder.getInt8PtrTy()), - Builder.getInt32(Funcs[j]->getFuncChecksum()), Builder.getInt8(Options.UseCfgChecksum), Builder.getInt32(CfgChecksum)); diff --git a/llvm/test/tools/llvm-cov/Inputs/test.gcda b/llvm/test/tools/llvm-cov/Inputs/test.gcda index c0c8329afb6c..a62c069c9a7b 100644 Binary files a/llvm/test/tools/llvm-cov/Inputs/test.gcda and b/llvm/test/tools/llvm-cov/Inputs/test.gcda differ diff --git a/llvm/test/tools/llvm-cov/Inputs/test.gcno b/llvm/test/tools/llvm-cov/Inputs/test.gcno index 97b67bb692b1..218398548efe 100644 Binary files a/llvm/test/tools/llvm-cov/Inputs/test.gcno and b/llvm/test/tools/llvm-cov/Inputs/test.gcno differ diff --git a/llvm/test/tools/llvm-cov/Inputs/test_checksum_mismatch.gcda b/llvm/test/tools/llvm-cov/Inputs/test_checksum_mismatch.gcda new file mode 100644 index 000000000000..2fcf33dd21b2 Binary files /dev/null and b/llvm/test/tools/llvm-cov/Inputs/test_checksum_mismatch.gcda differ diff --git a/llvm/test/tools/llvm-cov/Inputs/test_file_checksum_fail.gcda b/llvm/test/tools/llvm-cov/Inputs/test_file_checksum_fail.gcda deleted file mode 100644 index 8bfd82c7b248..000000000000 Binary files a/llvm/test/tools/llvm-cov/Inputs/test_file_checksum_fail.gcda and /dev/null differ diff --git a/llvm/test/tools/llvm-cov/Inputs/test_func_checksum_fail.gcda b/llvm/test/tools/llvm-cov/Inputs/test_func_checksum_fail.gcda deleted file mode 100644 index 4c729a850d86..000000000000 Binary files a/llvm/test/tools/llvm-cov/Inputs/test_func_checksum_fail.gcda and /dev/null differ diff --git a/llvm/test/tools/llvm-cov/Inputs/test_read_fail.gcno b/llvm/test/tools/llvm-cov/Inputs/test_read_fail.gcno index 88073f15dac6..bcc20a65eee4 100644 Binary files a/llvm/test/tools/llvm-cov/Inputs/test_read_fail.gcno and b/llvm/test/tools/llvm-cov/Inputs/test_read_fail.gcno differ diff --git a/llvm/test/tools/llvm-cov/llvm-cov.test b/llvm/test/tools/llvm-cov/llvm-cov.test index b08b514a9f2a..e2a21e1889e3 100644 --- a/llvm/test/tools/llvm-cov/llvm-cov.test +++ b/llvm/test/tools/llvm-cov/llvm-cov.test @@ -11,8 +11,6 @@ RUN: rm test.cpp.llcov RUN: not llvm-cov -gcno=test_read_fail.gcno -gcda=test.gcda -RUN: not llvm-cov -gcno=test.gcno -gcda=test_file_checksum_fail.gcda - -RUN: not llvm-cov -gcno=test.gcno -gcda=test_func_checksum_fail.gcda +RUN: not llvm-cov -gcno=test.gcno -gcda=test_checksum_mismatch.gcda XFAIL: powerpc64, s390x, mips