[llvm-commits] [llvm] r130967 - in /llvm/trunk: lib/Transforms/Instrumentation/GCOVProfiling.cpp runtime/libprofile/GCDAProfiling.c
Nick Lewycky
nicholas at mxc.ca
Thu May 5 16:52:18 PDT 2011
Author: nicholas
Date: Thu May 5 18:52:18 2011
New Revision: 130967
URL: http://llvm.org/viewvc/llvm-project?rev=130967&view=rev
Log:
The computation of string length is not that complicated. Fix it, again. :)
Modified:
llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/trunk/runtime/libprofile/GCDAProfiling.c
Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=130967&r1=130966&r2=130967&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Thu May 5 18:52:18 2011
@@ -140,7 +140,7 @@
// A GCOV string is a length, followed by a NUL, then between 0 and 3 NULs
// padding out to the next 4-byte word. The length is measured in 4-byte
// words including padding, not bytes of actual string.
- return (s.size() + 5) / 4;
+ return (s.size() / 4) + 1;
}
void writeGCOVString(StringRef s) {
Modified: llvm/trunk/runtime/libprofile/GCDAProfiling.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/GCDAProfiling.c?rev=130967&r1=130966&r2=130967&view=diff
==============================================================================
--- llvm/trunk/runtime/libprofile/GCDAProfiling.c (original)
+++ llvm/trunk/runtime/libprofile/GCDAProfiling.c Thu May 5 18:52:18 2011
@@ -49,7 +49,7 @@
}
static uint32_t length_of_string(const char *s) {
- return (strlen(s) + 5) / 4;
+ return (strlen(s) / 4) + 1;
}
static void write_string(const char *s) {
More information about the llvm-commits
mailing list