[llvm] r195309 - llvm-cov: Fixed some bugs related to file checksum.
Yuchen Wu
yuchenericwu at hotmail.com
Wed Nov 20 20:01:06 PST 2013
Author: ywu
Date: Wed Nov 20 22:01:05 2013
New Revision: 195309
URL: http://llvm.org/viewvc/llvm-project?rev=195309&view=rev
Log:
llvm-cov: Fixed some bugs related to file checksum.
Added call to update CfgChecksum. Made FileChecksum a vector, separate
for each source file.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=195309&r1=195308&r2=195309&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Wed Nov 20 22:01:05 2013
@@ -136,7 +136,7 @@ namespace {
// Reversed, NUL-terminated copy of Options.Version.
char ReversedVersion[5];
// Checksum, produced by hash of EdgeDestinations
- uint32_t FileChecksum;
+ SmallVector<uint32_t, 4> FileChecksums;
Module *M;
LLVMContext *Ctx;
@@ -498,14 +498,17 @@ void GCOVProfiler::emitProfileNotes() {
EdgeDestinations += Func->getEdgeDestinations();
}
- FileChecksum = hash_value(EdgeDestinations);
+ FileChecksums.push_back(hash_value(EdgeDestinations));
out.write("oncg", 4);
out.write(ReversedVersion, 4);
- out.write(reinterpret_cast<char*>(&FileChecksum), 4);
+ out.write(reinterpret_cast<char*>(&FileChecksums.back()), 4);
for (SmallVectorImpl<GCOVFunction *>::iterator I = Funcs.begin(),
- E = Funcs.end(); I != E; ++I)
- (*I)->writeOut();
+ E = Funcs.end(); I != E; ++I) {
+ GCOVFunction *Func = *I;
+ Func->setCfgChecksum(FileChecksums.back());
+ Func->writeOut();
+ }
out.write("\0\0\0\0\0\0\0\0", 8); // EOF
out.close();
@@ -803,7 +806,7 @@ Function *GCOVProfiler::insertCounterWri
Builder.CreateCall3(StartFile,
Builder.CreateGlobalStringPtr(FilenameGcda),
Builder.CreateGlobalStringPtr(ReversedVersion),
- Builder.getInt32(FileChecksum));
+ Builder.getInt32(FileChecksums[i]));
for (unsigned j = 0, e = CountersBySP.size(); j != e; ++j) {
DISubprogram SP(CountersBySP[j].second);
Builder.CreateCall4(
@@ -812,7 +815,7 @@ Function *GCOVProfiler::insertCounterWri
Builder.CreateGlobalStringPtr(getFunctionName(SP)) :
Constant::getNullValue(Builder.getInt8PtrTy()),
Builder.getInt8(Options.UseCfgChecksum),
- Builder.getInt32(FileChecksum));
+ Builder.getInt32(FileChecksums[i]));
GlobalVariable *GV = CountersBySP[j].first;
unsigned Arcs =
More information about the llvm-commits
mailing list