Commit 15caa2ab by Richard Guenther Committed by Richard Biener

re PR tree-optimization/30375 (tree-ssa-dse incorrectly removes struct initialization)

2007-09-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/30375
	PR tree-optimization/33560
	* tree-ssa-dse.c (get_use_of_stmt_lhs): Give up on uses
	with calls.

	Revert
	2006-05-22  Aldy Hernandez  <aldyh@redhat.com>

        * tree-ssa-dse.c (aggregate_vardecl_d): New.
        (dse_global_data): Add aggregate_vardecl field.
        (dse_possible_dead_store_p): New.
        Add prev_defvar variable.
        Allow immediate uses and previous immediate uses to differ
        if they are setting different parts of the whole.
        (get_aggregate_vardecl): New.
        (dse_record_partial_aggregate_store): New.
        (dse_whole_aggregate_clobbered_p): New.
        (dse_partial_kill_p): New.
        Call dse_maybe_record_aggregate_store().
        When checking whether a STMT and its USE_STMT refer to the
        same memory address, check also for partial kills that clobber
        the whole.
        Move some variable definitions to the block where they are used.
        (aggregate_vardecl_hash): New.
        (aggregate_vardecl_eq): New.
        (aggregate_vardecl_free): New.
        (aggregate_whole_store_p): New.
        (tree_ssa_dse): Initialize and free aggregate_vardecl.
        Mark which aggregate stores we care about.

	* gcc.dg/tree-ssa/complex-4.c: XFAIL.
	* gcc.dg/tree-ssa/complex-5.c: Likewise.
	* gcc.dg/tree-ssa/ssa-dse-9.c: Likewise.
	* gcc.dg/torture/pr30375.c: New testcase.
	* gcc.dg/torture/pr33560.c: New testcase.
	* gcc.dg/tree-ssa/pr30375.c: Likewise.

From-SVN: r128810
parent 43943e40
2007-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/30375
PR tree-optimization/33560
* tree-ssa-dse.c (get_use_of_stmt_lhs): Give up on uses
with calls.
Revert
2006-05-22 Aldy Hernandez <aldyh@redhat.com>
* tree-ssa-dse.c (aggregate_vardecl_d): New.
(dse_global_data): Add aggregate_vardecl field.
(dse_possible_dead_store_p): New.
Add prev_defvar variable.
Allow immediate uses and previous immediate uses to differ
if they are setting different parts of the whole.
(get_aggregate_vardecl): New.
(dse_record_partial_aggregate_store): New.
(dse_whole_aggregate_clobbered_p): New.
(dse_partial_kill_p): New.
Call dse_maybe_record_aggregate_store().
When checking whether a STMT and its USE_STMT refer to the
same memory address, check also for partial kills that clobber
the whole.
Move some variable definitions to the block where they are used.
(aggregate_vardecl_hash): New.
(aggregate_vardecl_eq): New.
(aggregate_vardecl_free): New.
(aggregate_whole_store_p): New.
(tree_ssa_dse): Initialize and free aggregate_vardecl.
Mark which aggregate stores we care about.
2007-09-25 DJ Delorie <dj@redhat.com> 2007-09-25 DJ Delorie <dj@redhat.com>
PR target/33551 PR target/33551
2007-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/30375
PR tree-optimization/33560
* gcc.dg/tree-ssa/complex-4.c: XFAIL.
* gcc.dg/tree-ssa/complex-5.c: Likewise.
* gcc.dg/tree-ssa/ssa-dse-9.c: Likewise.
* gcc.dg/torture/pr30375.c: New testcase.
* gcc.dg/torture/pr33560.c: New testcase.
* gcc.dg/tree-ssa/pr30375.c: Likewise.
2007-09-25 Simon Martin <simartin@users.sourceforge.net> 2007-09-25 Simon Martin <simartin@users.sourceforge.net>
PR c++/33207 PR c++/33207
/* { dg-do run } */
/* { dg-options "--param max-aliased-vops=0" } */
typedef struct _s {
int a;
int b;
int c;
int d;
} s;
extern void abort(void);
void __attribute__((noinline)) g(s *p)
{
if (p->d != 0)
abort ();
}
char *c = (void*)0;
void __attribute__((noinline)) f(void) { if (c) *c = 1; }
void test_signed_msg_encoding(void)
{
s signInfo = { sizeof(signInfo), 0 };
signInfo.b = 1;
signInfo.c = 0;
g(&signInfo);
signInfo.d = 1;
f();
}
int main()
{
test_signed_msg_encoding ();
test_signed_msg_encoding ();
return 0;
}
/* { dg-do run } */
/* { dg-options "--param max-aliased-vops=0" } */
struct T
{
int a, b;
} t;
__attribute__((noinline)) struct T *f (struct T *p)
{
struct T *q = __builtin_malloc (sizeof (struct T));
*q = *p;
return q;
}
int main (void)
{
struct T *p;
t.a = 1;
t.b = 2;
p = f (&t);
t.a = 3;
if (p->a != 1)
__builtin_abort ();
return 0;
}
...@@ -10,5 +10,5 @@ int f(void) ...@@ -10,5 +10,5 @@ int f(void)
return g(&t); return g(&t);
} }
/* { dg-final { scan-tree-dump-times "__complex__" 0 "optimized" } } */ /* { dg-final { scan-tree-dump-times "__complex__" 0 "optimized" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */
...@@ -8,5 +8,5 @@ int f(void) ...@@ -8,5 +8,5 @@ int f(void)
__imag__ t = 2; __imag__ t = 2;
} }
/* { dg-final { scan-tree-dump-times "__complex__" 0 "optimized" } } */ /* { dg-final { scan-tree-dump-times "__complex__" 0 "optimized" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dse" } */
typedef struct _s {
int a;
int b;
int c;
int d;
} s;
extern void g(s*);
extern void f(void);
void test_signed_msg_encoding(void)
{
s signInfo = { sizeof(signInfo), 0 };
signInfo.b = 1;
signInfo.c = 0;
g(&signInfo);
signInfo.d = 0;
f();
}
/* { dg-final { scan-tree-dump-times "signInfo = {};" 1 "dse1" } } */
/* { dg-final { cleanup-tree-dump "dse*" } } */
...@@ -10,5 +10,5 @@ foo () ...@@ -10,5 +10,5 @@ foo ()
} }
/* We should eliminate the first assignment. */ /* We should eliminate the first assignment. */
/* { dg-final { scan-tree-dump-times "VDEF" 2 "dse1"} } */ /* { dg-final { scan-tree-dump-times "VDEF" 2 "dse1" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "dse1" } } */ /* { dg-final { cleanup-tree-dump "dse1" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment