simplify Sel lowering code
[libfirm] / ir / ana / irconsconfirm.c
index fd70021..c2821fb 100644 (file)
@@ -57,7 +57,7 @@ typedef struct env_t {
 DEBUG_ONLY(static firm_dbg_module_t *dbg;)
 
 /**
- * Return the effective use block of a node and it's predecessor on
+ * Return the effective use block of a node and its predecessor on
  * position pos.
  *
  * @param node  the node
@@ -319,7 +319,7 @@ static void handle_if(ir_node *block, ir_node *cmp, ir_relation rel, env_t *env)
                                                /*
                                                 * The user of the user is dominated by our true/false
                                                 * block. So, create a copy of user WITH the constant
-                                                * replacing it's pos'th input.
+                                                * replacing its pos'th input.
                                                 *
                                                 * This is always good for unop's and might be good
                                                 * for binops.
@@ -428,29 +428,23 @@ static void insert_Confirm_in_block(ir_node *block, void *data)
        mode = get_irn_mode(selector);
 
        if (mode == mode_b) {
-               ir_node *cmp;
                ir_relation rel;
 
                handle_modeb(block, selector, (pn_Cond) get_Proj_proj(proj), env);
 
-               /* this should be an IF, check this */
-               if (! is_Proj(selector))
+               if (! is_Cmp(selector))
                        return;
 
-               cmp = get_Proj_pred(selector);
-               if (! is_Cmp(cmp))
-                       return;
-
-               rel = get_Cmp_relation(cmp);
+               rel = get_Cmp_relation(selector);
 
                if (get_Proj_proj(proj) != pn_Cond_true) {
                        /* it's the false branch */
-                       mode = get_irn_mode(get_Cmp_left(cmp));
+                       mode = get_irn_mode(get_Cmp_left(selector));
                        rel = get_negated_relation(rel);
                }
-               DB((dbg, LEVEL_2, "At %+F using %+F Confirm %=\n", block, cmp, rel));
+               DB((dbg, LEVEL_2, "At %+F using %+F Confirm %=\n", block, selector, rel));
 
-               handle_if(block, cmp, rel, env);
+               handle_if(block, selector, rel, env);
        } else if (mode_is_int(mode)) {
                long proj_nr = get_Proj_proj(proj);