tree-dfa.c (add_referenced_var): Register initializers of global variables.
2004-07-26 Eric Christopher <echristo@redhat.com> * tree-dfa.c (add_referenced_var): Register initializers of global variables. 2004-07-26 Eric Christopher <echristo@redhat.com> * gcc.c-torture/compile/20040726-2.c: New test. From-SVN: r85214
This commit is contained in:
parent
764c35da02
commit
ff6a32068d
@ -1,5 +1,10 @@
|
|||||||
2004-07-22 Paolo Bonzini <bonzini@gnu.org>
|
2004-07-26 Eric Christopher <echristo@redhat.com>
|
||||||
|
|
||||||
|
* tree-dfa.c (add_referenced_var): Register initializers of global
|
||||||
|
variables.
|
||||||
|
|
||||||
|
2004-07-26 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
|
||||||
* config/i386/i386.c (function_arg): Always treat 8-
|
* config/i386/i386.c (function_arg): Always treat 8-
|
||||||
and 16-byte wide vectors the same, even if MMX/SSE
|
and 16-byte wide vectors the same, even if MMX/SSE
|
||||||
are disabled.
|
are disabled.
|
||||||
@ -23,11 +28,11 @@
|
|||||||
unadjusted_alignment unsigned.
|
unadjusted_alignment unsigned.
|
||||||
(expand_call): Make preferred_stack_boundary and
|
(expand_call): Make preferred_stack_boundary and
|
||||||
preferred_unit_stack_boundary variables unsigned.
|
preferred_unit_stack_boundary variables unsigned.
|
||||||
* function.c (assign_stack_local_1): Make alignment unsigned.
|
* function.c (assign_stack_local_1): Make alignment unsigned.
|
||||||
* function.h (struct function): Make stack_alignment_needed,
|
* function.h (struct function): Make stack_alignment_needed,
|
||||||
preferred_stack_boundary unsigned.
|
preferred_stack_boundary unsigned.
|
||||||
* config/i386/i386.c (ix86_preferred_stack_boundary): Make unsigned.
|
* config/i386/i386.c (ix86_preferred_stack_boundary): Make unsigned.
|
||||||
(ix86_compute_frame_layout): Make stack_alignment_needed,
|
(ix86_compute_frame_layout): Make stack_alignment_needed,
|
||||||
preferred_alignment variables unsigned.
|
preferred_alignment variables unsigned.
|
||||||
* config/i386/i386.h (ix86_preferred_stack_boundary): Make unsigned.
|
* config/i386/i386.h (ix86_preferred_stack_boundary): Make unsigned.
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2004-07-26 Eric Christopher <echristo@redhat.com>
|
||||||
|
|
||||||
|
* gcc.c-torture/compile/20040726-2.c: New test.
|
||||||
|
|
||||||
2004-07-26 Andrew Pinski <apinski@apple.com>
|
2004-07-26 Andrew Pinski <apinski@apple.com>
|
||||||
|
|
||||||
* g++.dg/rtti/tinfo1.C: Xfail.
|
* g++.dg/rtti/tinfo1.C: Xfail.
|
||||||
|
22
gcc/testsuite/gcc.c-torture/compile/20040726-2.c
Normal file
22
gcc/testsuite/gcc.c-torture/compile/20040726-2.c
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/* { dg-do compile } */
|
||||||
|
/* From a failure after the global ccp pass. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char n[129];
|
||||||
|
} A;
|
||||||
|
|
||||||
|
const A C = {
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const A *const B;
|
||||||
|
|
||||||
|
void bar(const char *);
|
||||||
|
|
||||||
|
void foo ()
|
||||||
|
{
|
||||||
|
bar (B->n);
|
||||||
|
}
|
||||||
|
|
||||||
|
const A *const B = &C;
|
@ -139,8 +139,8 @@ struct tree_opt_pass pass_referenced_vars =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Compute immediate uses.
|
/* Compute immediate uses.
|
||||||
|
|
||||||
CALC_FOR is an optional function pointer which indicates whether
|
CALC_FOR is an optional function pointer which indicates whether
|
||||||
immediate uses information should be calculated for a given SSA
|
immediate uses information should be calculated for a given SSA
|
||||||
variable. If NULL, then information is computed for all
|
variable. If NULL, then information is computed for all
|
||||||
@ -253,7 +253,7 @@ compute_immediate_uses_for_phi (tree phi, bool (*calc_for)(tree))
|
|||||||
tree arg = PHI_ARG_DEF (phi, i);
|
tree arg = PHI_ARG_DEF (phi, i);
|
||||||
|
|
||||||
if (TREE_CODE (arg) == SSA_NAME && (!calc_for || calc_for (arg)))
|
if (TREE_CODE (arg) == SSA_NAME && (!calc_for || calc_for (arg)))
|
||||||
{
|
{
|
||||||
tree imm_rdef_stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF (phi, i));
|
tree imm_rdef_stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF (phi, i));
|
||||||
if (!IS_EMPTY_STMT (imm_rdef_stmt))
|
if (!IS_EMPTY_STMT (imm_rdef_stmt))
|
||||||
add_immediate_use (imm_rdef_stmt, phi);
|
add_immediate_use (imm_rdef_stmt, phi);
|
||||||
@ -351,7 +351,7 @@ add_immediate_use (tree stmt, tree use_stmt)
|
|||||||
|
|
||||||
|
|
||||||
/* If the immediate use of USE points to OLD, then redirect it to NEW. */
|
/* If the immediate use of USE points to OLD, then redirect it to NEW. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
redirect_immediate_use (tree use, tree old, tree new)
|
redirect_immediate_use (tree use, tree old, tree new)
|
||||||
{
|
{
|
||||||
@ -388,7 +388,7 @@ redirect_immediate_uses (tree old, tree new)
|
|||||||
|
|
||||||
/* Look at USE_OPS or VUSE_OPS according to FLAGS. */
|
/* Look at USE_OPS or VUSE_OPS according to FLAGS. */
|
||||||
for (i = 0; i < NUM_USES (uses); i++)
|
for (i = 0; i < NUM_USES (uses); i++)
|
||||||
redirect_immediate_use (USE_OP (uses, i), old, new);
|
redirect_immediate_use (USE_OP (uses, i), old, new);
|
||||||
|
|
||||||
for (i = 0; i < NUM_VUSES (vuses); i++)
|
for (i = 0; i < NUM_VUSES (vuses); i++)
|
||||||
redirect_immediate_use (VUSE_OP (vuses, i), old, new);
|
redirect_immediate_use (VUSE_OP (vuses, i), old, new);
|
||||||
@ -505,7 +505,7 @@ dump_referenced_vars (FILE *file)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
fprintf (file, "\nReferenced variables in %s: %u\n\n",
|
fprintf (file, "\nReferenced variables in %s: %u\n\n",
|
||||||
get_name (current_function_decl), (unsigned) num_referenced_vars);
|
get_name (current_function_decl), (unsigned) num_referenced_vars);
|
||||||
|
|
||||||
for (i = 0; i < num_referenced_vars; i++)
|
for (i = 0; i < num_referenced_vars; i++)
|
||||||
@ -533,7 +533,7 @@ void
|
|||||||
dump_variable (FILE *file, tree var)
|
dump_variable (FILE *file, tree var)
|
||||||
{
|
{
|
||||||
var_ann_t ann;
|
var_ann_t ann;
|
||||||
|
|
||||||
if (TREE_CODE (var) == SSA_NAME)
|
if (TREE_CODE (var) == SSA_NAME)
|
||||||
{
|
{
|
||||||
if (POINTER_TYPE_P (TREE_TYPE (var)))
|
if (POINTER_TYPE_P (TREE_TYPE (var)))
|
||||||
@ -691,7 +691,7 @@ dump_dfa_stats (FILE *file)
|
|||||||
|
|
||||||
size = num_referenced_vars * sizeof (tree);
|
size = num_referenced_vars * sizeof (tree);
|
||||||
total += size;
|
total += size;
|
||||||
fprintf (file, fmt_str_1, "Referenced variables", num_referenced_vars,
|
fprintf (file, fmt_str_1, "Referenced variables", num_referenced_vars,
|
||||||
SCALE (size), LABEL (size));
|
SCALE (size), LABEL (size));
|
||||||
|
|
||||||
size = dfa_stats.num_stmt_anns * sizeof (struct stmt_ann_d);
|
size = dfa_stats.num_stmt_anns * sizeof (struct stmt_ann_d);
|
||||||
@ -723,7 +723,7 @@ dump_dfa_stats (FILE *file)
|
|||||||
total += size;
|
total += size;
|
||||||
fprintf (file, fmt_str_1, "V_MAY_DEF operands", dfa_stats.num_v_may_defs,
|
fprintf (file, fmt_str_1, "V_MAY_DEF operands", dfa_stats.num_v_may_defs,
|
||||||
SCALE (size), LABEL (size));
|
SCALE (size), LABEL (size));
|
||||||
|
|
||||||
size = dfa_stats.num_v_must_defs * sizeof (tree *);
|
size = dfa_stats.num_v_must_defs * sizeof (tree *);
|
||||||
total += size;
|
total += size;
|
||||||
fprintf (file, fmt_str_1, "V_MUST_DEF operands", dfa_stats.num_v_must_defs,
|
fprintf (file, fmt_str_1, "V_MUST_DEF operands", dfa_stats.num_v_must_defs,
|
||||||
@ -822,10 +822,10 @@ collect_dfa_stats_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
|
|||||||
dfa_stats_p->num_stmt_anns++;
|
dfa_stats_p->num_stmt_anns++;
|
||||||
dfa_stats_p->num_defs += NUM_DEFS (DEF_OPS (ann));
|
dfa_stats_p->num_defs += NUM_DEFS (DEF_OPS (ann));
|
||||||
dfa_stats_p->num_uses += NUM_USES (USE_OPS (ann));
|
dfa_stats_p->num_uses += NUM_USES (USE_OPS (ann));
|
||||||
dfa_stats_p->num_v_may_defs +=
|
dfa_stats_p->num_v_may_defs +=
|
||||||
NUM_V_MAY_DEFS (V_MAY_DEF_OPS (ann));
|
NUM_V_MAY_DEFS (V_MAY_DEF_OPS (ann));
|
||||||
dfa_stats_p->num_vuses += NUM_VUSES (VUSE_OPS (ann));
|
dfa_stats_p->num_vuses += NUM_VUSES (VUSE_OPS (ann));
|
||||||
dfa_stats_p->num_v_must_defs +=
|
dfa_stats_p->num_v_must_defs +=
|
||||||
NUM_V_MUST_DEFS (V_MUST_DEF_OPS (ann));
|
NUM_V_MUST_DEFS (V_MUST_DEF_OPS (ann));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -903,6 +903,14 @@ add_referenced_var (tree var, struct walk_state *walk_state)
|
|||||||
/* Global and static variables are call-clobbered, always. */
|
/* Global and static variables are call-clobbered, always. */
|
||||||
if (needs_to_live_in_memory (var))
|
if (needs_to_live_in_memory (var))
|
||||||
mark_call_clobbered (var);
|
mark_call_clobbered (var);
|
||||||
|
|
||||||
|
/* If an initialized global variable then register the initializer
|
||||||
|
as well. */
|
||||||
|
if (POINTER_TYPE_P (TREE_TYPE (var))
|
||||||
|
&& TREE_READONLY (var)
|
||||||
|
&& DECL_INITIAL (var)
|
||||||
|
&& TREE_CODE (DECL_INITIAL (var)) == ADDR_EXPR)
|
||||||
|
walk_tree (&DECL_INITIAL (var), find_vars_r, walk_state, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,7 +928,7 @@ get_virtual_var (tree var)
|
|||||||
while (TREE_CODE (var) == REALPART_EXPR || TREE_CODE (var) == IMAGPART_EXPR
|
while (TREE_CODE (var) == REALPART_EXPR || TREE_CODE (var) == IMAGPART_EXPR
|
||||||
|| handled_component_p (var))
|
|| handled_component_p (var))
|
||||||
var = TREE_OPERAND (var, 0);
|
var = TREE_OPERAND (var, 0);
|
||||||
|
|
||||||
#ifdef ENABLE_CHECKING
|
#ifdef ENABLE_CHECKING
|
||||||
/* Treating GIMPLE registers as virtual variables makes no sense.
|
/* Treating GIMPLE registers as virtual variables makes no sense.
|
||||||
Also complain if we couldn't extract a _DECL out of the original
|
Also complain if we couldn't extract a _DECL out of the original
|
||||||
@ -945,42 +953,42 @@ add_referenced_tmp_var (tree var)
|
|||||||
add_referenced_var (var, NULL);
|
add_referenced_var (var, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if V_MAY_DEFS_AFTER contains fewer entries than
|
/* Return true if V_MAY_DEFS_AFTER contains fewer entries than
|
||||||
V_MAY_DEFS_BEFORE. Note that this assumes that both varrays
|
V_MAY_DEFS_BEFORE. Note that this assumes that both varrays
|
||||||
are V_MAY_DEF operands for the same statement. */
|
are V_MAY_DEF operands for the same statement. */
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
v_may_defs_disappeared_p (v_may_def_optype v_may_defs_before,
|
v_may_defs_disappeared_p (v_may_def_optype v_may_defs_before,
|
||||||
v_may_def_optype v_may_defs_after)
|
v_may_def_optype v_may_defs_after)
|
||||||
{
|
{
|
||||||
/* If there was nothing before, nothing could've disappeared. */
|
/* If there was nothing before, nothing could've disappeared. */
|
||||||
if (v_may_defs_before == NULL)
|
if (v_may_defs_before == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* All/some of them gone. */
|
/* All/some of them gone. */
|
||||||
if (v_may_defs_after == NULL
|
if (v_may_defs_after == NULL
|
||||||
|| NUM_V_MAY_DEFS (v_may_defs_before) >
|
|| NUM_V_MAY_DEFS (v_may_defs_before) >
|
||||||
NUM_V_MAY_DEFS (v_may_defs_after))
|
NUM_V_MAY_DEFS (v_may_defs_after))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if V_MUST_DEFS_AFTER contains fewer entries than
|
/* Return true if V_MUST_DEFS_AFTER contains fewer entries than
|
||||||
V_MUST_DEFS_BEFORE. Note that this assumes that both varrays
|
V_MUST_DEFS_BEFORE. Note that this assumes that both varrays
|
||||||
are V_MUST_DEF operands for the same statement. */
|
are V_MUST_DEF operands for the same statement. */
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
v_must_defs_disappeared_p (v_must_def_optype v_must_defs_before,
|
v_must_defs_disappeared_p (v_must_def_optype v_must_defs_before,
|
||||||
v_must_def_optype v_must_defs_after)
|
v_must_def_optype v_must_defs_after)
|
||||||
{
|
{
|
||||||
/* If there was nothing before, nothing could've disappeared. */
|
/* If there was nothing before, nothing could've disappeared. */
|
||||||
if (v_must_defs_before == NULL)
|
if (v_must_defs_before == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* All/some of them gone. */
|
/* All/some of them gone. */
|
||||||
if (v_must_defs_after == NULL
|
if (v_must_defs_after == NULL
|
||||||
|| NUM_V_MUST_DEFS (v_must_defs_before) >
|
|| NUM_V_MUST_DEFS (v_must_defs_before) >
|
||||||
NUM_V_MUST_DEFS (v_must_defs_after))
|
NUM_V_MUST_DEFS (v_must_defs_after))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -1093,7 +1101,7 @@ mark_new_vars_to_rename (tree stmt, bitmap vars_to_rename)
|
|||||||
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
|
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v_must_defs_after = v_must_defs = V_MUST_DEF_OPS (ann);
|
v_must_defs_after = v_must_defs = V_MUST_DEF_OPS (ann);
|
||||||
for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
|
for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
|
||||||
{
|
{
|
||||||
@ -1103,7 +1111,7 @@ mark_new_vars_to_rename (tree stmt, bitmap vars_to_rename)
|
|||||||
found_exposed_symbol = true;
|
found_exposed_symbol = true;
|
||||||
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
|
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we found any newly exposed symbols, or if there are fewer VDEF
|
/* If we found any newly exposed symbols, or if there are fewer VDEF
|
||||||
operands in the statement, add the variables we had set in
|
operands in the statement, add the variables we had set in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user