+2018-03-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/84775
+ * tree-if-conv.c (add_bb_predicate_gimplified_stmts): Delink
+ immediate uses of predicate stmts and mark them modified.
+
+ Revert
+ PR tree-optimization/84178
+ * tree-if-conv.c (combine_blocks): Move insert_gimplified_predicates
+ to caller.
+ (version_loop_for_if_conversion): Delay update_ssa call.
+ (tree_if_conversion): Delay update_ssa until after predicate
+ insertion.
+
2018-03-09 Eric Botcazou <ebotcazou@adacore.com>
PR target/84763
static inline void
add_bb_predicate_gimplified_stmts (basic_block bb, gimple_seq stmts)
{
+ /* We might have updated some stmts in STMTS via force_gimple_operand
+ calling fold_stmt and that producing multiple stmts. Delink immediate
+ uses so update_ssa after loop versioning doesn't get confused for
+ the not yet inserted predicates.
+ ??? This should go away once we reliably avoid updating stmts
+ not in any BB. */
+ for (gimple_stmt_iterator gsi = gsi_start (stmts);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ delink_stmt_imm_use (stmt);
+ gimple_set_modified (stmt, true);
+ }
gimple_seq_add_seq_without_update
(&(((struct bb_predicate *) bb->aux)->predicate_gimplified_stmts), stmts);
}
edge_iterator ei;
remove_conditions_and_labels (loop);
+ insert_gimplified_predicates (loop);
predicate_all_scalar_phis (loop);
if (any_pred_load_store)
gsi = gsi_last_bb (cond_bb);
gimple_call_set_arg (g, 1, build_int_cst (integer_type_node, new_loop->num));
gsi_insert_before (&gsi, g, GSI_SAME_STMT);
+ update_ssa (TODO_update_ssa);
return new_loop;
}
unsigned int todo = 0;
bool aggressive_if_conv;
struct loop *rloop;
- bool need_update_ssa = false;
again:
rloop = NULL;
struct loop *nloop = version_loop_for_if_conversion (vloop);
if (nloop == NULL)
goto cleanup;
- need_update_ssa = true;
if (vloop != loop)
{
/* If versionable_outer_loop_p decided to version the
}
}
- /* Due to hard to fix issues we end up with immediate uses recorded
- for not yet inserted predicates which will confuse SSA update so
- we delayed this from after versioning to after predicate insertion. */
- insert_gimplified_predicates (loop);
- if (need_update_ssa)
- update_ssa (TODO_update_ssa);
-
/* Now all statements are if-convertible. Combine all the basic
blocks into one huge basic block doing the if-conversion
on-the-fly. */