[PATCH] Fix const/pure call RTL DCE (PR rtl-optimization/38245)

Paolo Bonzini bonzini@gnu.org
Wed Jan 14 09:00:00 GMT 2009


>    FOR_EACH_BB (bb)
> +    FOR_BB_INSNS (bb, insn)
> +      if (CALL_P (insn) && (noop_move_p (insn) || !marked_insn_p (insn)))
> +	find_call_stack_args (insn, true, fast);

Okay (actually I cannot approve the calls.c part) but can you avoid this
loop where it is not needed?  Something like

  if (CALL_P (insn))
    unmarked_calls--;

in mark_insn and

  if (CALL_P (insn))
    unmarked_calls += noop_move_p (insn) ? 2 : 1;

in prescan_insns_for_dce (or maybe even a bitmap to avoid the loop
altogether? but that would be a little more work) ought to do the job.

> +  if (!fast)
> +    /* Before any insns are deleted, we must remove the chains since
> +       they are not bidirectional.  */
> +    df_remove_problem (df_chain);

Do we want an assert that this problem is not around for fast DCE?

> @@ -266,9 +508,6 @@ delete_unmarked_insns (void)
>  	  else if (marked_insn_p (insn))
>  	    continue;
>  
> -	  if (!dbg_cnt (dce))
> -	    continue;
> -

Also leave this around.

Paolo



More information about the Gcc-patches mailing list