2012-04-13 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/52969
+ * tree-if-conv.c (predicate_mem_writes): Properly gimplify
+ the condition for the COND_EXPR and handle predicate negation
+ by swapping the COND_EXPR arms.
+
+2012-04-13 Richard Guenther <rguenther@suse.de>
+
PR c/52862
* convert.c (convert_to_pointer): Remove special-casing of
zero.
2012-04-13 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/52969
+ * gcc.dg/torture/pr52969.c: New testcase.
+
+2012-04-13 Richard Guenther <rguenther@suse.de>
+
PR c/52862
* gcc.dg/pr52862.c: New testcase.
gimple_stmt_iterator gsi;
basic_block bb = ifc_bbs[i];
tree cond = bb_predicate (bb);
+ bool swap;
gimple stmt;
if (is_true_predicate (cond))
continue;
+ swap = false;
+ if (TREE_CODE (cond) == TRUTH_NOT_EXPR)
+ {
+ swap = true;
+ cond = TREE_OPERAND (cond, 0);
+ }
+
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
if ((stmt = gsi_stmt (gsi))
&& gimple_assign_single_p (stmt)
lhs = ifc_temp_var (type, unshare_expr (lhs), &gsi);
rhs = ifc_temp_var (type, unshare_expr (rhs), &gsi);
+ if (swap)
+ {
+ tree tem = lhs;
+ lhs = rhs;
+ rhs = tem;
+ }
+ cond = force_gimple_operand_gsi_1 (&gsi, unshare_expr (cond),
+ is_gimple_condexpr, NULL_TREE,
+ true, GSI_SAME_STMT);
rhs = build3 (COND_EXPR, type, unshare_expr (cond), rhs, lhs);
gimple_assign_set_rhs1 (stmt, ifc_temp_var (type, rhs, &gsi));
update_stmt (stmt);