There was a mismatch here, with one check checking whether there
are any functions, and the other collecting only non-declaration
functions.
}
void IRMutationStrategy::mutate(Module &M, RandomIRBuilder &IB) {
- if (M.empty())
- createEmptyFunction(M);
-
auto RS = makeSampler<Function *>(IB.Rand);
for (Function &F : M)
if (!F.isDeclaration())
RS.sample(&F, /*Weight=*/1);
- mutate(*RS.getSelection(), IB);
+
+ if (RS.isEmpty())
+ createEmptyFunction(M);
+ else
+ mutate(*RS.getSelection(), IB);
}
void IRMutationStrategy::mutate(Function &F, RandomIRBuilder &IB) {