+ set_irn_link(node, copy);
+ set_irn_visited(node, env->visited_nr);
+
+ /* we might hit values in blocks that have already been processed by a
+ * recursive find_phi_with_const call */
+ assert(get_irn_visited(copy) <= env->visited_nr);
+ if(get_irn_visited(copy) >= env->visited_nr) {
+ ir_node *prev_copy = get_irn_link(copy);
+ if(prev_copy != NULL)
+ set_irn_link(node, prev_copy);
+ }
+ }
+
+ /* fix data-flow (and reconstruct SSA if needed) */
+ foreach_out_edge(block, edge) {
+ ir_node *vals[2];
+ ir_node *blocks[2];
+
+ ir_node *node = get_edge_src_irn(edge);
+
+ if (get_irn_mode(node) == mode_X)
+ continue;
+
+ blocks[0] = block;
+ vals[0] = node;
+ blocks[1] = copy_block;
+ vals[1] = get_irn_link(node);
+ construct_ssa(blocks, vals, 2);
+ }
+}
+
+static int eval_cmp(pn_Cmp pnc, tarval *tv1, tarval *tv2) {
+ pn_Cmp cmp_result = tarval_cmp(tv1, tv2);
+
+ // does the compare evaluate to true?
+ if(cmp_result == pn_Cmp_False)
+ return 0;
+ if((cmp_result & pnc) != cmp_result)
+ return 0;
+
+ return 1;
+}
+
+static ir_node *find_phi_with_const(ir_node *jump, ir_node *value, condeval_env_t *env) {
+ ir_node *block = get_nodes_block(jump);
+
+ if(irn_visited(value))
+ return NULL;
+ mark_irn_visited(value);
+
+ if(is_Const(value)) {
+ tarval *tv_const = get_Const_tarval(env->cnst);
+ tarval *tv = get_Const_tarval(value);
+
+ if(!eval_cmp(env->pnc, tv, tv_const))
+ return NULL;