re PR rtl-optimization/42617 (TARGET_MEM_REF and plain INDIRECT_REFs are not handled by the RTL oracle)

2010-04-07  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42617
	* emit-rtl.c (set_mem_attributes_minus_bitpos): Do not
	discard plain indirect references.
	* fold-const.c (operand_equal_p): Guard against NULL_TREE
	type.
	* tree.c (tree_nop_conversion): Likewise.

From-SVN: r158045
This commit is contained in:
Richard Guenther 2010-04-07 10:13:25 +00:00 committed by Richard Biener
parent a42f121709
commit 56c47f2271
4 changed files with 36 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2010-04-07 Richard Guenther <rguenther@suse.de>
PR middle-end/42617
* emit-rtl.c (set_mem_attributes_minus_bitpos): Do not
discard plain indirect references.
* fold-const.c (operand_equal_p): Guard against NULL_TREE
type.
* tree.c (tree_nop_conversion): Likewise.
2010-04-07 Dodji Seketeli <dodji@redhat.com> 2010-04-07 Dodji Seketeli <dodji@redhat.com>
PR debug/43628 PR debug/43628

View File

@ -1750,6 +1750,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
/* ??? Any reason the field size would be different than /* ??? Any reason the field size would be different than
the size we got from the type? */ the size we got from the type? */
} }
else if (flag_argument_noalias > 1 else if (flag_argument_noalias > 1
&& (INDIRECT_REF_P (t2)) && (INDIRECT_REF_P (t2))
&& TREE_CODE (TREE_OPERAND (t2, 0)) == PARM_DECL) && TREE_CODE (TREE_OPERAND (t2, 0)) == PARM_DECL)
@ -1757,6 +1758,15 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
expr = t2; expr = t2;
offset = NULL; offset = NULL;
} }
/* If this is an indirect reference, record it. */
else if (TREE_CODE (t) == INDIRECT_REF
|| TREE_CODE (t) == MISALIGNED_INDIRECT_REF)
{
expr = t;
offset = const0_rtx;
apply_bitpos = bitpos;
}
} }
/* If this is a Fortran indirect argument reference, record the /* If this is a Fortran indirect argument reference, record the
@ -1769,6 +1779,15 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
offset = NULL; offset = NULL;
} }
/* If this is an indirect reference, record it. */
else if (TREE_CODE (t) == INDIRECT_REF
|| TREE_CODE (t) == MISALIGNED_INDIRECT_REF)
{
expr = t;
offset = const0_rtx;
apply_bitpos = bitpos;
}
if (!align_computed && !INDIRECT_REF_P (t)) if (!align_computed && !INDIRECT_REF_P (t))
{ {
unsigned int obj_align unsigned int obj_align

View File

@ -3170,6 +3170,11 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
|| TREE_TYPE (arg1) == error_mark_node) || TREE_TYPE (arg1) == error_mark_node)
return 0; return 0;
/* Similar, if either does not have a type (like a released SSA name),
they aren't equal. */
if (!TREE_TYPE (arg0) || !TREE_TYPE (arg1))
return 0;
/* Check equality of integer constants before bailing out due to /* Check equality of integer constants before bailing out due to
precision differences. */ precision differences. */
if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST) if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)

View File

@ -10645,6 +10645,9 @@ tree_nop_conversion (const_tree exp)
outer_type = TREE_TYPE (exp); outer_type = TREE_TYPE (exp);
inner_type = TREE_TYPE (TREE_OPERAND (exp, 0)); inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
if (!inner_type)
return false;
/* Use precision rather then machine mode when we can, which gives /* Use precision rather then machine mode when we can, which gives
the correct answer even for submode (bit-field) types. */ the correct answer even for submode (bit-field) types. */
if ((INTEGRAL_TYPE_P (outer_type) if ((INTEGRAL_TYPE_P (outer_type)