Ping.
From: Alan Hayward <alan dot hayward at arm dot com> To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org> Date: Wed, 29 Jun 2016 08:49:34 +0100 Subject: [PATCH] PR 71667 - Handle live operations with DEBUG uses Authentication-results: sourceware.org; auth=none In vectorizable_live_operation() we always assume uses a of live operation will be PHIs. However, when using -g a use of a live operation might be a DEBUG stmt. This patch avoids adding any DEBUG statments to the worklist in vectorizable_live_operation(). Also fixes comment. Tested on x86 and aarch64. Ok to commit? gcc/ PR tree-optimization/71667 * tree-vect-loop.c (vectorizable_live_operation): ignore DEBUG stmts testsuite/gcc.dg/vect PR tree-optimization/71667 * pr71667.c: New diff --git a/gcc/testsuite/gcc.dg/vect/pr71667.c b/gcc/testsuite/gcc.dg/vect/pr71667.c new file mode 100644 index 0000000000000000000000000000000000000000..e7012efa882a5497b0a6099c3d853f9eb 375cc53 --- /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 6c0337bbbcbebd6443fd3bcef45c1b23a7833486..2980a1b031cd3b919369b5e31dff7e066 5bc7578 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6352,11 +6352,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<gimple *, 4> 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));