This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][mem-ref] Adjust some testsuite patterns
- From: "Andrew Pinski" <pinskia at gmail dot com>
- To: "Richard Guenther" <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 9 Mar 2008 11:01:58 -0700
- Subject: Re: [PATCH][mem-ref] Adjust some testsuite patterns
- References: <Pine.LNX.4.64.0803091849500.4133@zhemvz.fhfr.qr>
Hi,
Some comments/questions.
On Sun, Mar 9, 2008 at 10:50 AM, Richard Guenther <rguenther@suse.de> wrote:
> Index: mem-ref/gcc/testsuite/gcc.dg/tree-ssa/complex-3.c
> ===================================================================
> *** mem-ref.orig/gcc/testsuite/gcc.dg/tree-ssa/complex-3.c 2008-03-09 16:08:20.000000000 +0100
> --- mem-ref/gcc/testsuite/gcc.dg/tree-ssa/complex-3.c 2008-03-09 16:17:52.000000000 +0100
> *************** float imag_part(COMPLEX_FLOAT a)
> *** 18,27 ****
> return ((float*)(&a))[1];
> }
>
> ! /* Test that the above gets optimized to REALPART_EXPR and IMAGPART_EXPR
> ! respectively. */
>
> ! /* { dg-final { scan-tree-dump-times "REALPART_EXPR" 2 "optimized" } } */
> ! /* { dg-final { scan-tree-dump-times "IMAGPART_EXPR" 1 "optimized" } } */
> /* { dg-final { cleanup-tree-dump "optimized" } } */
>
> --- 18,26 ----
> return ((float*)(&a))[1];
> }
>
> ! /* Test that the above gets optimized to proper float loads. */
>
> ! /* { dg-final { scan-tree-dump-times "MEM <float " 3 "optimized" } } */
> ! /* { dg-final { scan-tree-dump-times "\\\&a \\\+ 4" 1 "optimized" } } */
> /* { dg-final { cleanup-tree-dump "optimized" } } */
We should not be taking the address of a here. This is not a false
positive at all. REALPART_EXPR/IMAGPART_EXPR should not require the
address of the variable taken. Right? If you do now, then I think
you need to think that as we really don't want extra addressable
variables on the rtl level. Now if we don't fold it to
REALPART_EXPR/IMAGPART_EXPR, then something is really wrong and the
testcase should not be changed at all.
>
> Index: mem-ref/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c
> ===================================================================
> *** mem-ref.orig/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c 2008-03-09 16:10:04.000000000 +0100
> --- mem-ref/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-2.c 2008-03-09 16:10:51.000000000 +0100
> *************** t()
> *** 9,13 ****
> {
> return (int *)&a;
> }
> ! /* { dg-final { scan-tree-dump "a.a" "optimized"} } */
> /* { dg-final { cleanup-tree-dump "optimized" } } */
> --- 9,13 ----
> {
> return (int *)&a;
> }
> ! /* { dg-final { scan-tree-dump "return &a;" "optimized"} } */
> /* { dg-final { cleanup-tree-dump "optimized" } } */
> Index: mem-ref/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c
> ===================================================================
> *** mem-ref.orig/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c 2008-03-09 16:11:11.000000000 +0100
> --- mem-ref/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-3.c 2008-03-09 16:11:23.000000000 +0100
> *************** t ()
> *** 24,28 ****
> return (int *) &a;
> }
>
> ! /* { dg-final { scan-tree-dump "a.s2.c" "optimized"} } */
> /* { dg-final { cleanup-tree-dump "optimized" } } */
> --- 24,28 ----
> return (int *) &a;
> }
>
> ! /* { dg-final { scan-tree-dump "return &a;" "optimized"} } */
> /* { dg-final { cleanup-tree-dump "optimized" } } */
>
These 2 above testcases should be just removed as they no longer test
what they were testing for anymore, that is the folding into the take
the address of the first field of the struct.
Thanks,
Andrew Pinski