Commit 089dacc5 by Jakub Jelinek Committed by Jakub Jelinek

re PR rtl-optimization/51978 (ext-elim-1.c ICE on powerpc64)

	PR rtl-optimization/51978
	* ree.c (make_defs_and_copies_lists): Change set_pat type
	to const_rtx.
	(combine_reaching_defs): Likewise.
	(struct re_info): Remove.
	(add_removable_extension): Remove x and data arguments,
	add insn, insn_list and def_map.  Use the arguments directly
	instead of using struct re_info.
	(find_removable_extensions): Don't call add_removable_extension
	through note_stores, instead just call it with single_set
	result if non-NULL.
	(find_and_remove_re): Pass curr_cand->expr instead of
	PATTERN (curr_cand->insn) as set_pat argument to
	combine_reaching_defs.

From-SVN: r183567
parent 81bfd197
2012-01-26 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/51978
* ree.c (make_defs_and_copies_lists): Change set_pat type
to const_rtx.
(combine_reaching_defs): Likewise.
(struct re_info): Remove.
(add_removable_extension): Remove x and data arguments,
add insn, insn_list and def_map. Use the arguments directly
instead of using struct re_info.
(find_removable_extensions): Don't call add_removable_extension
through note_stores, instead just call it with single_set
result if non-NULL.
(find_and_remove_re): Pass curr_cand->expr instead of
PATTERN (curr_cand->insn) as set_pat argument to
combine_reaching_defs.
2012-01-26 Michael Matz <matz@suse.de> 2012-01-26 Michael Matz <matz@suse.de>
PR tree-optimization/46590 PR tree-optimization/46590
......
...@@ -523,7 +523,7 @@ typedef struct ext_state ...@@ -523,7 +523,7 @@ typedef struct ext_state
success. */ success. */
static bool static bool
make_defs_and_copies_lists (rtx extend_insn, rtx set_pat, make_defs_and_copies_lists (rtx extend_insn, const_rtx set_pat,
ext_state *state) ext_state *state)
{ {
rtx src_reg = XEXP (SET_SRC (set_pat), 0); rtx src_reg = XEXP (SET_SRC (set_pat), 0);
...@@ -651,7 +651,7 @@ merge_def_and_ext (ext_cand *cand, rtx def_insn, ext_state *state) ...@@ -651,7 +651,7 @@ merge_def_and_ext (ext_cand *cand, rtx def_insn, ext_state *state)
and false upon failure. */ and false upon failure. */
static bool static bool
combine_reaching_defs (ext_cand *cand, rtx set_pat, ext_state *state) combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state)
{ {
rtx def_insn; rtx def_insn;
bool merge_successful = true; bool merge_successful = true;
...@@ -742,27 +742,13 @@ combine_reaching_defs (ext_cand *cand, rtx set_pat, ext_state *state) ...@@ -742,27 +742,13 @@ combine_reaching_defs (ext_cand *cand, rtx set_pat, ext_state *state)
return false; return false;
} }
/* This structure holds information while walking the RTL stream. */ /* Add an extension pattern that could be eliminated. */
struct re_info
{
/* The current insn. */
rtx insn;
/* The list of candidates. */
VEC (ext_cand, heap) *insn_list;
/* The map of definition instructions to candidates. */
ext_cand **def_map;
};
/* Add an extension pattern that could be eliminated. This is called via
note_stores from find_removable_extensions. */
static void static void
add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data) add_removable_extension (const_rtx expr, rtx insn,
VEC (ext_cand, heap) **insn_list,
ext_cand **def_map)
{ {
struct re_info *rei = (struct re_info *)data;
enum rtx_code code; enum rtx_code code;
enum machine_mode mode; enum machine_mode mode;
rtx src, dest; rtx src, dest;
...@@ -785,13 +771,13 @@ add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data) ...@@ -785,13 +771,13 @@ add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data)
ext_cand *cand; ext_cand *cand;
/* First, make sure we can get all the reaching definitions. */ /* First, make sure we can get all the reaching definitions. */
defs = get_defs (rei->insn, XEXP (src, 0), NULL); defs = get_defs (insn, XEXP (src, 0), NULL);
if (!defs) if (!defs)
{ {
if (dump_file) if (dump_file)
{ {
fprintf (dump_file, "Cannot eliminate extension:\n"); fprintf (dump_file, "Cannot eliminate extension:\n");
print_rtl_single (dump_file, rei->insn); print_rtl_single (dump_file, insn);
fprintf (dump_file, " because of missing definition(s)\n"); fprintf (dump_file, " because of missing definition(s)\n");
} }
return; return;
...@@ -800,13 +786,13 @@ add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data) ...@@ -800,13 +786,13 @@ add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data)
/* Second, make sure the reaching definitions don't feed another and /* Second, make sure the reaching definitions don't feed another and
different extension. FIXME: this obviously can be improved. */ different extension. FIXME: this obviously can be improved. */
for (def = defs; def; def = def->next) for (def = defs; def; def = def->next)
if ((cand = rei->def_map[INSN_UID(DF_REF_INSN (def->ref))]) if ((cand = def_map[INSN_UID(DF_REF_INSN (def->ref))])
&& (cand->code != code || cand->mode != mode)) && (cand->code != code || cand->mode != mode))
{ {
if (dump_file) if (dump_file)
{ {
fprintf (dump_file, "Cannot eliminate extension:\n"); fprintf (dump_file, "Cannot eliminate extension:\n");
print_rtl_single (dump_file, rei->insn); print_rtl_single (dump_file, insn);
fprintf (dump_file, " because of other extension\n"); fprintf (dump_file, " because of other extension\n");
} }
return; return;
...@@ -814,14 +800,14 @@ add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data) ...@@ -814,14 +800,14 @@ add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data)
/* Then add the candidate to the list and insert the reaching definitions /* Then add the candidate to the list and insert the reaching definitions
into the definition map. */ into the definition map. */
cand = VEC_safe_push (ext_cand, heap, rei->insn_list, NULL); cand = VEC_safe_push (ext_cand, heap, *insn_list, NULL);
cand->expr = expr; cand->expr = expr;
cand->code = code; cand->code = code;
cand->mode = mode; cand->mode = mode;
cand->insn = rei->insn; cand->insn = insn;
for (def = defs; def; def = def->next) for (def = defs; def; def = def->next)
rei->def_map[INSN_UID(DF_REF_INSN (def->ref))] = cand; def_map[INSN_UID(DF_REF_INSN (def->ref))] = cand;
} }
} }
...@@ -831,12 +817,10 @@ add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data) ...@@ -831,12 +817,10 @@ add_removable_extension (rtx x ATTRIBUTE_UNUSED, const_rtx expr, void *data)
static VEC (ext_cand, heap)* static VEC (ext_cand, heap)*
find_removable_extensions (void) find_removable_extensions (void)
{ {
struct re_info rei; VEC (ext_cand, heap) *insn_list = NULL;
basic_block bb; basic_block bb;
rtx insn; rtx insn, set;
ext_cand **def_map = XCNEWVEC (ext_cand *, max_insn_uid);
rei.insn_list = VEC_alloc (ext_cand, heap, 8);
rei.def_map = XCNEWVEC (ext_cand *, max_insn_uid);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
FOR_BB_INSNS (bb, insn) FOR_BB_INSNS (bb, insn)
...@@ -844,13 +828,15 @@ find_removable_extensions (void) ...@@ -844,13 +828,15 @@ find_removable_extensions (void)
if (!NONDEBUG_INSN_P (insn)) if (!NONDEBUG_INSN_P (insn))
continue; continue;
rei.insn = insn; set = single_set (insn);
note_stores (PATTERN (insn), add_removable_extension, &rei); if (set == NULL_RTX)
continue;
add_removable_extension (set, insn, &insn_list, def_map);
} }
XDELETEVEC (rei.def_map); XDELETEVEC (def_map);
return rei.insn_list; return insn_list;
} }
/* This is the main function that checks the insn stream for redundant /* This is the main function that checks the insn stream for redundant
...@@ -895,7 +881,7 @@ find_and_remove_re (void) ...@@ -895,7 +881,7 @@ find_and_remove_re (void)
print_rtl_single (dump_file, curr_cand->insn); print_rtl_single (dump_file, curr_cand->insn);
} }
if (combine_reaching_defs (curr_cand, PATTERN (curr_cand->insn), &state)) if (combine_reaching_defs (curr_cand, curr_cand->expr, &state))
{ {
if (dump_file) if (dump_file)
fprintf (dump_file, "Eliminated the extension.\n"); fprintf (dump_file, "Eliminated the extension.\n");
......
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