[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code
Emmett Neyman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 25 16:09:36 PDT 2018
emmettneyman added inline comments.
================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:89
+ Builder.Inliner = createFunctionInliningPass(OptLevel, SizeLevel, false);
+ Builder.LoopVectorize = true;
+ Builder.populateFunctionPassManager(FPM);
----------------
morehouse wrote:
> If we do this, do we need to explicitly add the vectorizer pass below?
No we don't. I've deleted the line below.
================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:110
+ TargetLibraryInfoImpl TLII(ModuleTriple);
+ Passes.add(new TargetLibraryInfoWrapperPass(TLII));
+ Passes.add(createTargetTransformInfoWrapperPass(TargetIRAnalysis()));
----------------
morehouse wrote:
> Can simplify to `Passes.add(new TargetLibraryInfoWrapperPass(M->getTargetTriple))`.
Contrary to the function's name, `getTargetTriple()` actually returns a `string`, not a `Triple`. But I changed it to `new TargetLibraryInfoWrapperPass(ModuleTriple)` and deleted line 109.
================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:115
+ make_unique<legacy::FunctionPassManager>(M.get());
+ FPasses->add(createTargetTransformInfoWrapperPass(TargetIRAnalysis()));
+
----------------
morehouse wrote:
> morehouse wrote:
> > Why do we add a `TargetTransformInfoWrapperPass` to both `Passes` and `FPasses`?
> Do we need both `Passes` and `FPasses`?
I think because we're just adding a loop vectorize pass, we don't need `FPasses`. The loop vectorize pass lives within the regular `ModulePassManager`, not the `FunctionPassManager`. I decided to put it in the code so, in the future, it would be easier to add different kinds of passes to the fuzz target. Should I remove it?
================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:159
+ std::unique_ptr<RTDyldMemoryManager>(RTDyldMM));
+ builder.setOptLevel(OLvl);
+ builder.setTargetOptions(InitTargetOptionsFromCodeGenFlags());
----------------
morehouse wrote:
> If the JIT does optimization already, do we need to call `OptLLVM` at all? Will the vectorizer kick in without `OptLLVM`?
I'll look into this more. I couldn't find an answer quickly.
Repository:
rC Clang
https://reviews.llvm.org/D49526
More information about the llvm-commits
mailing list