Speedup CSE by 5%

Jeffrey A Law law@redhat.com
Thu Jan 27 20:24:00 GMT 2005


On Wed, 2005-01-26 at 09:43 -0500, Kazu Hirata wrote:
> Hi Jeff,
> 
> > I understand all that.  However, if you look at the first call to
> > validate_change (inside an ASM_OPERANDS case) you'll see a case where
> > I think we can modify x without copying it first.
> 
> I think the proposed patch is actually safe.  Consider
> 
>     case ASM_OPERANDS:
>       for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--)
> 	validate_change (insn, &ASM_OPERANDS_INPUT (x, i),
> 			 fold_rtx (ASM_OPERANDS_INPUT (x, i), insn), 0);
>       break;
> 
> validate_change enters a change into the CHANGES vector like so
> 
>   changes[num_changes].object = object;
> 
> apply_change_group starts out like so:
> 
>   for (i = 0; i < num_changes; i++)
>     {
>       rtx object = changes[i].object;
> 
>       /* If there is no object to test or if it is the same as the one we
>          already tested, ignore it.  */
>       if (object == 0 || object == last_validated)
> 	continue;
> 
> So, if we have changes[i].object == 0 for each i, apply_change_group
> does nothing but set BB_DIRTY flag, which makes sense because we need
> an insn to validate a change.
> 
> Just to make things clear, we might want to do something like this:
> 
>     case ASM_OPERANDS:
>       if (insn)
> 	{
> 	  for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--)
> 	    validate_change (insn, &ASM_OPERANDS_INPUT (x, i),
> 			     fold_rtx (ASM_OPERANDS_INPUT (x, i), insn), 0);
> 	}
>       break;
Ah.  OK.  Thanks for the explanation.

jeff




More information about the Gcc-patches mailing list