Hi, On Thu, Jun 20, 2013 at 01:32:38PM +0200, Jan Hubicka wrote: > > > > 2013-06-11 Martin Jambor <mjam...@suse.cz> > > > > PR tree-optimization/57358 > > * ipa-prop.c (ipa_func_spec_opts_forbid_analysis_p): New function. > > (ipa_compute_jump_functions_for_edge): Bail out if it returns true. > > (ipa_analyze_params_uses): Generate pessimistic info when true. > > > > testsuite > > * gcc.dg/ipa/pr57358.c: New test. > > > > Index: src/gcc/ipa-prop.c > > =================================================================== > > --- src.orig/gcc/ipa-prop.c > > +++ src/gcc/ipa-prop.c > > @@ -78,6 +78,21 @@ struct ipa_cst_ref_desc > > > > static alloc_pool ipa_refdesc_pool; > > > > +/* Return true if DECL_FUNCTION_SPECIFIC_OPTIMIZATION of the decl > > associated > > + with NODE should prevent us from analyzing it for the purposes of > > IPA-CP. */ > > + > > +static bool > > +ipa_func_spec_opts_forbid_analysis_p (struct cgraph_node *node) > > +{ > > + tree fs_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node->symbol.decl); > > + struct cl_optimization *os; > > + > > + if (!fs_opts) > > + return false; > > + os = TREE_OPTIMIZATION (fs_opts); > > + return !os->x_optimize || !os->x_flag_ipa_cp; > > +} > > Hmm, somewhat ugly, but I suppose it is as ugly as it needs to be. > I wonder about the other IPA passes. Do we want to always ignore them?
Well, I suppose that if we wanted to truly support the optimize attribute in its full strength and generality (or at least make an effort to do so), all IPA passes would need to check for their flag(s) their. In fact, this should be even more ugly if done really properly. -fno-indirect-inlinig should be checked in ipa_analyze_call_uses, for example, -fno-devirtualize at various other places... And of course, we should probably never just bail out but mark the flags in the IPA structures instead because they are used by both IPA-CP and inlining and perhaps disabling the features in one should not disable it another... ...so I just decided this has never worked and I was not going to spend too much time fixing it. I hesitated about the os->x_flag_ipa_cp test, but eventually thought it might be useful for us when debugging so I kept it. Still, publicly I'd continue saying that IPA passes cannot be adjusted by the optimize attribute. > How the ICE happens? Is it because we don't do the analysis? No, we do, and we ask alias oracle about stuff even though there are no VDEFs and VUSEs which segfaults. IPA passes just have to be careful not to ICE on -O0 functions. Thanks, Martin