| 887 | } // namespace |
| 888 | |
| 889 | int main(int argc, char **argv) { |
| 890 | sys::PrintStackTraceOnErrorSignal(argv[0]); |
| 891 | llvm::InitLLVM X(argc, argv); |
| 892 | EnableDebugBuffering = true; |
| 893 | LLVMContext Context; |
| 894 | |
| 895 | string Usage = |
| 896 | R"EOF(Alive2 simple generative fuzzer: |
| 897 | version )EOF"; |
| 898 | Usage += alive_version; |
| 899 | Usage += R"EOF( |
| 900 | see quick-fuzz --version for LLVM version info, |
| 901 | |
| 902 | This program stress-tests LLVM and Alive2 by performing randomized |
| 903 | generation of LLVM functions, optimizing them, and then checking |
| 904 | refinement. |
| 905 | |
| 906 | It currently contains two simple generators: "value," which generates |
| 907 | a single basic block containing integer operations, and "bb," which |
| 908 | exercises loop and control flow optimizations. |
| 909 | |
| 910 | The recommended workflow is to run quick-fuzz until it finds an issue, |
| 911 | and then re-run with the same seed and also the --save-ir command line |
| 912 | option, in order to get a standalone test case that can then be |
| 913 | reduced using llvm-reduce. |
| 914 | )EOF"; |
| 915 | |
| 916 | cl::HideUnrelatedOptions(alive_cmdargs); |
| 917 | cl::ParseCommandLineOptions(argc, argv, Usage); |
| 918 | |
| 919 | unique_ptr<Cache> cache; |
| 920 | unique_ptr<Module> MDummy; |
| 921 | #define ARGS_MODULE_VAR MDummy |
| 922 | #include "llvm_util/cmd_args_def.h" |
| 923 | |
| 924 | Module M1("fuzz", Context); |
| 925 | auto &DL = M1.getDataLayout(); |
| 926 | Triple targetTriple(M1.getTargetTriple()); |
| 927 | TargetLibraryInfoWrapperPass TLI(targetTriple); |
| 928 | |
| 929 | llvm_util::initializer llvm_util_init(*out, DL); |
| 930 | smt::smt_initializer smt_init; |
| 931 | Verifier verifier(TLI, smt_init, *out); |
| 932 | verifier.always_verify = opt_always_verify; |
| 933 | verifier.print_dot = opt_print_dot; |
| 934 | verifier.bidirectional = opt_bidirectional; |
| 935 | |
| 936 | function<unique_ptr<Fuzzer>(Module &, long)> makeFuzzer; |
| 937 | if (opt_fuzzer == "value") { |
| 938 | makeFuzzer = [](Module &M, long seed) { |
| 939 | return make_unique<ValueFuzzer>(M, seed); |
| 940 | }; |
| 941 | } else if (opt_fuzzer == "bb") { |
| 942 | makeFuzzer = [](Module &M, long seed) { |
| 943 | return make_unique<BBFuzzer>(M, seed); |
| 944 | }; |
| 945 | } else { |
| 946 | *out << "Available fuzzers are \"value\" and \"bb\".\n\n"; |
nothing calls this directly
no test coverage detected