+2018-06-01 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/86017
+ * gimple-fold.c (var_decl_component_p): Also allow offsetted
+ vars wrapped in MEM_REFs.
+
2018-06-01 Richard Sandiford <richard.sandiford@linaro.org>
* config/aarch64/aarch64.c (aarch64_ira_change_pseudo_allocno_class):
tree inner = var;
while (handled_component_p (inner))
inner = TREE_OPERAND (inner, 0);
- return SSA_VAR_P (inner);
+ return (DECL_P (inner)
+ || (TREE_CODE (inner) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (inner, 0)) == ADDR_EXPR));
}
/* If the SIZE argument representing the size of an object is in a range
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-store-merging" } */
+
+void f (void*);
+
+void g (void)
+{
+ char a[8];
+ __builtin_memset (a, 0, 8);
+
+ f (a);
+}
+
+void h (void)
+{
+ char a[8];
+ __builtin_memset (a, 0, 1);
+ __builtin_memset (a + 1, 0, 1);
+ __builtin_memset (a + 2, 0, 1);
+ __builtin_memset (a + 3, 0, 1);
+ __builtin_memset (a + 4, 0, 1);
+ __builtin_memset (a + 5, 0, 1);
+ __builtin_memset (a + 6, 0, 1);
+ __builtin_memset (a + 7, 0, 1);
+
+ f (a);
+}
+
+/* { dg-final { scan-tree-dump "Merged into 1 stores" "store-merging" } } */