+2012-07-18 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/53970
+ * tree.h (contains_packed_reference): Remove.
+ * expr.c (contains_packed_reference): Likewise.
+ * tree-vect-data-refs.c (not_size_aligned): New function.
+ (vector_alignment_reachable_p): Use it.
+ (vect_supportable_dr_alignment): Likewise.
+
2012-07-18 Richard Guenther <rguenther@suse.de>
* tree.h (get_object_or_type_alignment): Remove.
return exp;
}
-/* Given an expression EXP that may be a COMPONENT_REF, an ARRAY_REF or an
- ARRAY_RANGE_REF, look for whether EXP or any nested component-refs within
- EXP is marked as PACKED. */
-
-bool
-contains_packed_reference (const_tree exp)
-{
- bool packed_p = false;
-
- while (1)
- {
- switch (TREE_CODE (exp))
- {
- case COMPONENT_REF:
- {
- tree field = TREE_OPERAND (exp, 1);
- packed_p = DECL_PACKED (field)
- || TYPE_PACKED (TREE_TYPE (field))
- || TYPE_PACKED (TREE_TYPE (exp));
- if (packed_p)
- goto done;
- }
- break;
-
- case BIT_FIELD_REF:
- case ARRAY_REF:
- case ARRAY_RANGE_REF:
- case REALPART_EXPR:
- case IMAGPART_EXPR:
- case VIEW_CONVERT_EXPR:
- break;
-
- default:
- goto done;
- }
- exp = TREE_OPERAND (exp, 0);
- }
- done:
- return packed_p;
-}
-
/* Return a tree of sizetype representing the size, in bytes, of the element
of EXP, an ARRAY_REF or an ARRAY_RANGE_REF. */
+2012-07-18 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/53970
+ * g++.dg/torture/pr53970.C: New testcase.
+
2012-07-18 Oleg Endo <olegendo@gcc.gnu.org>
PR target/38621
--- /dev/null
+// { dg-do run }
+
+#pragma pack(1)
+struct mystruct {
+ char c;
+ unsigned long l[1024];
+};
+#pragma pack()
+
+int main(int argc, char **argv)
+{
+ mystruct *a = new mystruct;
+ unsigned long i;
+ for (i = 0; i < 1024; ++i)
+ a->l[i] = 0xdeadbeaf;
+ return 0;
+}
return true;
}
+/* Given an memory reference EXP return whether its alignment is less
+ than its size. */
+
+static bool
+not_size_aligned (tree exp)
+{
+ if (!host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1))
+ return true;
+
+ return (tree_low_cst (TYPE_SIZE (TREE_TYPE (exp)), 1)
+ > get_object_alignment (exp));
+}
/* Function vector_alignment_reachable_p
if (!known_alignment_for_access_p (dr))
{
- tree type = (TREE_TYPE (DR_REF (dr)));
- bool is_packed = contains_packed_reference (DR_REF (dr));
-
- if (compare_tree_int (TYPE_SIZE (type), TYPE_ALIGN (type)) > 0)
- is_packed = true;
-
+ tree type = TREE_TYPE (DR_REF (dr));
+ bool is_packed = not_size_aligned (DR_REF (dr));
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "Unknown misalignment, is_packed = %d",is_packed);
if (targetm.vectorize.vector_alignment_reachable (type, is_packed))
return dr_explicit_realign_optimized;
}
if (!known_alignment_for_access_p (dr))
- is_packed = contains_packed_reference (DR_REF (dr));
+ is_packed = not_size_aligned (DR_REF (dr));
if (targetm.vectorize.
support_vector_misalignment (mode, type,
tree type = (TREE_TYPE (DR_REF (dr)));
if (!known_alignment_for_access_p (dr))
- is_packed = contains_packed_reference (DR_REF (dr));
+ is_packed = not_size_aligned (DR_REF (dr));
if (targetm.vectorize.
support_vector_misalignment (mode, type,
tree *, enum machine_mode *, int *, int *,
bool);
-/* Given an expression EXP that may be a COMPONENT_REF, an ARRAY_REF or an
- ARRAY_RANGE_REF, look for whether EXP or any nested component-refs within
- EXP is marked as PACKED. */
-
-extern bool contains_packed_reference (const_tree exp);
-
/* Return a tree of sizetype representing the size, in bytes, of the element
of EXP, an ARRAY_REF or an ARRAY_RANGE_REF. */