[PATCH: PR/40416] stop sinking expression if the target bb post dominates from bb

Richard Guenther richard.guenther@gmail.com
Tue Jun 16 09:55:00 GMT 2009


On Tue, Jun 16, 2009 at 10:58 AM, Carrot Wei<carrot@google.com> wrote:
> Hi
>
> This patch is to fix the bug
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40416
>
> If the target bb post dominates from bb and we move the expression to target
> bb, it can't be executed less frequently. So we can't get any benefit from it.
>
> ChangeLog:
> 2009-06-16  Carrot Wei  <carrot@google.com>
>
>        PR/40416
>        * tree-ssa-sink.c: add code to stop sinking expression if the target
>        bb post dominates from bb.
>
> Test:
> x86 bootstrap.
> Gcc regression tests for x86.
> One new ICE testsuite/gcc.dg/pr35065.c. It is occurred in a very late rtl pass
> machine_reorg with an invalid x86 address expression. It should be caused by
> an unknown bug in rtl passes.

Unfortunately as you expose a bug you are resposible for fixing
it ...

The patch itself is ok as soon as it no longer exposes that bug
and with added comments before the dominator checks (similar
to the existing check).

Thanks,
Richard.

> thanks
> Carrot
>
>
> Index: tree-ssa-sink.c
> ===================================================================
> --- tree-ssa-sink.c     (revision 148480)
> +++ tree-ssa-sink.c     (working copy)
> @@ -384,6 +384,9 @@ statement_sink_location (gimple stmt, ba
>          || sinkbb->loop_father != frombb->loop_father)
>        return false;
>
> +      if (dominated_by_p (CDI_POST_DOMINATORS, frombb, sinkbb))
> +        return false;
> +
>       *togsi = gsi_for_stmt (use);
>       return true;
>     }
> @@ -411,6 +414,9 @@ statement_sink_location (gimple stmt, ba
>       || sinkbb->loop_father != frombb->loop_father)
>     return false;
>
> +  if (dominated_by_p (CDI_POST_DOMINATORS, frombb, sinkbb))
> +    return false;
> +
>   *togsi = gsi_after_labels (sinkbb);
>
>   return true;
>



More information about the Gcc-patches mailing list