This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto] coverage.c: Call build_constructor instead of build_constructor_from_list. (Part 4)
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 1 Jun 2006 05:10:43 -0700
- Subject: [lto] coverage.c: Call build_constructor instead of build_constructor_from_list. (Part 4)
Hi,
Attached is a patch to call build_constructor instead of
build_constructor_from_list.
build_constructor_from_list takes a linked list constructed with
tree_cons and internally converts that to an instance of VEC.
This patches skips the construction of the linked list and calls
build_constructor, which takes VEC directly.
Note that this patch does not change the order of elements. The
original code does tree_cons "backward" to save a call to nreverse.
With this patch, I add things to a vector in the forward order.
Tested on x86_64-pc-linux-gnu. OK to apply to the LTO branch (and 4.3
once in stage 1)?
Kazu Hirata
2006-06-01 Kazu Hirata <kazu@codesourcery.com>
* tree-vect-transform.c (tree-vect-transform.c): Call
build_constructor instead of build_constructor_from_list.
Index: tree-vect-transform.c
===================================================================
*** tree-vect-transform.c (revision 114282)
--- tree-vect-transform.c (working copy)
*************** vect_get_vec_def_for_operand (tree op, t
*** 513,518 ****
--- 513,520 ----
/* Case 2: operand is defined outside the loop - loop invariant. */
case vect_invariant_def:
{
+ VEC(constructor_elt,gc) *v;
+
if (scalar_def)
*scalar_def = def;
*************** vect_get_vec_def_for_operand (tree op, t
*** 520,532 ****
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "Create vector_inv.");
! for (i = nunits - 1; i >= 0; --i)
! {
! t = tree_cons (NULL_TREE, def, t);
! }
! /* FIXME: use build_constructor directly. */
! vec_inv = build_constructor_from_list (vectype, t);
return vect_init_vector (stmt, vec_inv);
}
--- 522,536 ----
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "Create vector_inv.");
! v = VEC_alloc (constructor_elt, gc, nunits);
! for (i = 0; i < nunits; i++)
! {
! constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL);
! elt->index = NULL_TREE;
! elt->value = def;
! }
! vec_inv = build_constructor (vectype, v);
return vect_init_vector (stmt, vec_inv);
}