+2014-06-17 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-loop-im.c (determine_max_movement): Adjust cost
+ of PHI node moving.
+
2014-06-17 Kugan Vivekanandarajah <kuganv@linaro.org>
* config/arm/arm.c (arm_atomic_assign_expand_fenv): call
+2014-06-17 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-lim-12.c: New testcase.
+
2014-06-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/61482
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-lim1" } */
+
+int a[1024];
+
+void foo (int x, int z)
+{
+ int i;
+ int y = -x;
+ for (i = 0; i < 1024; ++i)
+ a[i] = x ? y : z;
+}
+
+void bar (int x, int z)
+{
+ int j;
+ for (j = 0; j < 1024; ++j)
+ {
+ int i;
+ int y = -j + z;
+ for (i = 0; i < 1024; ++i)
+ a[i] = x ? y : j;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "!= 0 ? " 2 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
}
if (!add_dependency (val, lim_data, loop, false))
return false;
- def_data = get_lim_data (SSA_NAME_DEF_STMT (val));
- if (def_data)
+
+ gimple def_stmt = SSA_NAME_DEF_STMT (val);
+ if (gimple_bb (def_stmt)
+ && gimple_bb (def_stmt)->loop_father == loop)
{
- min_cost = MIN (min_cost, def_data->cost);
- total_cost += def_data->cost;
+ def_data = get_lim_data (def_stmt);
+ if (def_data)
+ {
+ min_cost = MIN (min_cost, def_data->cost);
+ total_cost += def_data->cost;
+ }
}
}
+ min_cost = MIN (min_cost, total_cost);
lim_data->cost += min_cost;
if (gimple_phi_num_args (stmt) > 1)