OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* lto-cgraph.c (lto_output_varpool_node): Always output constant pool
[pf3gnuchains/gcc-fork.git]
/
gcc
/
tree-sra.c
diff --git
a/gcc/tree-sra.c
b/gcc/tree-sra.c
index
0a9b3df
..
1bfb5c2
100644
(file)
--- a/
gcc/tree-sra.c
+++ b/
gcc/tree-sra.c
@@
-182,6
+182,10
@@
struct access
access tree. */
unsigned grp_read : 1;
access tree. */
unsigned grp_read : 1;
+ /* Does this group contain a read access that comes from an assignment
+ statement? This flag is propagated down the access tree. */
+ unsigned grp_assignment_read : 1;
+
/* Other passes of the analysis use this bit to make function
analyze_access_subtree create scalar replacements for this group if
possible. */
/* Other passes of the analysis use this bit to make function
analyze_access_subtree create scalar replacements for this group if
possible. */
@@
-1031,9
+1035,13
@@
build_accesses_from_assign (gimple *stmt_ptr,
racc = build_access_from_expr_1 (rhs_ptr, stmt, false);
lacc = build_access_from_expr_1 (lhs_ptr, stmt, true);
racc = build_access_from_expr_1 (rhs_ptr, stmt, false);
lacc = build_access_from_expr_1 (lhs_ptr, stmt, true);
- if (should_scalarize_away_bitmap && !gimple_has_volatile_ops (stmt)
- && racc && !is_gimple_reg_type (racc->type))
- bitmap_set_bit (should_scalarize_away_bitmap, DECL_UID (racc->base));
+ if (racc)
+ {
+ racc->grp_assignment_read = 1;
+ if (should_scalarize_away_bitmap && !gimple_has_volatile_ops (stmt)
+ && !is_gimple_reg_type (racc->type))
+ bitmap_set_bit (should_scalarize_away_bitmap, DECL_UID (racc->base));
+ }
if (lacc && racc
&& (sra_mode == SRA_MODE_EARLY_INTRA || sra_mode == SRA_MODE_INTRA)
if (lacc && racc
&& (sra_mode == SRA_MODE_EARLY_INTRA || sra_mode == SRA_MODE_INTRA)
@@
-1580,6
+1588,7
@@
sort_and_splice_var_accesses (tree var)
struct access *access = VEC_index (access_p, access_vec, i);
bool grp_write = access->write;
bool grp_read = !access->write;
struct access *access = VEC_index (access_p, access_vec, i);
bool grp_write = access->write;
bool grp_read = !access->write;
+ bool grp_assignment_read = access->grp_assignment_read;
bool multiple_reads = false;
bool total_scalarization = access->total_scalarization;
bool grp_partial_lhs = access->grp_partial_lhs;
bool multiple_reads = false;
bool total_scalarization = access->total_scalarization;
bool grp_partial_lhs = access->grp_partial_lhs;
@@
-1613,6
+1622,7
@@
sort_and_splice_var_accesses (tree var)
else
grp_read = true;
}
else
grp_read = true;
}
+ grp_assignment_read |= ac2->grp_assignment_read;
grp_partial_lhs |= ac2->grp_partial_lhs;
unscalarizable_region |= ac2->grp_unscalarizable_region;
total_scalarization |= ac2->total_scalarization;
grp_partial_lhs |= ac2->grp_partial_lhs;
unscalarizable_region |= ac2->grp_unscalarizable_region;
total_scalarization |= ac2->total_scalarization;
@@
-1631,6
+1641,7
@@
sort_and_splice_var_accesses (tree var)
access->group_representative = access;
access->grp_write = grp_write;
access->grp_read = grp_read;
access->group_representative = access;
access->grp_write = grp_write;
access->grp_read = grp_read;
+ access->grp_assignment_read = grp_assignment_read;
access->grp_hint = multiple_reads || total_scalarization;
access->grp_partial_lhs = grp_partial_lhs;
access->grp_unscalarizable_region = unscalarizable_region;
access->grp_hint = multiple_reads || total_scalarization;
access->grp_partial_lhs = grp_partial_lhs;
access->grp_unscalarizable_region = unscalarizable_region;
@@
-1765,14
+1776,17
@@
expr_with_var_bounded_array_refs_p (tree expr)
return false;
}
return false;
}
+enum mark_read_status { SRA_MR_NOT_READ, SRA_MR_READ, SRA_MR_ASSIGN_READ};
+
/* Analyze the subtree of accesses rooted in ROOT, scheduling replacements when
/* Analyze the subtree of accesses rooted in ROOT, scheduling replacements when
- both seeming beneficial and when ALLOW_REPLACEMENTS allows it. Also set
- all sorts of access flags appropriately along the way, notably always ser
- grp_read when MARK_READ is true and grp_write when MARK_WRITE is true. */
+ both seeming beneficial and when ALLOW_REPLACEMENTS allows it. Also set all
+ sorts of access flags appropriately along the way, notably always set
+ grp_read and grp_assign_read according to MARK_READ and grp_write when
+ MARK_WRITE is true. */
static bool
analyze_access_subtree (struct access *root, bool allow_replacements,
static bool
analyze_access_subtree (struct access *root, bool allow_replacements,
-
bool
mark_read, bool mark_write)
+
enum mark_read_status
mark_read, bool mark_write)
{
struct access *child;
HOST_WIDE_INT limit = root->offset + root->size;
{
struct access *child;
HOST_WIDE_INT limit = root->offset + root->size;
@@
-1781,10
+1795,17
@@
analyze_access_subtree (struct access *root, bool allow_replacements,
bool hole = false, sth_created = false;
bool direct_read = root->grp_read;
bool hole = false, sth_created = false;
bool direct_read = root->grp_read;
- if (mark_read)
- root->grp_read = true;
+ if (mark_read == SRA_MR_ASSIGN_READ)
+ {
+ root->grp_read = 1;
+ root->grp_assignment_read = 1;
+ }
+ if (mark_read == SRA_MR_READ)
+ root->grp_read = 1;
+ else if (root->grp_assignment_read)
+ mark_read = SRA_MR_ASSIGN_READ;
else if (root->grp_read)
else if (root->grp_read)
- mark_read =
true
;
+ mark_read =
SRA_MR_READ
;
if (mark_write)
root->grp_write = true;
if (mark_write)
root->grp_write = true;
@@
-1813,7
+1834,7
@@
analyze_access_subtree (struct access *root, bool allow_replacements,
if (allow_replacements && scalar && !root->first_child
&& (root->grp_hint
if (allow_replacements && scalar && !root->first_child
&& (root->grp_hint
- || (
direct_read && root->grp_write
))
+ || (
root->grp_write && (direct_read || root->grp_assignment_read)
))
/* We must not ICE later on when trying to build an access to the
original data within the aggregate even when it is impossible to do in
a defined way like in the PR 42703 testcase. Therefore we check
/* We must not ICE later on when trying to build an access to the
original data within the aggregate even when it is impossible to do in
a defined way like in the PR 42703 testcase. Therefore we check
@@
-1858,7
+1879,7
@@
analyze_access_trees (struct access *access)
while (access)
{
while (access)
{
- if (analyze_access_subtree (access, true,
false
, false))
+ if (analyze_access_subtree (access, true,
SRA_MR_NOT_READ
, false))
ret = true;
access = access->next_grp;
}
ret = true;
access = access->next_grp;
}
@@
-2537,10
+2558,7
@@
replace_uses_with_default_def_ssa_name (tree ssa)
tree repl, decl = SSA_NAME_VAR (ssa);
if (TREE_CODE (decl) == PARM_DECL)
{
tree repl, decl = SSA_NAME_VAR (ssa);
if (TREE_CODE (decl) == PARM_DECL)
{
- tree tmp = create_tmp_var (TREE_TYPE (decl), "SR");
- if (TREE_CODE (TREE_TYPE (tmp)) == COMPLEX_TYPE
- || TREE_CODE (TREE_TYPE (tmp)) == VECTOR_TYPE)
- DECL_GIMPLE_REG_P (tmp) = 1;
+ tree tmp = create_tmp_reg (TREE_TYPE (decl), "SR");
get_var_ann (tmp);
add_referenced_var (tmp);
get_var_ann (tmp);
add_referenced_var (tmp);
@@
-3733,10
+3751,7
@@
get_replaced_param_substitute (struct ipa_parm_adjustment *adj)
{
char *pretty_name = make_fancy_name (adj->base);
{
char *pretty_name = make_fancy_name (adj->base);
- repl = create_tmp_var (TREE_TYPE (adj->base), "ISR");
- if (TREE_CODE (TREE_TYPE (repl)) == COMPLEX_TYPE
- || TREE_CODE (TREE_TYPE (repl)) == VECTOR_TYPE)
- DECL_GIMPLE_REG_P (repl) = 1;
+ repl = create_tmp_reg (TREE_TYPE (adj->base), "ISR");
DECL_NAME (repl) = get_identifier (pretty_name);
obstack_free (&name_obstack, pretty_name);
DECL_NAME (repl) = get_identifier (pretty_name);
obstack_free (&name_obstack, pretty_name);
@@
-4168,6
+4183,9
@@
ipa_sra_preliminary_function_checks (struct cgraph_node *node)
return false;
}
return false;
}
+ if (TYPE_ATTRIBUTES (TREE_TYPE (node->decl)))
+ return false;
+
return true;
}
return true;
}