- // Search for loop invariant of Cmp.
- if (info->cmp != NULL){
- if (get_Cmp_left(info->cmp) == info->itervar_phi)
- info->cmp_const = get_Cmp_right(info->cmp);
- else
- info->cmp_const = get_Cmp_left(info->cmp);
+ if (out_op == op_Store)
+ Store_in_op++;
+ else if (out_op == op_Cmp && !is_loop_invariant(out, loop_head)) {
+ /* a 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 by 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) {
+ /* A cmp is found*/
+ info->cmp = out;
+ info->cmp_const = cmp_const;
+ }
+ else {
+ /* We have more then one cmp with our requests, that mean cmp isn't found*/
+ info->cmp = NULL;
+ return NULL;
+ }
+ }
+ }
+ }
+ }
+
+ if ((info->phi_pred == 3 && op_pred == 1 && Store_in_phi == 0 && info->cmp != NULL) ||
+ (info->phi_pred == 2 && op_pred == 2 && Store_in_op == 0 && info->cmp != NULL ) ||
+ (info->phi_pred == 1 && Store_in_op == 0))
+ info->is_reducible = 1;