&& DR_OFFSET (newdr)
&& DR_INIT (newdr)
&& DR_STEP (newdr)
+ && TREE_CODE (DR_INIT (newdr)) == INTEGER_CST
&& integer_zerop (DR_STEP (newdr)))
{
+ tree base_address = DR_BASE_ADDRESS (newdr);
tree off = DR_OFFSET (newdr);
tree step = ssize_int (1);
+ if (integer_zerop (off)
+ && TREE_CODE (base_address) == POINTER_PLUS_EXPR)
+ {
+ off = TREE_OPERAND (base_address, 1);
+ base_address = TREE_OPERAND (base_address, 0);
+ }
STRIP_NOPS (off);
if (TREE_CODE (off) == MULT_EXPR
&& tree_fits_uhwi_p (TREE_OPERAND (off, 1)))
off = TREE_OPERAND (off, 0);
STRIP_NOPS (off);
}
- if (TREE_CODE (DR_INIT (newdr)) == INTEGER_CST)
+ if (CONVERT_EXPR_P (off)
+ && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (off, 0)))
+ < TYPE_PRECISION (TREE_TYPE (off))))
+ off = TREE_OPERAND (off, 0);
+ if (TREE_CODE (off) == SSA_NAME)
{
- if (CONVERT_EXPR_P (off)
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (off, 0)))
- < TYPE_PRECISION (TREE_TYPE (off))))
- off = TREE_OPERAND (off, 0);
- if (TREE_CODE (off) == SSA_NAME)
+ gimple *def = SSA_NAME_DEF_STMT (off);
+ /* Look through widening conversion. */
+ if (is_gimple_assign (def)
+ && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def)))
+ {
+ tree rhs1 = gimple_assign_rhs1 (def);
+ if (TREE_CODE (rhs1) == SSA_NAME
+ && INTEGRAL_TYPE_P (TREE_TYPE (rhs1))
+ && (TYPE_PRECISION (TREE_TYPE (off))
+ > TYPE_PRECISION (TREE_TYPE (rhs1))))
+ def = SSA_NAME_DEF_STMT (rhs1);
+ }
+ if (is_gimple_call (def)
+ && gimple_call_internal_p (def)
+ && (gimple_call_internal_fn (def) == IFN_GOMP_SIMD_LANE))
{
- gimple *def = SSA_NAME_DEF_STMT (off);
+ tree arg = gimple_call_arg (def, 0);
tree reft = TREE_TYPE (DR_REF (newdr));
- if (is_gimple_call (def)
- && gimple_call_internal_p (def)
- && (gimple_call_internal_fn (def) == IFN_GOMP_SIMD_LANE))
+ gcc_assert (TREE_CODE (arg) == SSA_NAME);
+ arg = SSA_NAME_VAR (arg);
+ if (arg == loop->simduid
+ /* For now. */
+ && tree_int_cst_equal (TYPE_SIZE_UNIT (reft), step))
{
- tree arg = gimple_call_arg (def, 0);
- gcc_assert (TREE_CODE (arg) == SSA_NAME);
- arg = SSA_NAME_VAR (arg);
- if (arg == loop->simduid
- /* For now. */
- && tree_int_cst_equal (TYPE_SIZE_UNIT (reft), step))
- {
- DR_OFFSET (newdr) = ssize_int (0);
- DR_STEP (newdr) = step;
- DR_OFFSET_ALIGNMENT (newdr) = BIGGEST_ALIGNMENT;
- DR_STEP_ALIGNMENT (newdr)
- = highest_pow2_factor (step);
- /* Mark as simd-lane access. */
- tree arg2 = gimple_call_arg (def, 1);
- newdr->aux = (void *) (-1 - tree_to_uhwi (arg2));
- free_data_ref (dr);
- datarefs->safe_push (newdr);
- return opt_result::success ();
- }
+ DR_BASE_ADDRESS (newdr) = base_address;
+ DR_OFFSET (newdr) = ssize_int (0);
+ DR_STEP (newdr) = step;
+ DR_OFFSET_ALIGNMENT (newdr) = BIGGEST_ALIGNMENT;
+ DR_STEP_ALIGNMENT (newdr) = highest_pow2_factor (step);
+ /* Mark as simd-lane access. */
+ tree arg2 = gimple_call_arg (def, 1);
+ newdr->aux = (void *) (-1 - tree_to_uhwi (arg2));
+ free_data_ref (dr);
+ datarefs->safe_push (newdr);
+ return opt_result::success ();
}
}
}