[PATCH] Fix -save-temp doesn't work well with ObjCARC, sanitizer and profiling

Steven Wu stevenwu at apple.com
Mon Jul 13 13:45:22 PDT 2015


Hi all

Currently, -save-temp option doesn’t work well with ObjCARC, sanitizer and profiling instrumentation. It will drop all ObjCARC optimizations, runs sanitizer pass very early in the pipeline and profiling instrumentation will happen twice (which is a no-op second time). They are because of a combination of two issues:
1. Language options are not parsed and get dropped when the input is LLVM IR. Thus no ObjcARC pass and Sanitizer pass are run from bitcode input.
2. We use -disable-llvm-optzns to get pristine LLVM IR generated from front-end but the flag is not as strong as expected. It will run the instrumentation passes like sanitizer and profiling.

In this patch, I added a new flag -disable-llvm-passes to disable every pass from optimization pipeline including instrumentations and use it in -save-temp. It should be useful for debugging clang CodeGen as well. I also change the clang front-end to parse ObjcARC and sanitizer flag in all conditions. I didn’t touch -disable-llvm-optzns because I am not sure if the flag is supposed to disable instrumentation passes and if someone is relying on something like:
clang -sanitizer=address -disable-llvm-optzns
Tightening up -disable-llvm-optzns might break them.

Thanks

Steven

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-save-temp-when-using-objc-arc-sanitizer-and-prof.patch
Type: application/octet-stream
Size: 9694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150713/3f98188e/attachment.obj>


More information about the cfe-commits mailing list