http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55110
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-26 10:35:44 UTC --- I'd say either we should nuke the bogus gcc_assert (STMT_VINFO_RELATED_STMT (orig_stmt_info) == stmt); assertion, which predates the introduction of STMT_VINFO_PATTERN_DEF_STMT (and later STMT_VINFO_PATTERN_DEF_SEQ) - both in 4.7 cycle, or just return false; if it isn't equal. We won't successfully vectorize this anyway, orig_code is still TRUNC_DIV_EXPR and that is not a handled reduction (and even if we'd handled it as the signed MULT_HIGHPART_EXPR reduction, that isn't handled either). So, I'd propose this (if we wanted to assert something, it would need to walk the STMT_VINFO_PATTERN_DEF_SEQ sequence and checking whether stmt isn't in there too): 2012-11-26 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/55110 * tree-vect-loop.c (vectorizable_reduction): Don't assert that STMT_VINFO_RELATED_STMT of orig_stmt is stmt. * gcc.dg/pr55110.c: New test. --- gcc/tree-vect-loop.c.jj 2012-11-21 16:00:12.000000000 +0100 +++ gcc/tree-vect-loop.c 2012-11-26 11:24:42.903995009 +0100 @@ -4624,7 +4624,6 @@ vectorizable_reduction (gimple stmt, gim if (orig_stmt) { orig_stmt_info = vinfo_for_stmt (orig_stmt); - gcc_assert (STMT_VINFO_RELATED_STMT (orig_stmt_info) == stmt); gcc_assert (STMT_VINFO_IN_PATTERN_P (orig_stmt_info)); gcc_assert (!STMT_VINFO_IN_PATTERN_P (stmt_info)); } --- gcc/testsuite/gcc.dg/pr55110.c.jj 2012-11-26 11:31:32.008587313 +0100 +++ gcc/testsuite/gcc.dg/pr55110.c 2012-11-26 11:31:09.000000000 +0100 @@ -0,0 +1,13 @@ +/* PR tree-optimization/55110 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vectorize" } */ + +int +foo (int x) +{ + int a, b; + for (b = 0; b < 8; b++) + for (a = 0; a < 2; a++) + x /= 3; + return x; +}