Commit 0f6284d2 by Yuri Rumyantsev Committed by Kirill Yukhin

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

PR tree-optimization/61576

gcc/
	* tree-if-conv.c (is_cond_scalar_reduction): Add check that
	basic block containing reduction statement is predecessor
	of phi basi block.

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

From-SVN: r212347
parent 605f12f4
2014-07-08 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/61576
* tree-if-conv.c (is_cond_scalar_reduction): Add check that
basic block containing reduction statement is predecessor
of phi basi block.
2014-07-08 Marek Polacek <polacek@redhat.com>
PR c/60226
......
2014-07-08 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/61576
* gcc.dg/torture/pr61576.c: New test.
2014-07-08 Marek Polacek <polacek@redhat.com>
PR c/60226
......
/* { dg-do run } */
#include <stdlib.h>
volatile int a, b;
int c, d, e, f;
static int
fn1 ()
{
if (b)
{
d++;
e = c || f;
}
return 0;
}
int
main ()
{
for (; a < 1; a++)
{
fn1 ();
continue;
}
if (d != 0)
abort();
return 0;
}
......@@ -1407,7 +1407,8 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc,
gimple stmt;
gimple header_phi = NULL;
enum tree_code reduction_op;
struct loop *loop = gimple_bb (phi)->loop_father;
basic_block bb = gimple_bb (phi);
struct loop *loop = bb->loop_father;
edge latch_e = loop_latch_edge (loop);
imm_use_iterator imm_iter;
use_operand_p use_p;
......@@ -1447,6 +1448,11 @@ is_cond_scalar_reduction (gimple phi, gimple *reduc,
if (!is_predicated (gimple_bb (stmt)))
return false;
/* Check that stmt-block is predecessor of phi-block. */
if (EDGE_PRED (bb, 0)->src != gimple_bb (stmt)
&& EDGE_PRED (bb, 1)->src != gimple_bb (stmt))
return false;
if (!has_single_use (lhs))
return false;
......
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