X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ftree-if-conv.c;h=fc6584584c14763e6fcccb2ba025369967f61452;hb=54c0191177db8bc27fb599a7d0d7a5866c5046fb;hp=17b66721e5d25b3227643037fb1290c1af9f509c;hpb=df4ae4c4516593909d0074d4ddea3da9c0243fda;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 17b66721e5d..fc6584584c1 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -1224,7 +1224,7 @@ predicate_scalar_phi (gimple phi, tree cond, { gimple new_stmt; basic_block bb; - tree rhs, res, arg; + tree rhs, res, arg, scev; gcc_assert (gimple_code (phi) == GIMPLE_PHI && gimple_phi_num_args (phi) == 2); @@ -1236,8 +1236,12 @@ predicate_scalar_phi (gimple phi, tree cond, bb = gimple_bb (phi); - arg = degenerate_phi_result (phi); - if (arg) + if ((arg = degenerate_phi_result (phi)) + || ((scev = analyze_scalar_evolution (gimple_bb (phi)->loop_father, + res)) + && !chrec_contains_undetermined (scev) + && scev != res + && (arg = gimple_phi_arg_def (phi, 0)))) rhs = arg; else {