On Mon, May 29, 2017 at 8:10 PM, Alexander Monakov <amona...@ispras.ru> wrote:
> On Mon, 29 May 2017, Alexander Monakov wrote:
>> +/* This helper function is invoked from diagnostic routines prior to 
>> aborting
>> +   due to internal compiler error.  If a dump file is set up, dump the
>> +   current function.  */
>> +
>> +void
>> +emergency_dump_function ()
>> +{
>> +  if (!dump_file || !current_pass || !cfun)
>> +    return;
>> +  fnotice (stderr, "function dumped to file %s\n", dump_file_name);
>> +  execute_function_dump (cfun, current_pass);
>> +}
>
> I've noticed that the notice is not terribly useful.  Perhaps it's better to
> mention the failing pass when not producing the dump (untested):
>
> void
> emergency_dump_function ()
> {
>   if (!current_pass || !cfun)
>     return;
>   if (dump_file)
>     {
>       fnotice (stderr, "dump file: %s\n", dump_file_name);
>       execute_function_dump (cfun, current_pass);
>     }
>   else if (current_pass->name[0] != '*')
>     {
>       enum opt_pass_type pt = current_pass->type;
>       fnotice (stderr, "during %s pass: %s\n",
>                pt == GIMPLE_PASS ? "GIMPLE" : pt == RTL_PASS ? "RTL" : "IPA",
>                current_pass->name);
>     }
> }

If you want to improve here I'd do

   if (current_pass)
     fnotice (stderr, "during %s pass: %s\n", ...
   if (dump_file && cfun)
     {
        fnotice (..);
        execute_function_dump ...
     }

and I'd print the pass name even if it starts with '*' (that just
means it won't get a dumpfile).

Generally the patch looks good to me.

Thanks,
Richard.

> Alexander

Reply via email to