[PATCH] Modulo-scheduling improvements. Patch 2 of 2.

Andrey Belevantsev abel@ispras.ru
Thu Mar 15 14:14:00 GMT 2007


Hello Vladimir,

FWIW, I'd like to comment on how the patches behave on ia64.  We were 
trying to fix SMS to run it on ia64.  Two fixes were needed:  removal of 
  SMS profitability estimation, which is done by the first patch of this 
series, and correct generation of loop counter decrement in 
generate_prolog_epilog.  On top of these two patches, we did the 
following to correct these and related problems:

>  doloop_register_get (rtx insn ATTRIBUTE_UNUSED)
...
> !   if (!INSN_P (PREV_INSN (insn)))
> !     return NULL_RTX;
> !

Here, you wanted to support doloop patterns without PARALLEL; however, 
this spoils the support for PARALLEL doloops.  We had a doloop where the 
jump was preceded with NOTE_INSN_DELETED; this loop failed that check 
and was not recognized as a doloop.  I have fixed the problem here; you 
may also want to remove this check and fix doloop_condition_get so that 
it'll skip notes within a loop when finding an increment insn.


>    /* Generate the prolog, inserting its insns on the loop-entry edge.  */
>    start_sequence ();
> 
> !   if (count_reg && !count_init)
>     /* Generate a subtract instruction at the beginning of the prolog to
>        adjust the loop count by STAGE_COUNT.  */
> !    emit_move_insn (count_reg, gen_rtx_PLUS (GET_MODE (count_reg),
> !                                            count_reg,
> !                                            GEN_INT (-last_stage)));

Here we used expand_simple_binop instead of emit_move_insn, which 
doesn't work on ia64 (there is no way to generate this within a single 
insn).

> !
> 
>    for (i = 0; i < last_stage; i++)
>      duplicate_insns_of_cycles (ps, 0, i, 1);
> 
> +    /* Remove the decrements of the count_reg from the prolog.
> +       It has been already adjusted.  */
> +    insn = get_insns ();
> +    if (count_reg && !count_init)
> +      insn = NEXT_INSN (insn);

And here, you were assuming again that the decrement will be a single 
insn.  In our case, the following loop killed the decrement we've just 
created.

FWIW, the attached patch on top of your fixes allows gcc to bootstrap 
with BOOT_CFLAGS="-O2 -fmodulo-sched" on ia64.  It also passes a test 
run of SPEC CPU 2000 except gcc (for which I don't have fixed 64-bit 
compatible sources), crafty and galgel (those also fail without 
-fmodulo-sched).  Could you test this on ppc?

Andrey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-sms-ia64.diff
Type: text/x-patch
Size: 2863 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070315/f1abbc8d/attachment.bin>


More information about the Gcc-patches mailing list