Fix twolf -funroll-loops -O3 miscompilation (a semi-latent web.c bug)
Steven Bosscher
stevenb.gcc@gmail.com
Mon Nov 19 22:03:00 GMT 2012
On Mon, Nov 19, 2012 at 10:50 PM, Eric Botcazou wrote:
>> The root cause is the bad REG_EQUAL note. I think the most robust
>> solution is to make the webizer re-compute notes before renaming.
>> Patch for that is attached.
>
> Thanks for the analysis. However...
>
>> Ciao!
>> Steven
>>
>>
>> PR rtl-optimization/55006
>> * web.c (web_main): Add the DF_NOTE problem, and explain whatfor.
>>
>> Index: web.c
>> ===================================================================
>> --- web.c (revision 193454)
>> +++ web.c (working copy)
>> @@ -335,9 +335,16 @@ web_main (void)
>> unsigned int uses_num = 0;
>> rtx insn;
>>
>> + /* Add the flags and problems we need. The DF_EQ_NOTES flag is set so
>> + that uses of registers in REG_EQUAL and REG_EQUIV notes are included
>> + in the web that their DEF belongs to, so that these uses are also
>> + properly renamed. The DF_NOTE problem is added to make sure that
>> + all notes are up-to-date and valid: Re-computing the notes problem
>> + also cleans up all dead REG_EQUAL notes. */
>> df_set_flags (DF_NO_HARD_REGS + DF_EQ_NOTES);
>> df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
>> df_chain_add_problem (DF_UD_CHAIN);
>> + df_note_add_problem ();
>> df_analyze ();
>> df_set_flags (DF_DEFER_INSN_RESCAN);
>
> ... that's not very satisfactory, as web doesn't use the DF_NOTE problem, so
> adding it just to clean things up in the other kind of notes is weird.
True.
> Can't we arrange to clean up the REG_EQUAL/REG_EQUIV notes when we use them,
> i.e. when DF_EQ_NOTES is set?
That could be done, yes. Cleaning up the REG_EQ* notes requires
liveness at the insn level, so it'd require a bigger re-organization
of the code. Perhaps adding a new pass (conditional on DF_EQ_NOTES)
over all insn in df_lr_finalize, tracking liveness and calling
df_remove_dead_eq_notes on each insn.
But most passes that use the REG_EQ* notes don't set the DF_EQ_NOTES flag.
Perhaps df_note_add_problem should imply setting DF_EQ_NOTES?
Ciao!
Steven
More information about the Gcc-patches
mailing list