Commit 52085dfb authored by Matthias Braun's avatar Matthias Braun
Browse files

jumpthreading: cleaner PhiLoop handling

parent 1b9ce672
...@@ -96,7 +96,9 @@ static ir_node *search_def_and_create_phis(ir_node *block, ir_mode *mode, ...@@ -96,7 +96,9 @@ static ir_node *search_def_and_create_phis(ir_node *block, ir_mode *mode,
in[i] = dummy; in[i] = dummy;
} }
ir_node *phi = new_r_Phi(block, n_cfgpreds, in, mode); /* we might have created a potential endless loop, and need a PhiLoop */
ir_node *phi = mode == mode_M ? new_r_Phi_loop(block, n_cfgpreds, in)
: new_r_Phi(block, n_cfgpreds, in, mode);
set_irn_link(block, phi); set_irn_link(block, phi);
mark_irn_visited(block); mark_irn_visited(block);
...@@ -112,11 +114,6 @@ static ir_node *search_def_and_create_phis(ir_node *block, ir_mode *mode, ...@@ -112,11 +114,6 @@ static ir_node *search_def_and_create_phis(ir_node *block, ir_mode *mode,
} }
set_irn_n(phi, i, pred_val); set_irn_n(phi, i, pred_val);
} }
/* we might have created a potential endless loop, so keep the Phi */
if (get_irn_mode(phi) == mode_M) {
keep_alive(phi);
set_Phi_loop(phi, true);
}
return phi; return phi;
} }
...@@ -320,12 +317,9 @@ static void copy_and_fix(const jumpthreading_env_t *env, ir_node *block, ...@@ -320,12 +317,9 @@ static void copy_and_fix(const jumpthreading_env_t *env, ir_node *block,
if (get_irn_visited(keep) < env->visited_nr || is_Block(keep)) if (get_irn_visited(keep) < env->visited_nr || is_Block(keep))
continue; continue;
ir_node *copy = get_irn_link(keep); ir_node *copy = get_irn_link(keep);
if (is_Phi(keep) && is_Phi(copy)) { /* exact copy does not reproduce the keep alive edges */
assert(get_irn_mode(keep) == mode_M); if (is_Phi(copy) && get_Phi_loop(copy))
assert(get_Phi_loop(keep));
add_End_keepalive(end, copy); add_End_keepalive(end, copy);
set_Phi_loop(copy, true);
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment