[PATCH] D50482: Added another optimization pass to make vectorizing possible
Emmett Neyman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 8 17:59:10 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL339305: Added another optimization pass to make vectorizing possible (authored by emmettneyman, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D50482?vs=159838&id=159839#toc
Repository:
rL LLVM
https://reviews.llvm.org/D50482
Files:
cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
Index: cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
===================================================================
--- cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ cfe/trunk/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -100,17 +100,29 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50482.159839.patch
Type: text/x-patch
Size: 1564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180809/e7987c41/attachment.bin>
More information about the cfe-commits
mailing list