diff --git a/llvm/include/llvm/FuzzMutate/IRMutator.h b/llvm/include/llvm/FuzzMutate/IRMutator.h --- a/llvm/include/llvm/FuzzMutate/IRMutator.h +++ b/llvm/include/llvm/FuzzMutate/IRMutator.h @@ -95,6 +95,7 @@ void mutate(BasicBlock &BB, RandomIRBuilder &IB) override; }; +/// Strategy that deletes instructions when the Module is too large. class InstDeleterIRStrategy : public IRMutationStrategy { public: uint64_t getWeight(size_t CurrentSize, size_t MaxSize, @@ -105,6 +106,7 @@ void mutate(Instruction &Inst, RandomIRBuilder &IB) override; }; +/// Strategy that modifies instruction attributes and operands. class InstModificationIRStrategy : public IRMutationStrategy { public: uint64_t getWeight(size_t CurrentSize, size_t MaxSize, diff --git a/llvm/unittests/FuzzMutate/StrategiesTest.cpp b/llvm/unittests/FuzzMutate/StrategiesTest.cpp --- a/llvm/unittests/FuzzMutate/StrategiesTest.cpp +++ b/llvm/unittests/FuzzMutate/StrategiesTest.cpp @@ -31,15 +31,13 @@ Type::getInt64Ty, Type::getFloatTy, Type::getDoubleTy}; std::vector> Strategies; - Strategies.push_back( - std::make_unique( - InjectorIRStrategy::getDefaultOps())); + Strategies.push_back(std::make_unique( + InjectorIRStrategy::getDefaultOps())); return std::make_unique(std::move(Types), std::move(Strategies)); } -template -std::unique_ptr createMutator() { +template std::unique_ptr createMutator() { std::vector Types{ Type::getInt1Ty, Type::getInt8Ty, Type::getInt16Ty, Type::getInt32Ty, Type::getInt64Ty, Type::getFloatTy, Type::getDoubleTy}; @@ -50,8 +48,8 @@ return std::make_unique(std::move(Types), std::move(Strategies)); } -std::unique_ptr parseAssembly( - const char *Assembly, LLVMContext &Context) { +std::unique_ptr parseAssembly(const char *Assembly, + LLVMContext &Context) { SMDiagnostic Error; std::unique_ptr M = parseAssemblyString(Assembly, Error, Context); @@ -94,15 +92,15 @@ // Test that we don't crash even if we can't remove from one of the functions. StringRef Source = "" - "define <8 x i32> @func1() {\n" - "ret <8 x i32> undef\n" - "}\n" - "\n" - "define i32 @func2() {\n" - "%A9 = alloca i32\n" - "%L6 = load i32, i32* %A9\n" - "ret i32 %L6\n" - "}\n"; + "define <8 x i32> @func1() {\n" + "ret <8 x i32> undef\n" + "}\n" + "\n" + "define i32 @func2() {\n" + "%A9 = alloca i32\n" + "%L6 = load i32, i32* %A9\n" + "ret i32 %L6\n" + "}\n"; auto Mutator = createMutator(); ASSERT_TRUE(Mutator); @@ -319,4 +317,4 @@ }"; VerfyDivDidntShuffle(Source); } -} +} // namespace