Patchwork Change the ordering of cdce pass

login
register
mail settings
Submitter Easwaran Raman
Date June 15, 2012, 1:38 a.m.
Message ID <CAPK5YPZh1+8mDebgst0YPoO__j4yYquYFNdFcS2_D5=B14vsgQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/165030/
State New
Headers show

Comments

Easwaran Raman - June 15, 2012, 1:38 a.m.
The conditional dead call elimination pass shrink wraps certain dead
calls to math functions. It doesn't handle case like this:

D.142420_139 = powD.549 (D.142421_138, D.142419_132);
 fooD.120935.barD.113815 = D.142420_139;
# foo.bar is dead here.

This code gets cleaned up by DCE and leaves only pow, which can then
be shrink-wrapped by cdce. So it seems reasonable to do this
reordering. Bootstraps on x86_64 on linux with no test regression. OK
for trunk?

- Easwaran

----------------------

2012-06-14   Easwaran Raman  <eraman@google.com>

	* gcc/passes.c (init_optimization_passes): Remove pass_call_cdce
	from its current position and insert after pass_dce.
Easwaran Raman - June 15, 2012, 1:40 a.m.
ChangeLog entry has a gcc/ prefix that shouldn't be there. Here is the
revised entry:

2012-06-14   Easwaran Raman  <eraman@google.com>

	* passes.c (init_optimization_passes): Remove pass_call_cdce
	from its current position and insert after pass_dce.



