re PR tree-optimization/48031 (gcc.c-torture/compile/pr42956.c ICEs gcc on m68k-linux, ivopts related?)

2011-03-15  Richard Guenther  <rguenther@suse.de>

	PR middle-end/48031
	* fold-const.c (fold_indirect_ref_1): Do not create new variable-sized
	or variable-indexed array accesses when in gimple form.

From-SVN: r170983
This commit is contained in:
Richard Guenther 2011-03-15 09:49:33 +00:00 committed by Richard Biener
parent 01c77a6055
commit 17dea42fc4
2 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-03-15 Richard Guenther <rguenther@suse.de>
PR middle-end/48031
* fold-const.c (fold_indirect_ref_1): Do not create new variable-sized
or variable-indexed array accesses when in gimple form.
2011-03-15 Richard Guenther <rguenther@suse.de> 2011-03-15 Richard Guenther <rguenther@suse.de>
* config/i386/i386.c (ix86_emit_swdivsf): Implement more * config/i386/i386.c (ix86_emit_swdivsf): Implement more

View File

@ -15562,12 +15562,17 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
} }
/* *(foo *)&fooarray => fooarray[0] */ /* *(foo *)&fooarray => fooarray[0] */
else if (TREE_CODE (optype) == ARRAY_TYPE else if (TREE_CODE (optype) == ARRAY_TYPE
&& type == TREE_TYPE (optype)) && type == TREE_TYPE (optype)
&& (!in_gimple_form
|| TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
{ {
tree type_domain = TYPE_DOMAIN (optype); tree type_domain = TYPE_DOMAIN (optype);
tree min_val = size_zero_node; tree min_val = size_zero_node;
if (type_domain && TYPE_MIN_VALUE (type_domain)) if (type_domain && TYPE_MIN_VALUE (type_domain))
min_val = TYPE_MIN_VALUE (type_domain); min_val = TYPE_MIN_VALUE (type_domain);
if (in_gimple_form
&& TREE_CODE (min_val) != INTEGER_CST)
return NULL_TREE;
return build4_loc (loc, ARRAY_REF, type, op, min_val, return build4_loc (loc, ARRAY_REF, type, op, min_val,
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
} }
@ -15641,7 +15646,9 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
/* *(foo *)fooarrptr => (*fooarrptr)[0] */ /* *(foo *)fooarrptr => (*fooarrptr)[0] */
if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE
&& type == TREE_TYPE (TREE_TYPE (subtype))) && type == TREE_TYPE (TREE_TYPE (subtype))
&& (!in_gimple_form
|| TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
{ {
tree type_domain; tree type_domain;
tree min_val = size_zero_node; tree min_val = size_zero_node;
@ -15649,6 +15656,9 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
type_domain = TYPE_DOMAIN (TREE_TYPE (sub)); type_domain = TYPE_DOMAIN (TREE_TYPE (sub));
if (type_domain && TYPE_MIN_VALUE (type_domain)) if (type_domain && TYPE_MIN_VALUE (type_domain))
min_val = TYPE_MIN_VALUE (type_domain); min_val = TYPE_MIN_VALUE (type_domain);
if (in_gimple_form
&& TREE_CODE (min_val) != INTEGER_CST)
return NULL_TREE;
return build4_loc (loc, ARRAY_REF, type, sub, min_val, NULL_TREE, return build4_loc (loc, ARRAY_REF, type, sub, min_val, NULL_TREE,
NULL_TREE); NULL_TREE);
} }