#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/AsmParser/Parser.h"
#include "llvm/AsmParser/SlotMapping.h"
#include "llvm/FuzzMutate/IRMutator.h"
#include "llvm/FuzzMutate/Operations.h"
#include "llvm/FuzzMutate/RandomIRBuilder.h"
#include "llvm/IR/FMF.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/SourceMgr.h"
#include <random>
#include "gtest/gtest.h"
usingnamespacellvm;
static constexpr int Seed = …;
namespace {
std::unique_ptr<IRMutator> createInjectorMutator() { … }
template <class Strategy> std::unique_ptr<IRMutator> createMutator() { … }
std::unique_ptr<Module> parseAssembly(const char *Assembly,
LLVMContext &Context) { … }
void IterateOnSource(StringRef Source, IRMutator &Mutator) { … }
static void mutateAndVerifyModule(StringRef Source,
std::unique_ptr<IRMutator> &Mutator,
int repeat = 100) { … }
template <class Strategy>
static void mutateAndVerifyModule(StringRef Source, int repeat = 100) { … }
TEST(InjectorIRStrategyTest, EmptyModule) { … }
TEST(InjectorIRStrategyTest, LargeInsertion) { … }
TEST(InjectorIRStrategyTest, InsertWMustTailCall) { … }
TEST(InjectorIRStrategyTest, InsertWTailCall) { … }
TEST(InstDeleterIRStrategyTest, EmptyFunction) { … }
TEST(InstDeleterIRStrategyTest, PhiNodes) { … }
static void checkModifyNoUnsignedAndNoSignedWrap(StringRef Opc) { … }
TEST(InstModificationIRStrategyTest, Add) { … }
TEST(InstModificationIRStrategyTest, Sub) { … }
TEST(InstModificationIRStrategyTest, Mul) { … }
TEST(InstModificationIRStrategyTest, Shl) { … }
TEST(InstModificationIRStrategyTest, ICmp) { … }
TEST(InstModificationIRStrategyTest, FCmp) { … }
TEST(InstModificationIRStrategyTest, GEP) { … }
void VerfyOperandShuffled(StringRef Source, std::pair<int, int> ShuffleItems) { … }
TEST(InstModificationIRStrategyTest, ShuffleAnd) { … }
TEST(InstModificationIRStrategyTest, ShuffleSelect) { … }
void VerfyDivDidntShuffle(StringRef Source) { … }
TEST(InstModificationIRStrategyTest, DidntShuffleSDiv) { … }
TEST(InstModificationIRStrategyTest, DidntShuffleFRem) { … }
TEST(InsertFunctionStrategy, Func) { … }
TEST(InsertFunctionStrategy, AvoidCallingFunctionWithSpecialParam) { … }
TEST(InstModificationIRStrategy, Exact) { … }
TEST(InstModificationIRStrategy, FastMath) { … }
TEST(InsertCFGStrategy, CFG) { … }
TEST(InsertPHIStrategy, PHI) { … }
TEST(InsertPHIStrategy, PHIWithSameIncomingBlock) { … }
TEST(SinkInstructionStrategy, Operand) { … }
TEST(SinkInstructionStrategy, DoNotSinkTokenType) { … }
static void VerifyBlockShuffle(StringRef Source) { … }
TEST(ShuffleBlockStrategy, ShuffleBlocks) { … }
TEST(ShuffleBlockStrategy, ShuffleLoop) { … }
TEST(AllStrategies, SkipEHPad) { … }
}