summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-09-20 17:43:14 +0000
committerDevang Patel <dpatel@apple.com>2011-09-20 17:43:14 +0000
commit972df96ab128cad132c9d047ef6a52badb5ad4fe (patch)
tree981ddf3f00db7c54dfc55a0610d13b0ca61ff05b /llvm/lib/Transforms/Instrumentation
parentd0b0f4920c05b6f9da115e3da2ce4377909b1fdb (diff)
downloadbcm5719-llvm-972df96ab128cad132c9d047ef6a52badb5ad4fe.tar.gz
bcm5719-llvm-972df96ab128cad132c9d047ef6a52badb5ad4fe.zip
Eliminate unnecessary copy of FileName from GCOVLines.
GCOVLines is always accessed through a StringMap where the key is FileName. llvm-svn: 140151
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation')
-rw-r--r--llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 16262932936..e701f995785 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -167,18 +167,17 @@ namespace {
}
uint32_t length() {
- return lengthOfGCOVString(Filename) + 2 + Lines.size();
+ // FIXME: ??? What is the significance of 2 here ?
+ return 2 + Lines.size();
}
private:
friend class GCOVBlock;
- GCOVLines(std::string Filename, raw_ostream *os)
- : Filename(Filename) {
+ GCOVLines(raw_ostream *os) {
this->os = os;
}
- std::string Filename;
SmallVector<uint32_t, 32> Lines;
};
@@ -190,7 +189,7 @@ namespace {
GCOVLines &getFile(std::string Filename) {
GCOVLines *&Lines = LinesByFile[Filename];
if (!Lines) {
- Lines = new GCOVLines(Filename, os);
+ Lines = new GCOVLines(os);
}
return *Lines;
}
@@ -203,7 +202,7 @@ namespace {
uint32_t Len = 3;
for (StringMap<GCOVLines *>::iterator I = LinesByFile.begin(),
E = LinesByFile.end(); I != E; ++I) {
- Len += I->second->length();
+ Len = Len + lengthOfGCOVString(I->first()) + I->second->length();
}
writeBytes(LinesTag, 4);
@@ -212,7 +211,7 @@ namespace {
for (StringMap<GCOVLines *>::iterator I = LinesByFile.begin(),
E = LinesByFile.end(); I != E; ++I) {
write(0);
- writeGCOVString(I->second->Filename);
+ writeGCOVString(I->first());
for (int i = 0, e = I->second->Lines.size(); i != e; ++i) {
write(I->second->Lines[i]);
}
OpenPOWER on IntegriCloud