On Thu, Jun 14, 2012 at 6:38 PM, Easwaran Raman <eraman@google.com> wrote:
> The conditional dead call elimination pass shrink wraps certain dead
> calls to math functions. It doesn't handle case like this:
>
> D.142420_139 = powD.549 (D.142421_138, D.142419_132);
>  fooD.120935.barD.113815 = D.142420_139;
> # foo.bar is dead here.
>
> This code gets cleaned up by DCE and leaves only pow, which can then
> be shrink-wrapped by cdce. So it seems reasonable to do this
> reordering. Bootstraps on x86_64 on linux with no test regression. OK
> for trunk?
>
> - Easwaran
>
> ----------------------
>
> 2012-06-14   Easwaran Raman  <eraman@google.com>
>
>        * gcc/passes.c (init_optimization_passes): Remove pass_call_cdce
>        from its current position and insert after pass_dce.
>
> Index: gcc/passes.c
> ===================================================================
> --- gcc/passes.c        (revision 188535)
> +++ gcc/passes.c        (working copy)
> @@ -1374,7 +1374,6 @@ init_optimization_passes (void)
>       NEXT_PASS (pass_complete_unrolli);
>       NEXT_PASS (pass_ccp);
>       NEXT_PASS (pass_forwprop);
> -      NEXT_PASS (pass_call_cdce);
>       /* pass_build_alias is a dummy pass that ensures that we
>         execute TODO_rebuild_alias at this point.  Re-building
>         alias information also rewrites no longer addressed
> @@ -1387,6 +1386,7 @@ init_optimization_passes (void)
>       NEXT_PASS (pass_merge_phi);
>       NEXT_PASS (pass_vrp);
>       NEXT_PASS (pass_dce);
> +      NEXT_PASS (pass_call_cdce);
>       NEXT_PASS (pass_cselim);
>       NEXT_PASS (pass_tree_ifcombine);
>       NEXT_PASS (pass_phiopt);
Xinliang David Li - June 15, 2012, 4:13 a.m.
It looks reasonable to move it after DCE which exposes more opportunities.

David

On Thu, Jun 14, 2012 at 6:38 PM, Easwaran Raman <eraman@google.com> wrote:
> The conditional dead call elimination pass shrink wraps certain dead
> calls to math functions. It doesn't handle case like this:
>
> D.142420_139 = powD.549 (D.142421_138, D.142419_132);
>  fooD.120935.barD.113815 = D.142420_139;
> # foo.bar is dead here.
>
> This code gets cleaned up by DCE and leaves only pow, which can then
> be shrink-wrapped by cdce. So it seems reasonable to do this
> reordering. Bootstraps on x86_64 on linux with no test regression. OK
> for trunk?
>
> - Easwaran
>
> ----------------------
>
> 2012-06-14   Easwaran Raman  <eraman@google.com>
>
>        * gcc/passes.c (init_optimization_passes): Remove pass_call_cdce
>        from its current position and insert after pass_dce.
>
> Index: gcc/passes.c
> ===================================================================
> --- gcc/passes.c        (revision 188535)
> +++ gcc/passes.c        (working copy)
> @@ -1374,7 +1374,6 @@ init_optimization_passes (void)
>       NEXT_PASS (pass_complete_unrolli);
>       NEXT_PASS (pass_ccp);
>       NEXT_PASS (pass_forwprop);
> -      NEXT_PASS (pass_call_cdce);
>       /* pass_build_alias is a dummy pass that ensures that we
>         execute TODO_rebuild_alias at this point.  Re-building
>         alias information also rewrites no longer addressed
> @@ -1387,6 +1386,7 @@ init_optimization_passes (void)
>       NEXT_PASS (pass_merge_phi);
>       NEXT_PASS (pass_vrp);
>       NEXT_PASS (pass_dce);
> +      NEXT_PASS (pass_call_cdce);
>       NEXT_PASS (pass_cselim);
>       NEXT_PASS (pass_tree_ifcombine);
>       NEXT_PASS (pass_phiopt);
Richard Guenther - June 15, 2012, 8:16 a.m.
On Fri, Jun 15, 2012 at 3:40 AM, Easwaran Raman <eraman@google.com> wrote:
> ChangeLog entry has a gcc/ prefix that shouldn't be there. Here is the
> revised entry:
>
> 2012-06-14   Easwaran Raman  <eraman@google.com>
>
>        * passes.c (init_optimization_passes): Remove pass_call_cdce
>        from its current position and insert after pass_dce.

Ok.

Thanks,
Richard.

>
>
> On Thu, Jun 14, 2012 at 6:38 PM, Easwaran Raman <eraman@google.com> wrote:
>> The conditional dead call elimination pass shrink wraps certain dead
>> calls to math functions. It doesn't handle case like this:
>>
>> D.142420_139 = powD.549 (D.142421_138, D.142419_132);
>>  fooD.120935.barD.113815 = D.142420_139;
>> # foo.bar is dead here.
>>
>> This code gets cleaned up by DCE and leaves only pow, which can then
>> be shrink-wrapped by cdce. So it seems reasonable to do this
>> reordering. Bootstraps on x86_64 on linux with no test regression. OK
>> for trunk?
>>
>> - Easwaran
>>
>> ----------------------
>>
>> 2012-06-14   Easwaran Raman  <eraman@google.com>
>>
>>        * gcc/passes.c (init_optimization_passes): Remove pass_call_cdce
>>        from its current position and insert after pass_dce.
>>
>> Index: gcc/passes.c
>> ===================================================================
>> --- gcc/passes.c        (revision 188535)
>> +++ gcc/passes.c        (working copy)
>> @@ -1374,7 +1374,6 @@ init_optimization_passes (void)
>>       NEXT_PASS (pass_complete_unrolli);
>>       NEXT_PASS (pass_ccp);
>>       NEXT_PASS (pass_forwprop);
>> -      NEXT_PASS (pass_call_cdce);
>>       /* pass_build_alias is a dummy pass that ensures that we
>>         execute TODO_rebuild_alias at this point.  Re-building
>>         alias information also rewrites no longer addressed
>> @@ -1387,6 +1386,7 @@ init_optimization_passes (void)
>>       NEXT_PASS (pass_merge_phi);
>>       NEXT_PASS (pass_vrp);
>>       NEXT_PASS (pass_dce);
>> +      NEXT_PASS (pass_call_cdce);
>>       NEXT_PASS (pass_cselim);
>>       NEXT_PASS (pass_tree_ifcombine);
>>       NEXT_PASS (pass_phiopt);
H.J. Lu - June 17, 2012, 6:35 p.m.
On Thu, Jun 14, 2012 at 6:38 PM, Easwaran Raman <eraman@google.com> wrote:
> The conditional dead call elimination pass shrink wraps certain dead
> calls to math functions. It doesn't handle case like this:
>
> D.142420_139 = powD.549 (D.142421_138, D.142419_132);
>  fooD.120935.barD.113815 = D.142420_139;
> # foo.bar is dead here.
>
> This code gets cleaned up by DCE and leaves only pow, which can then
> be shrink-wrapped by cdce. So it seems reasonable to do this
> reordering. Bootstraps on x86_64 on linux with no test regression. OK
> for trunk?
>
> - Easwaran
>
> ----------------------
>
> 2012-06-14   Easwaran Raman  <eraman@google.com>
>
>        * gcc/passes.c (init_optimization_passes): Remove pass_call_cdce
>        from its current position and insert after pass_dce.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53710

It may expose a latent bug.

Patch

Index: gcc/passes.c
===================================================================
--- gcc/passes.c	(revision 188535)
+++ gcc/passes.c	(working copy)
@@ -1374,7 +1374,6 @@  init_optimization_passes (void)
       NEXT_PASS (pass_complete_unrolli);
       NEXT_PASS (pass_ccp);
       NEXT_PASS (pass_forwprop);
-      NEXT_PASS (pass_call_cdce);
       /* pass_build_alias is a dummy pass that ensures that we
 	 execute TODO_rebuild_alias at this point.  Re-building
 	 alias information also rewrites no longer addressed
@@ -1387,6 +1386,7 @@  init_optimization_passes (void)
       NEXT_PASS (pass_merge_phi);
       NEXT_PASS (pass_vrp);
       NEXT_PASS (pass_dce);
+      NEXT_PASS (pass_call_cdce);
       NEXT_PASS (pass_cselim);
       NEXT_PASS (pass_tree_ifcombine);
       NEXT_PASS (pass_phiopt);