From 3c3ecf52a6394009877a6771c871603c13fd035f Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Fri, 8 Jul 2016 08:50:24 +0000 Subject: [PATCH] re PR debug/71667 (ICE in as_a, at is-a.h:192 w/ -g -O2 -ftree-vectorize) 2016-07-08 Alan Hayward gcc/ PR tree-optimization/71667 * tree-vect-loop.c (vectorizable_live_operation): ignore DEBUG stmts testsuite/ PR tree-optimization/71667 * gcc.dg/vect/pr71667.c: New From-SVN: r238160 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/pr71667.c | 30 +++++++++++++++++++++++++++++ gcc/tree-vect-loop.c | 7 ++++--- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr71667.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index afd022ed7f3..dc648ca3253 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-07-08 Alan Hayward + + PR tree-optimization/71667 + * tree-vect-loop.c (vectorizable_live_operation): ignore DEBUG stmts + 2016-07-08 Martin Liska PR middle-end/71606 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8a4dc1d5b3d..3af679a511f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-08 Alan Hayward + + PR tree-optimization/71667 + * gcc.dg/vect/pr71667.c: New + 2016-07-08 Martin Liska * gcc.dg/torture/pr71606.c: New test. diff --git a/gcc/testsuite/gcc.dg/vect/pr71667.c b/gcc/testsuite/gcc.dg/vect/pr71667.c new file mode 100644 index 00000000000..e7012efa882 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr71667.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-g" } */ + +unsigned int mu; +int pt; + +void +qf (void) +{ + int gy; + long int vz; + + for (;;) + { + for (gy = 0; gy < 80; ++gy) + { + vz = mu; + ++mu; + pt = (vz != 0) && (pt != 0); + } + while (gy < 81) + while (gy < 83) + { + vz = (vz != 0) ? 0 : mu; + ++gy; + } + pt = vz; + ++mu; + } +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 63c002e737c..97acf3cb6d3 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6354,11 +6354,12 @@ vectorizable_live_operation (gimple *stmt, : gimple_get_lhs (stmt); lhs_type = TREE_TYPE (lhs); - /* Find all uses of STMT outside the loop - there should be exactly one. */ + /* Find all uses of STMT outside the loop - there should be at least one. */ auto_vec worklist; FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs) - if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) - worklist.safe_push (use_stmt); + if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)) + && !is_gimple_debug (use_stmt)) + worklist.safe_push (use_stmt); gcc_assert (worklist.length () >= 1); bitsize = TYPE_SIZE (TREE_TYPE (vectype)); -- 2.30.2