This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] running DCE before DOM1
- From: law at redhat dot com
- To: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- Cc: gcc-patches at gcc dot gnu dot org, jh at suse dot cz, dnovillo at redhat dot com
- Date: Thu, 15 Jan 2004 20:52:46 -0700
- Subject: Re: [tree-ssa] running DCE before DOM1
- Reply-to: law at redhat dot com
In message <200401160200.56276.s.bosscher@student.tudelft.nl>, Steven Bosscher
writes:
>Finally, it also fixes the problem for Bug 13629, which is about using dead
>expressions for CSE, making the dead code only partially dead:
>
>int *data;
>void partial_dead (int i, int j)
>{
> int k = i * j;
> if (i & j)
> data[0] = i * j;
>}
>
>--> without the patch:
>partial_dead:
> movl 4(%esp), %edx # i
> movl 8(%esp), %eax # j
> movl %edx, %ecx # k = i
> imull %eax, %ecx # k = i * j
> testl %eax, %edx # if (j & i)
> je .L1 # goto <L1>
> movl data, %eax
> movl %ecx, (%eax) # *data = k
>.L1:
> ret
>
>--> with the patch applied:
>partial_dead:
> movl 4(%esp), %edx # i
> movl 8(%esp), %eax # j
> testl %eax, %edx # if (j & i)
> je .L1 # goto <L1>
> imull %eax, %edx # k = i * j
> movl data, %eax
> movl %edx, (%eax) # *data = k
>.L1:
> ret
>
>The effect of all this on the resulting object files seems to be negligible.
>
>The full unidiff for 8361.s with and without the patch is only 51 lines long
>and is mostly about replacing uses of %edi with %esi for some obscure reason,
>
>and exactly one movl less with the patch applied :-)
>
>I don't know if running DCE so early can have a negative impact on other
>passes. Thoughts?
>
>Gr.
>Steven
>
> * tree-optimize.c (init_tree_optimization_passes): Run DCE
> before the first dominator optimization pass.
This is fine once it has been through the usual bootstrap and test
cycle. Note that you're probably going to have to tweak some of the
tests in the testsuite which scan specific dce dumps.
A quick find/grep combo indicates that the only tests you should need
to twiddle are in gcc.dg/tree-ssa.
jeff