ShuffleBlockStrategy will shuffle the instructions in a basic block without breaking the dependency of instructions.
It is implemented as a topological sort, only we randomly select instructions with no dependency.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/FuzzMutate/IRMutator.h | ||
---|---|---|
130 | Why do you need this? | |
llvm/lib/FuzzMutate/IRMutator.cpp | ||
310 | You can do this in the first loop, and use a range loop with make_early_inc_range(BB.getFirstInsertionPt(), BB.getTerminator()) | |
314 | 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 | |
318 | Don't need != 0 | |
318 | Probably should avoid inserting null into the set | |
327 | Avoid inserting null, don't need != 0 | |
335 | .empty | |
339 | !Roots.empty | |
348 | .empty |
llvm/lib/FuzzMutate/IRMutator.cpp | ||
---|---|---|
315 | Add a comment for the function | |
318–321 | The return values look backwards to me? | |
323 | Comment the function | |
llvm/unittests/FuzzMutate/StrategiesTest.cpp | ||
311 | I think you need an additional test with some loops | |
366 | Module *M | |
373 | Use C++11 random functions? | |
378 | EXPECT_EQ | |
380 | Probably should be ASSERT_FALSE(verifyModule()) |
llvm/unittests/FuzzMutate/StrategiesTest.cpp | ||
---|---|---|
366 | That makes things worse. I think auto is harmful here |
llvm/unittests/FuzzMutate/StrategiesTest.cpp | ||
---|---|---|
366 | I understand the ambiguity can be harmful here now. I have made the change. I will change other uses in this file in another diff once this is accepted. Thanks for pointing it out. |
- SmallSet -> SmallPtrSet
- Use named values in unit testing.
llvm/unittests/FuzzMutate/StrategiesTest.cpp | ||
---|---|---|
394 | No unit testing in this folder is supporting opaque pointers yet. |
llvm/unittests/FuzzMutate/StrategiesTest.cpp | ||
---|---|---|
394 | Shouldn't need to change anything other than the pointer next. s/i32*/ptr/ |
llvm/unittests/FuzzMutate/StrategiesTest.cpp | ||
---|---|---|
394 | directly changing i32* into ptr will get an error when running parser and abort the unit test. ("warning: ptr type is only supported in -opaque-pointers mode") |
llvm/unittests/FuzzMutate/StrategiesTest.cpp | ||
---|---|---|
394 | You have more than i32*, also i64*. You need to get all the pointer types |
llvm/unittests/FuzzMutate/StrategiesTest.cpp | ||
---|---|---|
394 | Ah, seems my understanding of opaque pointer is not 100% correct. |
Why do you need this?