+2010-11-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR tree-optimization/45971
+ * tree-if-conv.c (predicate_scalar_phi): Do not generate a COND_EXPR
+ for phi nodes analyzable by scev.
+
2010-11-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44964
+2010-11-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR tree-optimization/45971
+ * gcc.dg/vect/O3-pr45971.c: New.
+
2010-11-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44964
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+void
+foo (int *x, int *y)
+{
+ int i;
+ for (i = 0; i < 11; i++)
+ y[i] = (x[i] == 1) ? i + 1 : -(i + 1);
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
{
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);
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
{