emmettneyman added inline comments.

================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:173
+  int s = getSize((char *) func_ptr);
+  memcpy(mem, func_ptr, s);
+}
----------------
morehouse wrote:
> Why do we need to copy the function somewhere else?  Looks very error-prone 
> and unnecessary.  Also makes this patch larger than it needs to be.
I'm copying the functions because otherwise, the generated machine code gets 
lost as soon as we exit that function's scope. So I'd have to run the functions 
inside `CreateJITFunction` if I don't copy it.

I thought about doing it this way: moving the code from `RunFuncsOnInputs` to 
the bottom of `CreateJITFunction` and then comparing the arrays after both 
calls to `CreateJITFunction` inside `HandleLLVM`. Do you think that would be 
cleaner?


================
Comment at: clang/tools/clang-fuzzer/handle-llvm/input_arrays.cpp:30
+  memcpy(b2, InputArrays[b_index], ArraySize * sizeof(int));
+  memcpy(c2, InputArrays[c_index], ArraySize * sizeof(int));
+}
----------------
morehouse wrote:
> Do the generated functions ever modify arrays a and b, or just c?  If just c, 
> we can avoid lots of memcpys here.
Right now the generated functions can modify any of the arrays.


Repository:
  rC Clang

https://reviews.llvm.org/D50194



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to