* [PATCH] Fix PR50902
@ 2011-11-02 11:26 Richard Guenther
0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2011-11-02 11:26 UTC (permalink / raw)
To: gcc-patches
This fixes PR50902.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2011-11-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50902
* tree-vect-stmts.c (vectorizable_load): Properly convert
an invariant initializer element.
* gcc.dg/torture/pr50902.c: New testcase.
Index: gcc/tree-vect-stmts.c
===================================================================
*** gcc/tree-vect-stmts.c (revision 180762)
--- gcc/tree-vect-stmts.c (working copy)
*************** vectorizable_load (gimple stmt, gimple_s
*** 4726,4736 ****
/* 4. Handle invariant-load. */
if (inv_p && !bb_vinfo)
{
! tree vec_inv;
gimple_stmt_iterator gsi2 = *gsi;
gcc_assert (!strided_load);
gsi_next (&gsi2);
! vec_inv = build_vector_from_val (vectype, scalar_dest);
new_temp = vect_init_vector (stmt, vec_inv,
vectype, &gsi2);
new_stmt = SSA_NAME_DEF_STMT (new_temp);
--- 4726,4745 ----
/* 4. Handle invariant-load. */
if (inv_p && !bb_vinfo)
{
! tree tem, vec_inv;
gimple_stmt_iterator gsi2 = *gsi;
gcc_assert (!strided_load);
gsi_next (&gsi2);
! tem = scalar_dest;
! if (!useless_type_conversion_p (TREE_TYPE (vectype),
! TREE_TYPE (tem)))
! {
! tem = fold_convert (TREE_TYPE (vectype), tem);
! tem = force_gimple_operand_gsi (&gsi2, tem, true,
! NULL_TREE, true,
! GSI_SAME_STMT);
! }
! vec_inv = build_vector_from_val (vectype, tem);
new_temp = vect_init_vector (stmt, vec_inv,
vectype, &gsi2);
new_stmt = SSA_NAME_DEF_STMT (new_temp);
Index: gcc/testsuite/gcc.dg/torture/pr50902.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr50902.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr50902.c (revision 0)
***************
*** 0 ****
--- 1,9 ----
+ /* { dg-do compile } */
+
+ _Bool data[128];
+ void foo (_Bool *init)
+ {
+ int i;
+ for (i = 0; i < 128; i++)
+ data[i] = *init;
+ }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-11-02 10:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-02 11:26 [PATCH] Fix PR50902 Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).