Author: emmettneyman Date: Wed Aug 8 17:58:23 2018 New Revision: 339305 URL: http://llvm.org/viewvc/llvm-project?rev=339305&view=rev Log: Added another optimization pass to make vectorizing possible
Summary: I noticed that my code wasn't going deep into the loop vectorizer code so added another pass that makes it go further. Reviewers: morehouse, kcc Reviewed By: morehouse Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D50482 Modified: cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp Modified: cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp?rev=339305&r1=339304&r2=339305&view=diff ============================================================================== --- cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp (original) +++ cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp Wed Aug 8 17:58:23 2018 @@ -100,17 +100,29 @@ static std::string OptLLVM(const std::st if (!M || verifyModule(*M, &errs())) ErrorAndExit("Could not parse IR"); + Triple ModuleTriple(M->getTargetTriple()); + const TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); + std::string E; + const Target *TheTarget = TargetRegistry::lookupTarget(MArch, ModuleTriple, E); + TargetMachine *Machine = + TheTarget->createTargetMachine(M->getTargetTriple(), getCPUStr(), + getFeaturesStr(), Options, getRelocModel(), + getCodeModel(), OLvl); + std::unique_ptr<TargetMachine> TM(Machine); setFunctionAttributes(getCPUStr(), getFeaturesStr(), *M); - + legacy::PassManager Passes; - Triple ModuleTriple(M->getTargetTriple()); Passes.add(new TargetLibraryInfoWrapperPass(ModuleTriple)); - Passes.add(createTargetTransformInfoWrapperPass(TargetIRAnalysis())); + Passes.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis())); + + LLVMTargetMachine <M = static_cast<LLVMTargetMachine &>(*TM); + Passes.add(LTM.createPassConfig(Passes)); + Passes.add(createVerifierPass()); AddOptimizationPasses(Passes, OLvl, 0); - + // Add a pass that writes the optimized IR to an output stream std::string outString; raw_string_ostream OS(outString); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits