[compiler-rt] 4c684b9 - Revert part of D49132 "[gcov] Fix gcov profiling on big-endian machines"

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 22:27:21 PDT 2020


Author: Fangrui Song
Date: 2020-05-11T22:27:01-07:00
New Revision: 4c684b91d562d96ab5a34bb989693e92ba9ec9eb

URL: https://github.com/llvm/llvm-project/commit/4c684b91d562d96ab5a34bb989693e92ba9ec9eb
DIFF: https://github.com/llvm/llvm-project/commit/4c684b91d562d96ab5a34bb989693e92ba9ec9eb.diff

LOG: Revert part of D49132 "[gcov] Fix gcov profiling on big-endian machines"

D49132 is partially correct. For 64-bit values, the lower 32-bit part comes
before the higher 32-bit part (in a little-endian manner).

For 32-bit values, libgcov reads/writes 32-bit values in native endianness.

Added: 
    

Modified: 
    compiler-rt/lib/profile/GCDAProfiling.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c
index fe39ce993996..eb23a0631832 100644
--- a/compiler-rt/lib/profile/GCDAProfiling.c
+++ b/compiler-rt/lib/profile/GCDAProfiling.c
@@ -235,18 +235,6 @@ static uint32_t read_32bit_value() {
   return val;
 }
 
-static uint32_t read_le_32bit_value() {
-  uint32_t val = 0;
-  int i;
-
-  if (new_file)
-    return (uint32_t)-1;
-
-  for (i = 0; i < 4; i++)
-    val |= write_buffer[cur_pos++] << (8*i);
-  return val;
-}
-
 static uint64_t read_64bit_value() {
   // GCOV uses a lo-/hi-word format even on big-endian systems.
   // See also GCOVBuffer::readInt64 in LLVM.
@@ -501,7 +489,7 @@ void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) {
 
   if (!output_file) return;
 
-  val = read_le_32bit_value();
+  val = read_32bit_value();
 
   if (val != (uint32_t)-1) {
     /* There are counters present in the file. Merge them. */
@@ -553,7 +541,7 @@ void llvm_gcda_summary_info() {
 
   if (!output_file) return;
 
-  val = read_le_32bit_value();
+  val = read_32bit_value();
 
   if (val != (uint32_t)-1) {
     /* There are counters present in the file. Merge them. */


        


More information about the llvm-commits mailing list