Rework Block labels: They are entities now so we don't need a special symconst type...
[libfirm] / ir / lower / lower_dw.c
index d0f26d7..bc5493f 100644 (file)
@@ -120,9 +120,7 @@ typedef struct _lower_env_t {
        const lwrdw_param_t *params;  /**< transformation parameter */
        unsigned flags;               /**< some flags */
        int      n_entries;           /**< number of entries */
-#ifndef NDEBUG
        ir_type  *value_param_tp;     /**< the old value param type */
-#endif
 } lower_env_t;
 
 /**
@@ -2286,16 +2284,18 @@ static void lower_ASM(ir_node *asmn, ir_mode *mode, lower_env_t *env) {
  * Translate a Sel node.
  */
 static void lower_Sel(ir_node *sel, ir_mode *mode, lower_env_t *env) {
-       ir_node *ptr = get_Sel_ptr(sel);
+       (void) mode;
 
-       if (ptr == get_irg_value_param_base(current_ir_graph)) {
+       /* we must only lower value parameter Sels if we change the
+          value parameter type. */
+       if (env->value_param_tp != NULL) {
                ir_entity *ent = get_Sel_entity(sel);
-               int       pos  = PTR_TO_INT(get_entity_link(ent));
-
-               assert(get_entity_owner(ent) == env->value_param_tp);
+           if (get_entity_owner(ent) == env->value_param_tp) {
+                       int pos = PTR_TO_INT(get_entity_link(ent));
 
-               ent = get_method_value_param_ent(env->l_mtp, pos);
-               set_Sel_entity(sel, ent);
+                       ent = get_method_value_param_ent(env->l_mtp, pos);
+                       set_Sel_entity(sel, ent);
+               }  /* if */
        }  /* if */
 }  /* lower_Sel */
 
@@ -2659,9 +2659,7 @@ void lower_dw_ops(const lwrdw_param_t *param)
                lenv.l_mtp        = NULL;
                lenv.flags        = 0;
                lenv.proj_2_block = pmap_create();
-#ifndef NDEBUG
                lenv.value_param_tp = NULL;
-#endif
                ir_reserve_resources(irg, IR_RESOURCE_PHI_LIST | IR_RESOURCE_IRN_LINK);
 
                ent = get_irg_entity(irg);
@@ -2672,9 +2670,7 @@ void lower_dw_ops(const lwrdw_param_t *param)
                        lenv.flags |= MUST_BE_LOWERED;
                        set_entity_type(ent, ltp);
                        lenv.l_mtp = ltp;
-#ifndef NDEBUG
                        lenv.value_param_tp = get_method_value_param_type(mtp);
-#endif
                }  /* if */
 
                /* first step: link all nodes and allocate data */