Skip a single downconv even if it has multiple users.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 1 Aug 2008 08:14:28 +0000 (08:14 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 1 Aug 2008 08:14:28 +0000 (08:14 +0000)
[r20878]

ir/opt/convopt.c

index 4ac59be..ca983f0 100644 (file)
@@ -106,6 +106,12 @@ int get_conv_costs(const ir_node *node, ir_mode *dest_mode)
                return conv_const_tv(node, dest_mode) == tarval_bad ? 1 : 0;
        }
 
+       if (is_Conv(node) &&
+                       is_downconv(get_irn_mode(node), dest_mode) &&
+                       get_irn_mode(get_Conv_op(node)) == dest_mode) {
+               return -1;
+       }
+
        if (get_irn_n_edges(node) > 1) {
                DB((dbg, LEVEL_3, "multi outs at %+F\n", node));
                return 1;
@@ -175,6 +181,12 @@ ir_node *conv_transform(ir_node *node, ir_mode *dest_mode)
                }
        }
 
+       if (is_Conv(node) &&
+                       is_downconv(get_irn_mode(node), dest_mode) &&
+                       get_irn_mode(get_Conv_op(node)) == dest_mode) {
+               return get_Conv_op(node);
+       }
+
        if (get_irn_n_edges(node) > 1) {
                return place_conv(node, dest_mode);
        }