[compiler-rt] r254552 - Sync up with master file

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 13:48:22 PST 2015


Author: davidxl
Date: Wed Dec  2 15:48:22 2015
New Revision: 254552

URL: http://llvm.org/viewvc/llvm-project?rev=254552&view=rev
Log:
Sync up with master file

Modified:
    compiler-rt/trunk/lib/profile/InstrProfData.inc

Modified: compiler-rt/trunk/lib/profile/InstrProfData.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfData.inc?rev=254552&r1=254551&r2=254552&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfData.inc (original)
+++ compiler-rt/trunk/lib/profile/InstrProfData.inc Wed Dec  2 15:48:22 2015
@@ -291,6 +291,7 @@ typedef struct ValueProfData {
    */
   void deserializeTo(InstrProfRecord &Record,
                      InstrProfRecord::ValueMapType *VMap);
+  void operator delete(void *ptr) { ::operator delete(ptr); }
 #endif
 } ValueProfData;
 
@@ -537,12 +538,13 @@ int initializeValueProfRuntimeRecord(Val
     }
     NumValueKinds++;
     RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1);
-    RuntimeRecord->NodesKind[I] = &RuntimeRecord->Nodes[S];
-    if (!RuntimeRecord->NodesKind[I])
+    if (!RuntimeRecord->SiteCountArray[I])
       return 1;
+    RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : NULL;
     for (J = 0; J < N; J++) {
+      /* Compute value count for each site. */
       uint32_t C = 0;
-      ValueProfNode *Site = RuntimeRecord->Nodes[S + J];
+      ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : NULL;
       while (Site) {
         C++;
         Site = Site->Next;
@@ -595,6 +597,8 @@ void getValueForSiteRT(const void *R, In
   unsigned I, N = 0;
   const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R;
   N = getNumValueDataForSiteRT(R, VK, S);
+  if (N == 0)
+    return;
   ValueProfNode *VNode = Record->NodesKind[VK][S];
   for (I = 0; I < N; I++) {
     Dst[I] = VNode->VData;




More information about the llvm-commits mailing list