Commit 560c75e9 by Yuri Rumyantsev Committed by Kirill Yukhin

re PR tree-optimization/61518 (wrong code (by tree vectorizer) at -O3 on x86_64-linux-gnu)

        PR tree-optimization/61518
gcc/
        * tree-if-conv.c (is_cond_scalar_reduction): Add missed check that
        reduction var is used in reduction stmt or phi-function only.

gcc/testsuite/
        * gcc.dg/torture/pr61518.c: New test.

From-SVN: r211780
parent 751738cb
2014-06-18 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/61518
* tree-if-conv.c (is_cond_scalar_reduction): Add missed check that
reduction var is used in reduction stmt or phi-function only.
2014-06-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2014-06-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/arm_neon.h (vadd_f32): Change #ifdef to __FAST_MATH. * config/arm/arm_neon.h (vadd_f32): Change #ifdef to __FAST_MATH.
......
2014-06-18 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/61518
* gcc.dg/torture/pr61518.c: New test.
2014-06-18 Thomas Preud'homme <thomas.preudhomme@arm.com> 2014-06-18 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR tree-optimization/61517 PR tree-optimization/61517
......
/* { dg-do run } */
int a, b, c[1], d, e, f;
void
fn1 ()
{
for (; d < 1; d++)
{
if (b)
{
a = e++ && f;
b = f;
}
c[b] = 0;
}
}
int
main ()
{
fn1 ();
if (e != 0)
__builtin_abort ();
return 0;
}
...@@ -1409,6 +1409,8 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc, ...@@ -1409,6 +1409,8 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc,
enum tree_code reduction_op; enum tree_code reduction_op;
struct loop *loop = gimple_bb (phi)->loop_father; struct loop *loop = gimple_bb (phi)->loop_father;
edge latch_e = loop_latch_edge (loop); edge latch_e = loop_latch_edge (loop);
imm_use_iterator imm_iter;
use_operand_p use_p;
arg_0 = PHI_ARG_DEF (phi, 0); arg_0 = PHI_ARG_DEF (phi, 0);
arg_1 = PHI_ARG_DEF (phi, 1); arg_1 = PHI_ARG_DEF (phi, 1);
...@@ -1465,6 +1467,18 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc, ...@@ -1465,6 +1467,18 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc,
else if (r_op1 != PHI_RESULT (header_phi)) else if (r_op1 != PHI_RESULT (header_phi))
return false; return false;
/* Check that R_OP1 is used in reduction stmt or in PHI only. */
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, r_op1)
{
gimple use_stmt = USE_STMT (use_p);
if (is_gimple_debug (use_stmt))
continue;
if (use_stmt == stmt)
continue;
if (gimple_code (use_stmt) != GIMPLE_PHI)
return false;
}
*op0 = r_op1; *op1 = r_op2; *op0 = r_op1; *op1 = r_op2;
*reduc = stmt; *reduc = stmt;
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment