On Tue, Jun 10, 2014 at 11:23 AM, Zhenqiang Chen wrote:
>         * loop-invariant.c (struct invariant): Add a new member: eqno;
>         (find_identical_invariants): Update eqno;
>         (create_new_invariant): Init eqno;
>         (get_inv_cost): Compute comp_cost wiht eqno;
>         (gain_for_invariant): Take spill cost into account.

Look OK except ...

> @@ -1243,7 +1256,13 @@ gain_for_invariant (struct invariant *inv,
> unsigned *regs_needed,
>                  + IRA_LOOP_RESERVED_REGS
>                  - ira_class_hard_regs_num[cl];
>        if (size_cost > 0)
> -       return -1;
> +       {
> +         int spill_cost = target_spill_cost [speed] * (int) regs_needed[cl];
> +         if (comp_cost <= spill_cost)
> +           return -1;
> +
> +         return 2;
> +       }
>        else
>         size_cost = 0;
>      }

... why "return 2", instead of just falling through to "return
comp_cost - size_cost;"?

Ciao!
Steven

Reply via email to