[PATCH] D138339: [FuzzMutate] New strategy `ShuffleBlockStrategy`
Peter Rong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 18 20:37:03 PST 2022
Peter added inline comments.
================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:309
+ for (Instruction *I : AliveInsts) {
+ I->removeFromParent();
+ }
----------------
arsenm wrote:
> You can do this in the first loop, and use a range loop with make_early_inc_range(BB.getFirstInsertionPt(), BB.getTerminator())
I didn't know this API, Thanks for pointing that out!
================
Comment at: llvm/lib/FuzzMutate/IRMutator.cpp:313
+ // Shuffle these instructions using topological sort.
+ auto getAliveParents = [&AliveInsts](Instruction *I) {
+ SmallSet<Instruction *, 4> Parents;
----------------
arsenm wrote:
> The only 2 users I see of this set immediately discard the result and see if it's empty. You can just check the predicate directly without the set
You are right, I thought I might need `Parents` but turns out I don't. I have made this so it return a `bool`, whether there are alive parents or not.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138339/new/
https://reviews.llvm.org/D138339
More information about the llvm-commits
mailing list