The other case I'm working on is to selectively apply tailcall optimization when optimizing for size. Clearly tail call optimiztion is desirable along frequently executed edges. Otherwise we found tailcall optimization generates a sicall_epilogue for each tailcall which has a significant impact on size. This is true if the generated epilogue is large. I have a patch which prunes tail calls along edges which are determined to be infrequently executed from profile information. When no profile information is available we are reduced to using a heuristic whether the optimization will increase code size. However it would be useful to also use estimated branch probabilities The cases I'm looking at use switch cases heavily where branch probability information is reduced to even probabilities across all cases.
We're keen on improving the estimated branch probabilities in switch cases because we cannot always gather profile information on all code paths through a program. Cheers, Rahul