On 03/24/2017 12:49 PM, Richard Biener wrote: > On Fri, Mar 24, 2017 at 10:25 AM, Martin Liška <mli...@suse.cz> wrote: >> Hello. >> >> Briefly described in the PR, running ICF (without any optimization level) >> can create a thunk call >> that does not use an SSA_NAME which is a default def of an argument of the >> caller: >> >> c (complex float b) >> { >> complex float arg.1; >> float retval.0; >> >> <bb 2> [100.00%]: >> arg.1_2 = b; >> retval.0_4 = a (arg.1_2); [tail call] >> >> return retval.0_4; >> >> } >> >> The "arg" variable creation was introduced by Jason in r207301. >> As complex type is passed as invisible reference, we need to find address of >> the argument. >> Thus I'm suggesting to find it alternatively via SSA_NAME_DEF_STMT. >> >> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >> And fixes the ICE >> on s390x cross compiler. >> >> Ready to be installed? > > Ick, that looks like fragile code ... looks like the > call_from_thunk_p case expects > the default def or the param-decl. So why not create it that way? Or
Not creating the "arg" and directly passing the PARM_DECL will break verifier: /home/marxin/Programming/testcases/pr80104.c:10:1: error: invalid argument to gimple call } ^ b # .MEM_2 = VDEF <.MEM_1(D)> retval.0_3 = a (b); [tail call] /home/marxin/Programming/testcases/pr80104.c:10:1: internal compiler error: verify_gimple failed > simply not do > this "optimization"? You mean understanding when an argument of a wrapper (thunk) will need invisible reference and if so, then ICF should not do the optimization? Martin > > Richard. > >> Martin