This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed] Fix PR tree-opt/28952 ICE in vectorizable_condition
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 05 Sep 2006 23:07:00 -0700
- Subject: [Committed] Fix PR tree-opt/28952 ICE in vectorizable_condition
The problem here is that we were checking the type of the operand of a
conditional expression before we knew it was a conditional expression.
This moves the check for the checking of the type after the check for we
know we have a conditional expression which vect_is_simple_cond checks
for.
Applied as obvious after a bootstrap and test on i686-pc-linux-gnu.
Thanks,
Andrew Pinski
ChangeLog:
* tree-vect-transform.c (vectorizable_condition): Move the check
for the type after the check for simple condition.
testsuite/ChangeLog:
* gcc.dg/vect/pr28952.c: New test.
Index: testsuite/gcc.dg/vect/pr28952.c
===================================================================
--- testsuite/gcc.dg/vect/pr28952.c (revision 0)
+++ testsuite/gcc.dg/vect/pr28952.c (revision 0)
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+
+/* We were ICE because we wanted to check the type of the
+ elements of a conditional before we knew it was a conditional. */
+
+struct player_spaceship
+{
+ _Bool structure[32];
+};
+struct player
+{
+ struct player_spaceship spaceship;
+};
+struct packet_spaceship_info
+{
+ char structure[32 + 1];
+};
+send_spaceship_info (void)
+{
+ int j;
+ struct player *pplayer;
+ struct packet_spaceship_info info;
+ struct player_spaceship *ship = &pplayer->spaceship;
+ for (j = 0; j < 32; j++)
+ {
+ info.structure[j] = ship->structure[j] ? '1' : '0';
+ }
+ lsend_packet_spaceship_info (&info);
+}
+
+
Index: tree-vect-transform.c
===================================================================
--- tree-vect-transform.c (revision 116689)
+++ tree-vect-transform.c (working copy)
@@ -2117,14 +2117,14 @@ vectorizable_condition (tree stmt, block
then_clause = TREE_OPERAND (op, 1);
else_clause = TREE_OPERAND (op, 2);
+ if (!vect_is_simple_cond (cond_expr, loop_vinfo))
+ return false;
+
/* We do not handle two different vector types for the condition
and the values. */
if (TREE_TYPE (TREE_OPERAND (cond_expr, 0)) != TREE_TYPE (vectype))
return false;
- if (!vect_is_simple_cond (cond_expr, loop_vinfo))
- return false;
-
if (TREE_CODE (then_clause) == SSA_NAME)
{
tree then_def_stmt = SSA_NAME_DEF_STMT (then_clause);