+2011-04-18 Richard Guenther <rguenther@suse.de>
+
+ Backported from 4.6 branch
+ 2011-03-05 Zdenek Dvorak <ook@ucw.cz>
+
+ PR rtl-optimization/47899
+ * cfgloopmanip.c (fix_bb_placements): Fix first argument
+ to flow_loop_nested_p when moving the loop upward.
+
+ 2011-03-15 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/48031
+ * fold-const.c (fold_indirect_ref_1): Do not create new variable-sized
+ or variable-indexed array accesses when in gimple form.
+
2011-04-16 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* config/pa/pa.h (REGISTER_MOVE_COST): Increase to 18 cost of
{
sbitmap in_queue;
basic_block *queue, *qtop, *qbeg, *qend;
- struct loop *base_loop;
+ struct loop *base_loop, *target_loop;
edge e;
/* We pass through blocks back-reachable from FROM, testing whether some
/* Subloop header, maybe move the loop upward. */
if (!fix_loop_placement (from->loop_father))
continue;
+ target_loop = loop_outer (from->loop_father);
}
else
{
/* Ordinary basic block. */
if (!fix_bb_placement (from))
continue;
+ target_loop = from->loop_father;
}
FOR_EACH_EDGE (e, ei, from->succs)
&& (nca == base_loop
|| nca != pred->loop_father))
pred = pred->loop_father->header;
- else if (!flow_loop_nested_p (from->loop_father, pred->loop_father))
+ else if (!flow_loop_nested_p (target_loop, pred->loop_father))
{
- /* No point in processing it. */
+ /* If PRED is already higher in the loop hierarchy than the
+ TARGET_LOOP to that we moved FROM, the change of the position
+ of FROM does not affect the position of PRED, so there is no
+ point in processing it. */
continue;
}
+2011-04-18 Richard Guenther <rguenther@suse.de>
+
+ Backported from 4.6 branch
+ 2011-03-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/48035
+ * init.c (build_zero_init_1): Extracted from build_zero_init.
+ Add FIELD_SIZE argument, if non-NULL and field bit_position
+ as not smaller than that, don't add that field's initializer.
+ Pass DECL_SIZE as last argument to build_zero_init_1
+ for DECL_FIELD_IS_BASE fields.
+ (build_zero_init): Use build_zero_init_1.
+
2011-03-28 Jason Merrill <jason@redhat.com>
Revert:
is the number of elements in the array. If STATIC_STORAGE_P is
TRUE, initializers are only generated for entities for which
zero-initialization does not simply mean filling the storage with
- zero bytes. */
+ zero bytes. FIELD_SIZE, if non-NULL, is the bit size of the field,
+ subfields with bit positions at or above that bit size shouldn't
+ be added. */
-tree
-build_zero_init (tree type, tree nelts, bool static_storage_p)
+static tree
+build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
+ tree field_size)
{
tree init = NULL_TREE;
if (TREE_CODE (field) != FIELD_DECL)
continue;
+ /* Don't add virtual bases for base classes if they are beyond
+ the size of the current field, that means it is present
+ somewhere else in the object. */
+ if (field_size)
+ {
+ tree bitpos = bit_position (field);
+ if (TREE_CODE (bitpos) == INTEGER_CST
+ && !tree_int_cst_lt (bitpos, field_size))
+ continue;
+ }
+
/* Note that for class types there will be FIELD_DECLs
corresponding to base classes as well. Thus, iterating
over TYPE_FIELDs will result in correct initialization of
all of the subobjects. */
if (!static_storage_p || !zero_init_p (TREE_TYPE (field)))
{
- tree value = build_zero_init (TREE_TYPE (field),
- /*nelts=*/NULL_TREE,
- static_storage_p);
+ tree new_field_size
+ = (DECL_FIELD_IS_BASE (field)
+ && DECL_SIZE (field)
+ && TREE_CODE (DECL_SIZE (field)) == INTEGER_CST)
+ ? DECL_SIZE (field) : NULL_TREE;
+ tree value = build_zero_init_1 (TREE_TYPE (field),
+ /*nelts=*/NULL_TREE,
+ static_storage_p,
+ new_field_size);
if (value)
CONSTRUCTOR_APPEND_ELT(v, field, value);
}
ce->index = build2 (RANGE_EXPR, sizetype, size_zero_node,
max_index);
- ce->value = build_zero_init (TREE_TYPE (type),
- /*nelts=*/NULL_TREE,
- static_storage_p);
+ ce->value = build_zero_init_1 (TREE_TYPE (type),
+ /*nelts=*/NULL_TREE,
+ static_storage_p, NULL_TREE);
}
/* Build a constructor to contain the initializations. */
return init;
}
+/* Return an expression for the zero-initialization of an object with
+ type T. This expression will either be a constant (in the case
+ that T is a scalar), or a CONSTRUCTOR (in the case that T is an
+ aggregate), or NULL (in the case that T does not require
+ initialization). In either case, the value can be used as
+ DECL_INITIAL for a decl of the indicated TYPE; it is a valid static
+ initializer. If NELTS is non-NULL, and TYPE is an ARRAY_TYPE, NELTS
+ is the number of elements in the array. If STATIC_STORAGE_P is
+ TRUE, initializers are only generated for entities for which
+ zero-initialization does not simply mean filling the storage with
+ zero bytes. */
+
+tree
+build_zero_init (tree type, tree nelts, bool static_storage_p)
+{
+ return build_zero_init_1 (type, nelts, static_storage_p, NULL_TREE);
+}
+
/* Return a suitable initializer for value-initializing an object of type
TYPE, as described in [dcl.init]. */
}
/* *(foo *)&fooarray => fooarray[0] */
else if (TREE_CODE (optype) == ARRAY_TYPE
- && type == TREE_TYPE (optype))
+ && type == TREE_TYPE (optype)
+ && (!in_gimple_form
+ || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
{
tree type_domain = TYPE_DOMAIN (optype);
tree min_val = size_zero_node;
if (type_domain && TYPE_MIN_VALUE (type_domain))
min_val = TYPE_MIN_VALUE (type_domain);
+ if (in_gimple_form
+ && TREE_CODE (min_val) != INTEGER_CST)
+ return NULL_TREE;
op0 = build4 (ARRAY_REF, type, op, min_val, NULL_TREE, NULL_TREE);
SET_EXPR_LOCATION (op0, loc);
return op0;
/* *(foo *)fooarrptr => (*fooarrptr)[0] */
if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE
- && type == TREE_TYPE (TREE_TYPE (subtype)))
+ && type == TREE_TYPE (TREE_TYPE (subtype))
+ && (!in_gimple_form
+ || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST))
{
tree type_domain;
tree min_val = size_zero_node;
type_domain = TYPE_DOMAIN (TREE_TYPE (sub));
if (type_domain && TYPE_MIN_VALUE (type_domain))
min_val = TYPE_MIN_VALUE (type_domain);
+ if (in_gimple_form
+ && TREE_CODE (min_val) != INTEGER_CST)
+ return NULL_TREE;
op0 = build4 (ARRAY_REF, type, sub, min_val, NULL_TREE, NULL_TREE);
SET_EXPR_LOCATION (op0, loc);
return op0;
+2011-04-18 Richard Guenther <rguenther@suse.de>
+
+ Backported from 4.6 branch
+ 2011-03-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/48035
+ * g++.dg/inherit/virtual8.C: New test.
+
+ 2011-03-05 Zdenek Dvorak <ook@ucw.cz>
+
+ PR rtl-optimization/47899
+ * gcc.dg/pr47899.c: New test.
+
2011-04-16 Jakub Jelinek <jakub@redhat.com>
Backported from 4.6 branch