> > Does that work on callgraph cycles? Yes. Because ... > > + > > + node->set_nothrow_flag (true); > > + if (dump_file) > > + fprintf (dump_file, "Function found to be nothrow: %s\n", > > + current_function_name ()); > > + return execute_fixup_cfg (); > > Err - this doesn't make sense - you'd need to call this for > all _callers_. That is, this is dealt with by > > PUSH_INSERT_PASSES_WITHIN (pass_build_ssa_passes) > NEXT_PASS (pass_fixup_cfg); > ^^^^^^^ > > ? If not then this may paper over the issue I saw (dangling > call_stmt on a cgraph edge?).
... this one is unnecesary. Fixup happens in the following local optimization pass queue, so we do not need fixing here. I remember I removed this at one point, but apparently accidentally reverted the change. Will re-test with return 0. OK with these changes (and commiting separately the checking bits)? > > So please re-check with the above execute_fixup_cfg removed > (your simple patch doesn't handle direct recursion optimistically). Ah, you are right. I will add it - that is easy enoug to check. Thanks, Honza > > Thanks, > Richard. > > > +} > > + > > +} // anon namespace > > + > > +gimple_opt_pass * > > +make_pass_nothrow (gcc::context *ctxt) > > +{ > > + return new pass_nothrow (ctxt); > > +} > > Index: tree-pass.h > > =================================================================== > > --- tree-pass.h (revision 221682) > > +++ tree-pass.h (working copy) > > @@ -436,6 +436,7 @@ extern gimple_opt_pass *make_pass_remove > > *ctxt); > > extern gimple_opt_pass *make_pass_build_cgraph_edges (gcc::context *ctxt); > > extern gimple_opt_pass *make_pass_local_pure_const (gcc::context *ctxt); > > +extern gimple_opt_pass *make_pass_nothrow (gcc::context *ctxt); > > extern gimple_opt_pass *make_pass_tracer (gcc::context *ctxt); > > extern gimple_opt_pass *make_pass_warn_unused_result (gcc::context *ctxt); > > extern gimple_opt_pass *make_pass_diagnose_tm_blocks (gcc::context *ctxt); > > Index: ipa-inline-analysis.c > > =================================================================== > > --- ipa-inline-analysis.c (revision 221682) > > +++ ipa-inline-analysis.c (working copy) > > @@ -769,11 +769,16 @@ edge_set_predicate (struct cgraph_edge * > > > > /* If the edge is determined to be never executed, redirect it > > to BUILTIN_UNREACHABLE to save inliner from inlining into it. */ > > - if (predicate && false_predicate_p (predicate) && e->callee) > > + if (predicate && false_predicate_p (predicate)) > > { > > struct cgraph_node *callee = !e->inline_failed ? e->callee : NULL; > > - > > - e->redirect_callee (cgraph_node::get_create > > + if (e->speculative) > > + e->resolve_speculation (builtin_decl_implicit (BUILT_IN_UNREACHABLE)); > > + if (!e->callee) > > + e->make_direct (cgraph_node::get_create > > + (builtin_decl_implicit (BUILT_IN_UNREACHABLE))); > > + else > > + e->redirect_callee (cgraph_node::get_create > > (builtin_decl_implicit (BUILT_IN_UNREACHABLE))); > > e->inline_failed = CIF_UNREACHABLE; > > es->call_stmt_size = 0; > > > > > > -- > Richard Biener <rguent...@suse.de> > SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Jennifer Guild, > Dilip Upmanyu, Graham Norton HRB 21284 (AG Nuernberg)