forked from OSchip/llvm-project
[IRMutator] Handle module with only declarations
There was a mismatch here, with one check checking whether there are any functions, and the other collecting only non-declaration functions.
This commit is contained in:
parent
806450805d
commit
a3aac5693d
|
@ -33,14 +33,15 @@ static void createEmptyFunction(Module &M) {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue