[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Emmett Neyman via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL338077: Updated llvm-proto-fuzzer to execute the compiled code (authored by emmettneyman, committed by ). Changed prior to commit: https://reviews.llvm.org/D49526?vs=157577&id=157591#toc Repository:

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 157577. emmettneyman added a comment. Made some minor fixes Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp clang/tools/clang-fuzzer/handle-llvm/CMakeLists.txt clang/

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:152 + typedef void (*func)(int*, int*, int*, int); + func f = (func) EE->getPointerToFunction(EntryFunc); + Can we use `reinterpret_cast` here? Repository: rC

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:125 + Context); + Module *M = Owner.get(); + if (!M) We should be able to get rid of this line now, and rename Owner again

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 157553. emmettneyman added a comment. Changed int to CodeGenOpt::Level and fixed unique_ptr issue Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp clang/tools/clang-fuzz

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added a comment. In https://reviews.llvm.org/D49526#1177208, @morehouse wrote: > Do we need to parse the arguments for opt-level, or can we just hardcode > `-O2` and remove the argument parsing code? I have the argument parsing code since the original `clang-proto-fuzzer` code ha

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added a comment. Do we need to parse the arguments for opt-level, or can we just hardcode `-O2` and remove the argument parsing code? Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:144 + Context); + Module

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 157545. emmettneyman added a comment. Small change to fix line length Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp clang/tools/clang-fuzzer/handle-llvm/CMakeLists.tx

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:144 + Context); + Module *M = Owner.get(); + if (!M) morehouse wrote: > Why not just rename `Owner` to `M` and remove

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 157544. emmettneyman added a comment. - Code style fixes - Removed `FPasses` - Allowed CL Args to specify opt level for `OptLLVM()` Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initi

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:147 + builder.setUseOrcMCJITReplacement(false); + builder.setMCJITMemoryManager(make_unique()); + builder.setOptLevel(OLvl); morehouse wrote: > This uses `llvm:make_uni

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-26 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:115 + make_unique(M.get()); + FPasses->add(createTargetTransformInfoWrapperPass(TargetIRAnalysis())); + emmettneyman wrote: > morehouse wrote: > > morehouse wr

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:159 + std::unique_ptr(RTDyldMM)); + builder.setOptLevel(OLvl); + builder.setTargetOptions(InitTargetOptionsFromCodeGenFlags()); emmettneyman wrote: > moreh

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 157388. emmettneyman added a comment. Fixed some things, made code cleaner Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp clang/tools/clang-fuzzer/handle-llvm/CMakeLis

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Emmett Neyman via Phabricator via cfe-commits
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); more

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp:44 + + PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry(); + initializeCore(Registry); Unnecessary `llvm::` Comment a

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 157335. emmettneyman added a comment. - cleaned up code and moved initialization code - removed fake command line parsing Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:208 + + static_cast(RTDyldMM)->invalidateInstructionCache(); + morehouse wrote: > This cast shouldn't be necessary. Turns out this line is redundant anyways. `EE

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:190 + builder.setMCJITMemoryManager( + std::unique_ptr(RTDyldMM)); + builder.setOptLevel(OLvl); emmettneyman wrote: > morehouse wrote: > > emmettneyman wrote:

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:190 + builder.setMCJITMemoryManager( + std::unique_ptr(RTDyldMM)); + builder.setOptLevel(OLvl); morehouse wrote: > emmettneyman wrote: > > morehouse wrote:

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:190 + builder.setMCJITMemoryManager( + std::unique_ptr(RTDyldMM)); + builder.setOptLevel(OLvl); emmettneyman wrote: > morehouse wrote: > > emmettneyman wrote:

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-25 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:190 + builder.setMCJITMemoryManager( + std::unique_ptr(RTDyldMM)); + builder.setOptLevel(OLvl); morehouse wrote: > emmettneyman wrote: > > morehouse wrote:

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-24 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:190 + builder.setMCJITMemoryManager( + std::unique_ptr(RTDyldMM)); + builder.setOptLevel(OLvl); emmettneyman wrote: > morehouse wrote: > > These 3 lines can b

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-24 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:190 + builder.setMCJITMemoryManager( + std::unique_ptr(RTDyldMM)); + builder.setOptLevel(OLvl); morehouse wrote: > These 3 lines can be combined to `builde

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-24 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/CMakeLists.txt:17 -# Depend on LLVM IR intrinsic generation. +# Depend on LLVM IR instrinsic generation. set(handle_llvm_deps intrinsics_gen) Typo introduced here.

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-24 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 157138. emmettneyman added a comment. Cleaned up code Tried to get rid of ParseCommandLineOptions() call but could not figure out how to initialize a PassInfo object without it. Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/to

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-23 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 156862. emmettneyman added a comment. Made fixes to patch, rebased CMake file Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/handle-llvm/CMakeLists.txt clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp I

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-19 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:211-224 + std::string ErrorMsg1; + EngineBuilder builder1(std::move(Owner1)); + builder1.setMArch(MArch); + builder1.setMCPU(getCPUStr()); + builder1.setMAttrs(getFeatureList()); + b

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-19 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/CMakeLists.txt:21 + set(handle_llvm_deps) +endif() How are you doing your diff? Some of these changes are already upstream. Please rebase Comment at: clang

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-19 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 156370. emmettneyman added a comment. - Fixed typo that broke build Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/CMakeLists.txt clang/tools/clang-fuzzer/ExampleClangLLVMProtoFuzzer.cpp clang/tools/clang-

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-19 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 156364. emmettneyman added a comment. - Cleaned up leftover code from mmap memcpy Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/CMakeLists.txt clang/tools/clang-fuzzer/ExampleClangLLVMProtoFuzzer.cpp clan

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-19 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman updated this revision to Diff 156362. emmettneyman added a comment. - Switched to JIT for compilation and execution Repository: rC Clang https://reviews.llvm.org/D49526 Files: clang/tools/clang-fuzzer/CMakeLists.txt clang/tools/clang-fuzzer/ExampleClangLLVMProtoFuzzer.cpp

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-19 Thread Matt Morehouse via Phabricator via cfe-commits
morehouse added a comment. You can probably get rid of the llvm-objcopy code and make this a lot simpler with something like: 1. Call `getSection()` on the Binary object to get the text section. 2. Read the `sh_offset` and `sh_size` of that section. 3. Copy `sh_size` bytes from the start of the

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-18 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments. Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:209 + +// Helper function that converts ELF relocatable into raw machine code that +// can be executed in memory. Returns size of machine code. Did you look at using LLVM'

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-18 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman added a comment. The files Object.h Object.cpp llvm-objcopy.h are from llvm/tools/llvm-obj-copy with only slight modifications, mostly deleting irrelevant parts. Repository: rC Clang https://reviews.llvm.org/D49526 ___ cfe-c

[PATCH] D49526: Updated llvm-proto-fuzzer to execute the compiled code

2018-07-18 Thread Emmett Neyman via Phabricator via cfe-commits
emmettneyman created this revision. emmettneyman added reviewers: morehouse, kcc. Herald added subscribers: cfe-commits, mgorny. Herald added a reviewer: alexshap. Made changes to the llvm-proto-fuzzer - Added loop vectorizer optimization pass in order to have two IR versions - Updated old fuzz t