On 05/13/2011 11:26 AM, Richard Guenther wrote: > On Fri, May 13, 2011 at 5:01 PM, Nathan Froyd <froy...@codesourcery.com> > wrote: >> On 05/13/2011 10:52 AM, William J. Schmidt wrote: >>> This patch addresses PR46728, which notes that pow and powi need to be >>> lowered in tree phases to restore lost FMA opportunities and expose >>> vectorization opportunities. >>> >>> +struct gimple_opt_pass pass_lower_pow = >>> +{ >>> + { >>> + GIMPLE_PASS, >>> + "lower_pow", /* name */ >>> + NULL, /* gate */ >> >> Please make this controlled by an option; this pass doesn't need to be run >> all >> the time. >> >> IMHO, the pass shouldn't run at anything less than -O3, but that's for other >> people to decide. > > It was run unconditionally before, so unless we preserve the code at > expansion time we have to do it here.
We were doing it unconditionally before because we were calling it through folding and expansion, both of which only fired if we were expanding pow calls; now we're groveling over the whole IR to look for optimization opportunities that, let's be honest, the vast majority of code is never going to care about. The whole point of the patch is "to restore lost FMA opportunities and expose vectorization opportunities". The first reason *might* be good justification for running it at -O2, but the second reason calls for -O3 or at the very least flag_tree_vectorize. However, I don't think anybody's going to notice/care if -O1 stopped folding pow calls; could we at least add a flag_expensive_optimizations && optimize gate? -Nathan