[PATCH] D139067: [FuzzMutate] New InsertCFGStrategy
Peter Rong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 12 11:02:54 PST 2022
Peter marked an inline comment as done.
Peter added inline comments.
================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:343-344
+ }));
+ assert(RS && "I can't find an integer type in all allowed types, is the "
+ "setting correct?");
+ Type *Ty = RS.getSelection();
----------------
arsenm wrote:
> assert string is a bit weird
This is to make sure that when things went wrong, we give some hint to tell the user what's wrong. Is there a recommended way of doing it?
================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:365-374
+ for (uint64_t i = 0; i < NumCases; i++) {
+ uint64_t CaseVal = [&CaseVals, MaxCaseVal, &IB]() {
+ uint64_t tmp;
+ // Make sure we don't have two cases with same value.
+ do {
+ tmp = uniform<uint64_t>(IB.Rand, 0, MaxCaseVal);
+ } while (CaseVals.count(tmp) != 0);
----------------
arsenm wrote:
> Why is this a lambda here?
Just to enclose unnecessary variables(`tmp` required to make CaseVal unique. I can write the loop outside the lambda if you want to.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139067/new/
https://reviews.llvm.org/D139067
More information about the llvm-commits
mailing list