On Sat, Oct 29, 2011 at 2:36 AM, Maxim Kuvyrkov <ma...@codesourcery.com> wrote: > On 29/10/2011, at 1:57 AM, Richard Guenther wrote: > >> >> We fail to keep the cannot-inline flag up-to-date when turning >> indirect to direct calls. The following patch arranges to do >> this during statement folding (which should always be called >> when that happens). It also makes sure to copy the updated flag >> to the edge when iterating early inlining. >> >> Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok? > > The patch looks good to me, but I'm not a reviewer. A couple of notes below. > >> >> ! /* Check whether propagating into the function address made the >> ! call direct, and thus possibly non-inlineable. >> ! ??? This asks for a more conservative setting of the non-inlinable >> ! flag, namely true for all indirect calls. But that would require >> ! that we can re-compute the flag conservatively, thus it isn't >> ! ever initialized from something else than return/argument type >> ! checks . */ >> ! callee = gimple_call_fndecl (stmt); >> ! if (callee >> ! && !gimple_check_call_matching_types (stmt, callee)) >> ! gimple_call_set_cannot_inline (stmt, true); > > Don't you need to use cgraph_function_or_thunk_node wrapper here?
No, we are looking at a call statement - all clones whould have the same function signature. >> Index: gcc/ipa-inline.c >> =================================================================== >> *** gcc/ipa-inline.c (revision 180608) >> --- gcc/ipa-inline.c (working copy) >> *************** early_inliner (void) >> *** 1949,1954 **** >> --- 1949,1956 ---- >> = estimate_num_insns (edge->call_stmt, &eni_size_weights); >> es->call_stmt_time >> = estimate_num_insns (edge->call_stmt, &eni_time_weights); >> + edge->call_stmt_cannot_inline_p >> + = gimple_call_cannot_inline_p (edge->call_stmt); > > Wouldn't ipa_make_edge_direct or cgraph_make_edge_direct be a better place > for this? Not without major reorganization (thus, try to keep the cgraph intact during scalar opts). We never arrange to call those function during inlining. Richard. > > Thank you, > > -- > Maxim Kuvyrkov > CodeSourcery / Mentor Graphics > > > > >