forked from OSchip/llvm-project
[PGO] Change a `NumVSites == 0` workaround to assert
The root cause was fixed by3d6f53018f
. The workaround added in99ad956fda
can be changed to an assert now. (In case the fix regresses, there will be a heap-use-after-free.)
This commit is contained in:
parent
ac82b918c7
commit
317e00dc54
|
@ -6,6 +6,7 @@
|
|||
|*
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -93,8 +94,8 @@ static int allocateValueProfileCounters(__llvm_profile_data *Data) {
|
|||
for (VKI = IPVK_First; VKI <= IPVK_Last; ++VKI)
|
||||
NumVSites += Data->NumValueSites[VKI];
|
||||
|
||||
if (NumVSites == 0)
|
||||
return 0;
|
||||
// If NumVSites = 0, calloc is allowed to return a non-null pointer.
|
||||
assert(NumVSites > 0 && "NumVSites can't be zero");
|
||||
ValueProfNode **Mem =
|
||||
(ValueProfNode **)calloc(NumVSites, sizeof(ValueProfNode *));
|
||||
if (!Mem)
|
||||
|
|
Loading…
Reference in New Issue