* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203107
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
/* 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);
\f
/* Produce a pointer to the IDX'th candidate in the candidate vector. */
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);
+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
--- /dev/null
+/* 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;
+}
+