{
ir_graph *irg;
ir_mode *mode;
- const ir_edge_t *edge;
- const ir_edge_t *next;
/* no need to do anything */
if (orig_val == second_val)
ssa_second_def = second_val;
/* Only fix the users of the first, i.e. the original node */
- foreach_out_edge_safe(orig_val, edge, next) {
+ foreach_out_edge_safe(orig_val, edge) {
ir_node *user = get_edge_src_irn(edge);
int j = get_edge_src_pos(edge);
ir_node *user_block = get_nodes_block(user);
static void copy_and_fix(const jumpthreading_env_t *env, ir_node *block,
ir_node *copy_block, int j)
{
- const ir_edge_t *edge;
-
/* Look at all nodes in the cond_block and copy them into pred */
foreach_out_edge(block, edge) {
ir_node *node = get_edge_src_irn(edge);
ir_mode *mode;
if (is_End(node)) {
- /* edge is a Keep edge. If the end block is unreachable via normal control flow,
- * we must maintain end's reachability with Keeps.
+ /* edge is a Keep edge. If the end block is unreachable via normal
+ * control flow, we must maintain end's reachability with Keeps.
*/
keep_alive(copy_block);
continue;
* mode_bs which can't be handled in all backends. Instead we duplicate
* the node and move it to its users */
if (mode == mode_b) {
- const ir_edge_t *edge, *next;
ir_node *pred;
int pn;
pred = get_Proj_pred(node);
pn = get_Proj_proj(node);
- foreach_out_edge_safe(node, edge, next) {
+ foreach_out_edge_safe(node, edge) {
ir_node *cmp_copy;
ir_node *user = get_edge_src_irn(edge);
int pos = get_edge_src_pos(edge);
copy_node = (ir_node*)get_irn_link(node);
construct_ssa(block, node, copy_block, copy_node);
}
+
+ /* make sure new nodes are kept alive if old nodes were */
+ ir_graph *irg = get_irn_irg(block);
+ ir_node *end = get_irg_end(irg);
+ for (int i = 0, arity = get_End_n_keepalives(end); i < arity; ++i) {
+ ir_node *keep = get_End_keepalive(end, i);
+ if (get_irn_visited(keep) < env->visited_nr || is_Block(keep))
+ continue;
+ ir_node *copy = get_irn_link(keep);
+ add_End_keepalive(end, copy);
+ }
}
/**
DB((
dbg, LEVEL_1,
"> Found jump threading candidate %+F->%+F\n",
- env->true_block, block
+ block, env->true_block
));
/* adjust true_block to point directly towards our jump */
DB((
dbg, LEVEL_1,
"> Found jump threading candidate %+F->%+F\n",
- env->true_block, block
+ block, env->true_block
));
/* adjust true_block to point directly towards our jump */
ir_node *cond;
ir_node *copy_block;
int selector_evaluated;
- const ir_edge_t *edge, *next;
ir_graph *irg;
ir_node *badX;
int cnst_pos;
cnst_pos = env.cnst_pos;
/* shorten Phis */
- foreach_out_edge_safe(env.cnst_pred, edge, next) {
+ foreach_out_edge_safe(env.cnst_pred, edge) {
ir_node *node = get_edge_src_irn(edge);
if (is_Phi(node)) {