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

Attachment: 0001-Fix-save-temp-when-using-objc-arc-sanitizer-and-prof.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to