[RFC] Running objc-arc-contract pass from bitcode input

Steven Wu stevenwu at apple.com
Thu Feb 19 16:05:13 PST 2015


Hi all

Currently, we have objc-arc-contract pass added by clang into its CodeGenPass when the input is objective-C and it uses ARC. However, when the input is bitcode, it will not be added by clang or llc but this pass is actually mandatory for objc-arc. This creates problem to reproduce build from bitcode which generated by clang using -emit-llvm or -save-temps. LTO currently works around the issue by always running objc-arc-contract pass. I think we should have the similar fixes in clang and llc.

The first suggestion is simply always run this pass in llc and clang as well. objc-arc-contract is no-op on codes that are not using ARC and it shouldn’t have too much compile time penalty.
The second suggestion is creating a module flag that indicates the code is using ARC and the pass is only run when the module flag is set. In the case of LTO, it will by default get added when any of the module uses ARC. It is probably too much to make this a function attribute.

I know there are some on-going efforts to encode these options into bitcode, so I just want to make sure I am not going the wrong way. Let me know if there is any other better idea.

Thanks

Steven





More information about the llvm-commits mailing list