[PGO] coverage map bug with cov data produced for 32bit target
authorXinliang David Li <davidxl@google.com>
Wed, 10 Feb 2016 17:57:08 +0000 (17:57 +0000)
committerXinliang David Li <davidxl@google.com>
Wed, 10 Feb 2016 17:57:08 +0000 (17:57 +0000)
Fix the result truncation bug: [PR26560]
Test case is following (compiler-rt).

llvm-svn: 260393

llvm/include/llvm/ProfileData/CoverageMapping.h

index 5d9460c..6cf4bab 100644 (file)
@@ -519,7 +519,7 @@ template <class IntPtrT> struct CovMapFunctionRecordV1 {
   }
 };
 
-template <class IntPtrT> struct CovMapFunctionRecord {
+struct CovMapFunctionRecord {
 #define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Type Name;
 #include "llvm/ProfileData/InstrProfData.inc"
 
@@ -539,7 +539,7 @@ template <class IntPtrT> struct CovMapFunctionRecord {
   template <support::endianness Endian>
   std::error_code getFuncName(InstrProfSymtab &ProfileNames,
                               StringRef &FuncName) const {
-    IntPtrT NameRef = getFuncNameRef<Endian>();
+    uint64_t NameRef = getFuncNameRef<Endian>();
     FuncName = ProfileNames.getFuncName(NameRef);
     return std::error_code();
   }
@@ -577,7 +577,7 @@ enum CovMapVersion {
 };
 
 template <int CovMapVersion, class IntPtrT> struct CovMapTraits {
-  typedef CovMapFunctionRecord<IntPtrT> CovMapFuncRecordType;
+  typedef CovMapFunctionRecord CovMapFuncRecordType;
   typedef uint64_t NameRefType;
 };