Message ID | 20160503192844.GA57857@kam.mff.cuni.cz |
---|---|
State | New |
Headers | show |
On Tue, 3 May 2016, Jan Hubicka wrote: > Hi, > the code path handling the case where callee is missing return statement but calle > statement has LHS is broken in tree-inline since anonymous SSA_NAMEs was introduced. > This code is not not used because all those inlines are disabled by > gimple_check_call_matching_types, but since I would like to drop the checks it seems > good idea to fix the code path rather than dropping it. This copies what Jakub's > code does when redirecting to unreachable. > > Bootstrapped/regtesetd x86_64-linux, OK? LGTM. [we should eventually simply allow "anonymous" default defs which would simply be not registered with the var->default-def map but just be marked SSA_NAME_IS_DEFAULT_DEF and having a GIMPLE_NOP def. Not sure where having this would break today, maybe some checking bits in verify-ssa are not happy with such default defs] Thanks, Richard. > Honza > > * tree-inline.c (expand_call_inline): Fix path inlining function > with no return statement. > Index: tree-inline.c > =================================================================== > --- tree-inline.c (revision 235839) > +++ tree-inline.c (working copy) > @@ -4708,7 +4708,7 @@ expand_call_inline (basic_block bb, gimp > { > tree name = gimple_call_lhs (stmt); > tree var = SSA_NAME_VAR (name); > - tree def = ssa_default_def (cfun, var); > + tree def = var ? ssa_default_def (cfun, var) : NULL; > > if (def) > { > @@ -4719,6 +4719,11 @@ expand_call_inline (basic_block bb, gimp > } > else > { > + if (!var) > + { > + tree var = create_tmp_reg_fn (cfun, TREE_TYPE (name), NULL); > + SET_SSA_NAME_VAR_OR_IDENTIFIER (name, var); > + } > /* Otherwise make this variable undefined. */ > gsi_remove (&stmt_gsi, true); > set_ssa_default_def (cfun, var, name);
Index: tree-inline.c =================================================================== --- tree-inline.c (revision 235839) +++ tree-inline.c (working copy) @@ -4708,7 +4708,7 @@ expand_call_inline (basic_block bb, gimp { tree name = gimple_call_lhs (stmt); tree var = SSA_NAME_VAR (name); - tree def = ssa_default_def (cfun, var); + tree def = var ? ssa_default_def (cfun, var) : NULL; if (def) { @@ -4719,6 +4719,11 @@ expand_call_inline (basic_block bb, gimp } else { + if (!var) + { + tree var = create_tmp_reg_fn (cfun, TREE_TYPE (name), NULL); + SET_SSA_NAME_VAR_OR_IDENTIFIER (name, var); + } /* Otherwise make this variable undefined. */ gsi_remove (&stmt_gsi, true); set_ssa_default_def (cfun, var, name);