gimple-ssa-strength-reduction.c (legal_cast_p_1): Forward declaration.

gcc/

	* gimple-ssa-strength-reduction.c (legal_cast_p_1): Forward
	declaration.
	(backtrace_base_for_ref): Call get_unwidened with 'base_in' if
	'base_in' represent a conversion and legal_cast_p_1 holds; set
	'base_in' with the returned value from get_unwidened.

gcc/testsuite/

	* gcc.dg/tree-ssa/slsr-40.c: New test.

From-SVN: r203107
This commit is contained in:
Yufeng Zhang 2013-10-02 10:21:33 +00:00
parent ebfcd719cf
commit 0916f87607
4 changed files with 49 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2013-10-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Yufeng Zhang <yufeng.zhang@arm.com>
* gimple-ssa-strength-reduction.c (legal_cast_p_1): Forward
declaration.
(backtrace_base_for_ref): Call get_unwidened with 'base_in' if
'base_in' represent a conversion and legal_cast_p_1 holds; set
'base_in' with the returned value from get_unwidened.
2013-10-02 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/arm.c (arm_legitimize_reload_address): Explain why

View File

@ -379,6 +379,7 @@ static bool address_arithmetic_p;
/* Forward function declarations. */
static slsr_cand_t base_cand_from_table (tree);
static tree introduce_cast_before_cand (slsr_cand_t, tree, tree);
static bool legal_cast_p_1 (tree, tree);
/* Produce a pointer to the IDX'th candidate in the candidate vector. */
@ -768,6 +769,14 @@ backtrace_base_for_ref (tree *pbase)
slsr_cand_t base_cand;
STRIP_NOPS (base_in);
/* Strip off widening conversion(s) to handle cases where
e.g. 'B' is widened from an 'int' in order to calculate
a 64-bit address. */
if (CONVERT_EXPR_P (base_in)
&& legal_cast_p_1 (base_in, TREE_OPERAND (base_in, 0)))
base_in = get_unwidened (base_in, NULL_TREE);
if (TREE_CODE (base_in) != SSA_NAME)
return tree_to_double_int (integer_zero_node);

View File

@ -1,3 +1,7 @@
2013-10-02 Yufeng Zhang <yufeng.zhang@arm.com>
* gcc.dg/tree-ssa/slsr-40.c: New test.
2013-10-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58563

View File

@ -0,0 +1,27 @@
/* Verify straight-line strength reduction for array
subscripting.
elems[n-1] is reduced to elems + n * 4 + 0xffffffff * 4, only when
pointers are of the same size as that of int (assuming 4 bytes). */
/* { dg-do run } */
/* { dg-options "-O2" } */
struct data
{
unsigned long elms[1];
} gData;
void __attribute__((noinline))
foo (struct data *dst, unsigned int n)
{
dst->elms[n - 1] &= 1;
}
int
main ()
{
foo (&gData, 1);
return 0;
}