When create_mem_ref falls back to a (void *)0 base address we
currently only fall back to LEA plus indirection when the target
can use a second index register. But we also need to do this
if there's a scaled by one index. Or rather always to be safe.
* tree-ssa-loop-ivopts.cc (rewrite_use_address): Always
avoid TARGET_MEM_REF with a base of zero.
* tree-ssa-sccvn.cc (vn_reference_maybe_forwprop_address): Do
not forward TARGET_MEM_REF addresses.
else
{
/* When we end up confused enough and have no suitable base but
- stuffed everything to index2 use a LEA for the address and
+ stuffed everything to indexes use a LEA for the address and
create a plain MEM_REF to avoid basing a memory reference
on address zero which create_mem_ref_raw does as fallback. */
if (TREE_CODE (ref) == TARGET_MEM_REF
- && TMR_INDEX2 (ref) != NULL_TREE
&& integer_zerop (TREE_OPERAND (ref, 0)))
{
ref = fold_build1 (ADDR_EXPR, TREE_TYPE (TREE_OPERAND (ref, 0)), ref);
= wide_int_to_tree (TREE_TYPE (mem_op->op0),
wi::to_poly_wide (new_mem_op->op0));
}
+ /* Do not forward addresses of TARGET_MEM_REF. */
+ else if (tem[0].opcode == TARGET_MEM_REF)
+ return changed;
else
gcc_assert (tem.last ().opcode == STRING_CST);
ops->pop ();