diff --git a/lib/Transforms/Instrumentation/InstrProfiling.cpp b/lib/Transforms/Instrumentation/InstrProfiling.cpp index eeb49910e37..97e8bd1ae11 100644 --- a/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -447,8 +447,9 @@ void InstrProfiling::emitVNodes() { // the average number of counters per site is low. For small // apps with very few sites, this may not be true. Bump up the // number of counters in this case. - if (NumCounters < 10) - NumCounters *= 2; +#define INSTR_PROF_MIN_VAL_COUNTS 10 + if (NumCounters < INSTR_PROF_MIN_VAL_COUNTS) + NumCounters = std::max(INSTR_PROF_MIN_VAL_COUNTS, (int) NumCounters * 2); auto &Ctx = M->getContext(); Type *VNodeTypes[] = {