tree-sra.c: New implementation of SRA.
2009-05-29 Martin Jambor <mjambor@suse.cz> * tree-sra.c: New implementation of SRA. * params.def (PARAM_SRA_MAX_STRUCTURE_SIZE): Removed. (PARAM_SRA_MAX_STRUCTURE_COUNT): Removed. (PARAM_SRA_FIELD_STRUCTURE_RATIO): Removed. * params.h (SRA_MAX_STRUCTURE_SIZE): Removed. (SRA_MAX_STRUCTURE_COUNT): Removed. (SRA_FIELD_STRUCTURE_RATIO): Removed. * doc/invoke.texi (sra-max-structure-size): Removed. (sra-field-structure-ratio): Removed. * testsuite/gfortran.dg/pr25923.f90: XFAIL warning expectation. * testsuite/gcc.dg/tree-ssa/ssa-fre-7.c: Compile with -fno-tree-sra. * testsuite/gcc.dg/tree-ssa/ssa-fre-8.c: Likewise. * testsuite/gcc.dg/tree-ssa/ssa-fre-9.c: Likewise. * testsuite/gcc.dg/memcpy-1.c: Removed param sra-max-structure-size. * testsuite/gcc.dg/tree-ssa/sra-2.c: Likewise. * testsuite/gcc.dg/tree-ssa/sra-3.c: Likewise. * testsuite/gcc.dg/tree-ssa/sra-1.c: Likewise. * testsuite/gcc.dg/tree-ssa/sra-4.c: Changed comment. * testsuite/gcc.dg/tree-ssa/sra-5.c: New file. * testsuite/gcc.dg/tree-ssa/sra-6.c: New file. * testsuite/gcc.c-torture/compile/sra-1.c: New file. From-SVN: r147980
This commit is contained in:
parent
616f21dfde
commit
0674b9d090
@ -1,3 +1,16 @@
|
||||
2009-05-29 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
* tree-sra.c: New implementation of SRA.
|
||||
|
||||
* params.def (PARAM_SRA_MAX_STRUCTURE_SIZE): Removed.
|
||||
(PARAM_SRA_MAX_STRUCTURE_COUNT): Removed.
|
||||
(PARAM_SRA_FIELD_STRUCTURE_RATIO): Removed.
|
||||
* params.h (SRA_MAX_STRUCTURE_SIZE): Removed.
|
||||
(SRA_MAX_STRUCTURE_COUNT): Removed.
|
||||
(SRA_FIELD_STRUCTURE_RATIO): Removed.
|
||||
* doc/invoke.texi (sra-max-structure-size): Removed.
|
||||
(sra-field-structure-ratio): Removed.
|
||||
|
||||
2009-05-29 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/40291
|
||||
|
@ -2769,11 +2769,9 @@ tree-ssa-ccp.o : tree-ssa-ccp.c $(TREE_FLOW_H) $(CONFIG_H) \
|
||||
$(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
|
||||
$(TREE_DUMP_H) $(BASIC_BLOCK_H) $(TREE_PASS_H) langhooks.h \
|
||||
tree-ssa-propagate.h value-prof.h $(FLAGS_H) $(TARGET_H) $(TOPLEV_H)
|
||||
tree-sra.o : tree-sra.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \
|
||||
$(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
|
||||
$(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(GIMPLE_H) \
|
||||
langhooks.h $(TREE_PASS_H) $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) \
|
||||
$(BITMAP_H) $(GGC_H) hard-reg-set.h $(OBSTACK_H) $(PARAMS_H) $(TARGET_H)
|
||||
tree-sra.o : tree-sra.c $(CONFIG_H) $(SYSTEM_H) coretypes.h alloc-pool.h \
|
||||
$(TM_H) $(TREE_H) $(GIMPLE_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_DUMP_H) \
|
||||
$(TIMEVAR_H) $(PARAMS_H) $(TARGET_H) $(FLAGS_H)
|
||||
tree-switch-conversion.o : tree-switch-conversion.c $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
|
||||
$(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(GIMPLE_H) \
|
||||
|
@ -7312,19 +7312,6 @@ In each case, the @var{value} is an integer. The allowable choices for
|
||||
@var{name} are given in the following table:
|
||||
|
||||
@table @gcctabopt
|
||||
@item sra-max-structure-size
|
||||
The maximum structure size, in bytes, at which the scalar replacement
|
||||
of aggregates (SRA) optimization will perform block copies. The
|
||||
default value, 0, implies that GCC will select the most appropriate
|
||||
size itself.
|
||||
|
||||
@item sra-field-structure-ratio
|
||||
The threshold ratio (as a percentage) between instantiated fields and
|
||||
the complete structure size. We say that if the ratio of the number
|
||||
of bytes in instantiated fields to the number of bytes in the complete
|
||||
structure exceeds this parameter, then block copies are not used. The
|
||||
default is 75.
|
||||
|
||||
@item struct-reorg-cold-struct-ratio
|
||||
The threshold ratio (as a percentage) between a structure frequency
|
||||
and the frequency of the hottest structure in the program. This parameter
|
||||
|
@ -38,36 +38,6 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
Be sure to add an entry to invoke.texi summarizing the parameter. */
|
||||
|
||||
/* The maximum structure size at which the scalar replacement of
|
||||
aggregates (SRA) pass will perform block copies. The default
|
||||
value, 0, implies that GCC will select the most appropriate size
|
||||
itself. */
|
||||
DEFPARAM (PARAM_SRA_MAX_STRUCTURE_SIZE,
|
||||
"sra-max-structure-size",
|
||||
"The maximum structure size (in bytes) for which GCC will "
|
||||
"use by-element copies",
|
||||
0, 0, 0)
|
||||
|
||||
/* The maximum number of structure fields which the SRA pass will
|
||||
instantiate to avoid block copies. The default value, 0, implies
|
||||
that GCC will select the appropriate value itself. */
|
||||
DEFPARAM (PARAM_SRA_MAX_STRUCTURE_COUNT,
|
||||
"sra-max-structure-count",
|
||||
"The maximum number of structure fields for which GCC will "
|
||||
"use by-element copies",
|
||||
0, 0, 0)
|
||||
|
||||
/* The ratio between instantiated fields and the complete structure
|
||||
size. We say that if the ratio of the number of bytes in
|
||||
instantiated fields to the number of bytes in the complete
|
||||
structure exceeds this parameter, or if the number of instantiated
|
||||
fields to the total number of fields exceeds this parameter, then
|
||||
block copies are not used. The default is 75%. */
|
||||
DEFPARAM (PARAM_SRA_FIELD_STRUCTURE_RATIO,
|
||||
"sra-field-structure-ratio",
|
||||
"The threshold ratio between instantiated fields and the total structure size",
|
||||
75, 0, 100)
|
||||
|
||||
/* The threshold ratio between current and hottest structure counts.
|
||||
We say that if the ratio of the current structure count,
|
||||
calculated by profiling, to the hottest structure count
|
||||
|
@ -94,12 +94,6 @@ typedef enum compiler_param
|
||||
(compiler_params[(int) ENUM].set)
|
||||
|
||||
/* Macros for the various parameters. */
|
||||
#define SRA_MAX_STRUCTURE_SIZE \
|
||||
PARAM_VALUE (PARAM_SRA_MAX_STRUCTURE_SIZE)
|
||||
#define SRA_MAX_STRUCTURE_COUNT \
|
||||
PARAM_VALUE (PARAM_SRA_MAX_STRUCTURE_COUNT)
|
||||
#define SRA_FIELD_STRUCTURE_RATIO \
|
||||
PARAM_VALUE (PARAM_SRA_FIELD_STRUCTURE_RATIO)
|
||||
#define STRUCT_REORG_COLD_STRUCT_RATIO \
|
||||
PARAM_VALUE (PARAM_STRUCT_REORG_COLD_STRUCT_RATIO)
|
||||
#define MAX_INLINE_INSNS_SINGLE \
|
||||
|
@ -1,3 +1,18 @@
|
||||
2009-05-29 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
* gfortran.dg/pr25923.f90: XFAIL warning expectation.
|
||||
* gcc.dg/tree-ssa/ssa-fre-7.c: Compile with -fno-tree-sra.
|
||||
* gcc.dg/tree-ssa/ssa-fre-8.c: Likewise.
|
||||
* gcc.dg/tree-ssa/ssa-fre-9.c: Likewise.
|
||||
* gcc.dg/memcpy-1.c: Removed param sra-max-structure-size.
|
||||
* gcc.dg/tree-ssa/sra-2.c: Likewise.
|
||||
* gcc.dg/tree-ssa/sra-3.c: Likewise.
|
||||
* gcc.dg/tree-ssa/sra-1.c: Likewise.
|
||||
* gcc.dg/tree-ssa/sra-4.c: Changed comment.
|
||||
* gcc.dg/tree-ssa/sra-5.c: New file.
|
||||
* gcc.dg/tree-ssa/sra-6.c: New file.
|
||||
* gcc.c-torture/compile/sra-1.c: New file.
|
||||
|
||||
2009-05-29 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/40291
|
||||
|
75
gcc/testsuite/gcc.c-torture/compile/sra-1.c
Normal file
75
gcc/testsuite/gcc.c-torture/compile/sra-1.c
Normal file
@ -0,0 +1,75 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1" } */
|
||||
/* Let gimple verifier check what SRA does to unions and single-field
|
||||
strucutres . */
|
||||
|
||||
struct sim_struct
|
||||
{
|
||||
int x;
|
||||
};
|
||||
|
||||
extern struct sim_struct get_x(void);
|
||||
|
||||
struct sim_struct foo (void)
|
||||
{
|
||||
struct sim_struct simple;
|
||||
|
||||
simple = get_x ();
|
||||
if (simple.x % 2)
|
||||
simple.x = 39;
|
||||
else
|
||||
simple.x -=8;
|
||||
|
||||
return simple;
|
||||
}
|
||||
|
||||
struct sim_cmplx
|
||||
{
|
||||
_Complex double c;
|
||||
};
|
||||
|
||||
extern struct sim_cmplx get_sc (void);
|
||||
|
||||
_Complex double foo_c (void)
|
||||
{
|
||||
struct sim_cmplx simple;
|
||||
|
||||
simple = get_sc ();
|
||||
if (__real__ simple.c > 200.3)
|
||||
__imag__ simple.c -= 2.4;
|
||||
|
||||
return simple.c;
|
||||
}
|
||||
|
||||
|
||||
union sim_union
|
||||
{
|
||||
int i;
|
||||
float d;
|
||||
};
|
||||
|
||||
extern union sim_union get_y (void);
|
||||
|
||||
union sim_union bar (void)
|
||||
{
|
||||
union sim_union simple;
|
||||
|
||||
simple = get_y ();
|
||||
if (simple.d > 8.2)
|
||||
simple.i = 300;
|
||||
|
||||
return simple;
|
||||
}
|
||||
|
||||
extern int get_int (void);
|
||||
|
||||
int bar_i (void)
|
||||
{
|
||||
union sim_union simple;
|
||||
|
||||
simple = get_y ();
|
||||
if (simple.d > 8.2)
|
||||
simple.i = get_int ();
|
||||
|
||||
return simple.i;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized --param sra-max-structure-size=32" } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||
/* PR36598 AVR fail maybe due to cost metrics */
|
||||
/* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" { xfail { "avr-*-*" } } } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */
|
||||
/* { dg-options "-O1 -fdump-tree-optimized" } */
|
||||
|
||||
/* Tests for SRA. */
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -fno-tree-fre -fdump-tree-optimized --param sra-max-structure-size=32" } */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -fno-tree-fre -fdump-tree-optimized" } */
|
||||
|
||||
/* Test for SRA. */
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */
|
||||
/* { dg-options "-O1 -fdump-tree-optimized" } */
|
||||
|
||||
/* Test for SRA. */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -fdump-tree-optimized -w" } */
|
||||
/* Check that SRA does non block copies for structs that just contain vectors. */
|
||||
/* Check that SRA replaces strucutres containing vectors. */
|
||||
|
||||
#define vector __attribute__((vector_size(16)))
|
||||
|
||||
@ -20,7 +20,5 @@ vector int f(vector int t1, vector int t2)
|
||||
return st3.t;
|
||||
}
|
||||
|
||||
/* There should be no references to st as SRA should not have done block copy. */
|
||||
/* { dg-final { scan-tree-dump-times "st" 0 "optimized" } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
||||
|
||||
|
74
gcc/testsuite/gcc.dg/tree-ssa/sra-5.c
Normal file
74
gcc/testsuite/gcc.dg/tree-ssa/sra-5.c
Normal file
@ -0,0 +1,74 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -fdump-tree-optimized" } */
|
||||
|
||||
/* Tests for SRA of unions. */
|
||||
|
||||
|
||||
typedef union testunion
|
||||
{
|
||||
double d;
|
||||
char f1;
|
||||
} testunion;
|
||||
|
||||
void
|
||||
copyunion1 (testunion param)
|
||||
{
|
||||
testunion local;
|
||||
param.f1 = 0;
|
||||
local = param;
|
||||
if (local.f1 != 0)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
void
|
||||
copyunion11 (testunion *param)
|
||||
{
|
||||
testunion local;
|
||||
param->f1 = 0;
|
||||
local = *param;
|
||||
if (local.f1 != 0)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
void
|
||||
copyunion111 (testunion param)
|
||||
{
|
||||
testunion *local = ¶m;
|
||||
param.f1 = 0;
|
||||
if (local->f1 != 0)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
testunion globuf;
|
||||
void
|
||||
copyunion1111 (void)
|
||||
{
|
||||
testunion local;
|
||||
globuf.f1 = 0;
|
||||
local = globuf;
|
||||
if (local.f1 != 0)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
void
|
||||
copyunion11111 (void)
|
||||
{
|
||||
testunion *local = &globuf;
|
||||
globuf.f1 = 0;
|
||||
if (local->f1 != 0)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
void
|
||||
copyunion111111 (testunion param)
|
||||
{
|
||||
static testunion local;
|
||||
param.f1 = 0;
|
||||
local = param;
|
||||
if (local.f1 != 0)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
/* There should be no reference to link_error. */
|
||||
/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
40
gcc/testsuite/gcc.dg/tree-ssa/sra-6.c
Normal file
40
gcc/testsuite/gcc.dg/tree-ssa/sra-6.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-esra-details" } */
|
||||
|
||||
typedef struct teststruct
|
||||
{
|
||||
double d;
|
||||
int i1;
|
||||
char c1;
|
||||
float z;
|
||||
char c2;
|
||||
int i2;
|
||||
} teststruct;
|
||||
|
||||
|
||||
void cow (int i)
|
||||
{
|
||||
teststruct a, b, c, d;
|
||||
|
||||
a.d = 3.2;
|
||||
a.i1 = i;
|
||||
|
||||
b = a;
|
||||
c = b;
|
||||
d = c;
|
||||
|
||||
if (d.i1 != i)
|
||||
link_error ();
|
||||
}
|
||||
|
||||
|
||||
/* Suaccesses of b and c should have been created. */
|
||||
/* { dg-final { scan-tree-dump "expr = b.d" "esra"} } */
|
||||
/* { dg-final { scan-tree-dump "expr = b.i1" "esra"} } */
|
||||
/* { dg-final { scan-tree-dump "expr = c.d" "esra"} } */
|
||||
/* { dg-final { scan-tree-dump "expr = c.i1" "esra"} } */
|
||||
/* { dg-final { cleanup-tree-dump "esra" } } */
|
||||
|
||||
/* There should be no reference to link_error. */
|
||||
/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
@ -1,5 +1,5 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fdump-tree-fre-details -fdump-tree-optimized" } */
|
||||
/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details -fdump-tree-optimized" } */
|
||||
#if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
|
||||
typedef int intflt;
|
||||
#elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fdump-tree-fre-details" } */
|
||||
/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details" } */
|
||||
#if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
|
||||
typedef int intflt;
|
||||
#elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fdump-tree-fre-stats" } */
|
||||
/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-stats" } */
|
||||
|
||||
union loc {
|
||||
unsigned reg;
|
||||
|
@ -10,7 +10,7 @@ implicit none
|
||||
|
||||
contains
|
||||
|
||||
function baz(arg) result(res) ! { dg-warning "res.yr' may be" }
|
||||
function baz(arg) result(res) ! { dg-warning "res.yr' may be" "" { xfail *-*-* } }
|
||||
type(bar), intent(in) :: arg
|
||||
type(bar) :: res
|
||||
logical, external:: some_func
|
||||
|
@ -1,5 +1,5 @@
|
||||
-- { dg-do compile }
|
||||
-- { dg-options "-O2 -gnatp -cargs --param sra-max-structure-size=24 --param sra-max-structure-count=6 -fdump-tree-optimized" }
|
||||
-- { dg-options "-O2 -gnatp -cargs -fdump-tree-optimized" }
|
||||
|
||||
package body Pack9 is
|
||||
|
||||
|
5437
gcc/tree-sra.c
5437
gcc/tree-sra.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user