fehler66 (more unsigned int -> double magic)
[libfirm] / ir / opt / convopt.c
index 30e94a6..f829095 100644 (file)
@@ -54,7 +54,7 @@
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg);
 
-static inline int min(int a, int b) { return a < b ? a : b; }
+static INLINE int imin(int a, int b) { return a < b ? a : b; }
 
 static
 int is_optimizable_node(const ir_node *node)
@@ -142,10 +142,11 @@ int get_conv_costs(const ir_node *node, ir_mode *dest_mode)
        }
 
        costs = 0;
-       arity = get_irn_arity(node);
+       // The shift count does not participate in the conv optimisation
+       arity = is_Shl(node) ? 1 : get_irn_arity(node);
        for (i = 0; i < arity; ++i) {
                ir_node *pred = get_irn_n(node, i);
-               costs += min(get_conv_costs(pred, dest_mode), 1);
+               costs += imin(get_conv_costs(pred, dest_mode), 1);
        }
 
        return costs;
@@ -192,7 +193,8 @@ ir_node *conv_transform(ir_node *node, ir_mode *dest_mode)
                return place_conv(node, dest_mode);
        }
 
-       arity = get_irn_arity(node);
+       // The shift count does not participate in the conv optimisation
+       arity = is_Shl(node) ? 1 : get_irn_arity(node);
        for (i = 0; i < arity; i++) {
                ir_node *pred = get_irn_n(node, i);
                ir_node *transformed;