+2017-04-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/80262
+ * tree-sra.c (build_ref_for_offset): Preserve address-space
+ information.
+ * tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address):
+ Drop useless address-space information on MEM_REF offsets.
+
2017-04-05 Andreas Schwab <schwab@linux-m68k.org>
* builtins.def (BUILT_IN_UPDATE_SETJMP_BUF): Fix type.
2017-04-06 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/80262
+ * gcc.target/i386/pr80262.c: New testcase.
+
+2017-04-06 Richard Biener <rguenther@suse.de>
+
PR middle-end/80281
* gcc.dg/tree-ssa/pr40921.c: Add -fp-contract=off.
--- /dev/null
+/* { dg-do compile } */\r
+/* { dg-options "-O2" } */\r
+\r
+typedef struct {\r
+ int v;\r
+} S1;\r
+S1 clearS1 () { S1 s1 = { 0 }; return s1; }\r
+ \r
+typedef struct {\r
+ S1 s1[4];\r
+} S2;\r
+void clearS2 (__seg_gs S2* p, int n) {\r
+ for (int i = 0; i < n; ++i)\r
+ p->s1[i] = clearS1 ();\r
+}\r
+ \r
+typedef struct {\r
+ int pad;\r
+ S2 s2;\r
+} S3;\r
+ \r
+long int BASE;\r
+ \r
+void fn1(int n) {\r
+ clearS2 (&(((__seg_gs S3*)(BASE))->s2), n);\r
+}\r
unsigned HOST_WIDE_INT misalign;
unsigned int align;
+ /* Preserve address-space information. */
+ addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (base));
+ if (as != TYPE_ADDR_SPACE (exp_type))
+ exp_type = build_qualified_type (exp_type,
+ TYPE_QUALS (exp_type)
+ | ENCODE_QUAL_ADDR_SPACE (as));
+
gcc_checking_assert (offset % BITS_PER_UNIT == 0);
get_object_alignment_1 (base, &align, &misalign);
base = get_addr_base_and_unit_offset (base, &base_offset);
&& tem[tem.length () - 2].opcode == MEM_REF)
{
vn_reference_op_t new_mem_op = &tem[tem.length () - 2];
- new_mem_op->op0 = fold_convert (TREE_TYPE (mem_op->op0),
- new_mem_op->op0);
+ new_mem_op->op0 = wide_int_to_tree (TREE_TYPE (mem_op->op0),
+ new_mem_op->op0);
}
else
gcc_assert (tem.last ().opcode == STRING_CST);