summaryrefslogtreecommitdiff
path: root/lib/ProfileData
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-11-28 05:47:34 +0000
committerXinliang David Li <davidxl@google.com>2015-11-28 05:47:34 +0000
commitfeed6dbc9f34d52d5d7a0a2b23af12ba0a64a234 (patch)
tree589b38bfb985edcd29613e98621b185973953a64 /lib/ProfileData
parent9bee4a8249abac133d065d9ce0f878af44bed392 (diff)
[PGO] Add return code for vp rt record init routine to indicate error condition
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254220 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ProfileData')
-rw-r--r--lib/ProfileData/InstrProf.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/ProfileData/InstrProf.cpp b/lib/ProfileData/InstrProf.cpp
index 3bbc8249c3d..28626844812 100644
--- a/lib/ProfileData/InstrProf.cpp
+++ b/lib/ProfileData/InstrProf.cpp
@@ -271,9 +271,9 @@ ValueProfData::serializeFrom(const InstrProfRecord &Record) {
* pre-compute the information needed to efficiently implement
* ValueProfRecordClosure's callback interfaces.
*/
-void initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord,
- uint16_t *NumValueSites,
- ValueProfNode **Nodes) {
+int initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord,
+ uint16_t *NumValueSites,
+ ValueProfNode **Nodes) {
unsigned I, J, S = 0, NumValueKinds = 0;
RuntimeRecord->NumValueSites = NumValueSites;
RuntimeRecord->Nodes = Nodes;
@@ -286,6 +286,8 @@ void initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord,
NumValueKinds++;
RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1);
RuntimeRecord->NodesKind[I] = &RuntimeRecord->Nodes[S];
+ if (!RuntimeRecord->NodesKind[I])
+ return 1;
for (J = 0; J < N; J++) {
uint8_t C = 0;
ValueProfNode *Site = RuntimeRecord->Nodes[S + J];
@@ -300,6 +302,7 @@ void initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord,
S += N;
}
RuntimeRecord->NumValueKinds = NumValueKinds;
+ return 0;
}
void finalizeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord) {