Commit 763b7a16 authored by Andreas Zwinkau's avatar Andreas Zwinkau
Browse files

Revert "jumpthreading must not split edges"

This reverts commit 2dc83299.

The commit made jumpthreading "more conservative", which fixed the
problem. However, it is not a good solution in general.

We need a bigger rewrite of opt/jumpthreading, so it analyzes then
modifies the graph instead of on-the-fly changes. This prevents the
infinite loop, which would e.g. happen with such a cf graph:

    \     A         \     A
   __\    |        __\    |
   |  B   |   =>   |  B   |  => ...
   | / \  |        | / \  |
   |    D |        |    E |
   |     \|        |     \|
    \     C         \     D
     \___/           \   /
                      \_C

Breaks opt/jumpthreading5 and opt/jumpthreading5b
parent afea0c3c
......@@ -194,6 +194,19 @@ static void construct_ssa(ir_node *orig_block, ir_node *orig_val,
}
}
static void split_critical_edge(ir_node *block, int pos)
{
ir_graph *irg = get_irn_irg(block);
ir_node *in[1];
ir_node *new_block;
ir_node *new_jmp;
in[0] = get_Block_cfgpred(block, pos);
new_block = new_r_Block(irg, 1, in);
new_jmp = new_r_Jmp(new_block);
set_Block_cfgpred(block, pos, new_jmp);
}
typedef struct jumpthreading_env_t {
ir_node *true_block;
ir_node *cmp; /**< The Compare node that might be partial evaluated */
......@@ -455,6 +468,8 @@ static ir_node *find_const_or_confirm(jumpthreading_env_t *env, ir_node *jump,
/* adjust true_block to point directly towards our jump */
add_pred(env->true_block, jump);
split_critical_edge(env->true_block, 0);
/* we need a bigger visited nr when going back */
env->visited_nr++;
......@@ -518,6 +533,8 @@ static ir_node *find_candidate(jumpthreading_env_t *env, ir_node *jump,
/* adjust true_block to point directly towards our jump */
add_pred(env->true_block, jump);
split_critical_edge(env->true_block, 0);
/* we need a bigger visited nr when going back */
env->visited_nr++;
......
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