summaryrefslogtreecommitdiff
path: root/gcc/tree-predcom.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-predcom.c')
-rw-r--r--gcc/tree-predcom.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index de147e7ec96..4af074ff5e5 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1345,14 +1345,16 @@ ref_at_iteration (struct loop *loop, tree ref, int iter)
if (!op0)
return NULL_TREE;
}
- else if (!INDIRECT_REF_P (ref))
+ else if (!INDIRECT_REF_P (ref)
+ && TREE_CODE (ref) != MEM_REF)
return unshare_expr (ref);
- if (INDIRECT_REF_P (ref))
+ if (INDIRECT_REF_P (ref)
+ || TREE_CODE (ref) == MEM_REF)
{
- /* Take care for INDIRECT_REF and MISALIGNED_INDIRECT_REF at
+ /* Take care for MEM_REF and MISALIGNED_INDIRECT_REF at
the same time. */
- ret = copy_node (ref);
+ ret = unshare_expr (ref);
idx = TREE_OPERAND (ref, 0);
idx_p = &TREE_OPERAND (ret, 0);
}