- else {
- if (out_op == op_Cmp && !is_loop_invariant(out, loop_head)){
- cmp_pred_bl = get_irn_out(out, 0);
- cmp_pred_bl = get_irn_out(cmp_pred_bl, 0);
- cond_succ_true = get_irn_out(cmp_pred_bl, 1);
- cond_succ_false = get_irn_out(cmp_pred_bl, 0);
- if(is_loop_invariant(get_irn_out(cond_succ_false, 0), loop_head) ||
- is_loop_invariant(get_irn_out(cond_succ_true, 0), loop_head)){
- if (get_Cmp_left(out) == info->op)
- cmp_const = get_Cmp_right(out);
- else
- cmp_const = get_Cmp_left(out);
- }
- else
- continue;
-
- if (info->cmp == NULL) {
- info->cmp = out;
- info->cmp_const = cmp_const;
- set_irn_link(info->cmp_const, (void *) 1);
- }
- else {
- info->cmp = NULL;
- return NULL;
+ else if (out_op == op_Cmp && !is_loop_invariant(out, loop_head)) {
+ /* "Cmp" can have more as one successor therefore
+ i need this for loop.*/
+ for (q = get_irn_n_outs(out) - 1; q >= 0; --q) {
+ ir_node *proj = get_irn_out(out, q);
+
+ for (r = get_irn_n_outs(proj) -1; r >= 0; --r) {
+ cmp_pred_bl = get_irn_out(proj, r);
+
+ /* The wanted "Cmp" must be followed with a "Cond" successor. */
+ if (get_irn_op(cmp_pred_bl) != op_Cond)
+ continue;
+
+ cond_succ_0 = get_irn_out(cmp_pred_bl, 0);
+ cond_succ_1 = get_irn_out(cmp_pred_bl, 1);
+
+ if (is_loop_invariant(get_irn_out(cond_succ_0, 0), loop_head) ||
+ is_loop_invariant(get_irn_out(cond_succ_1, 0), loop_head)) {
+ if (get_Cmp_left(out) == info->op)
+ cmp_const = get_Cmp_right(out);
+ else
+ cmp_const = get_Cmp_left(out);
+ } else
+ continue;
+ if (info->cmp == NULL) {
+ info->cmp = out;
+ info->cmp_const = cmp_const;
+ }
+ else {
+ info->cmp = NULL;
+ return NULL;
+ }