tree-inline.c (estimate_num_insns): Estimate call cost for tailcalls properly.
authorRichard Guenther <rguenther@suse.de>
Thu, 21 Jun 2012 09:24:53 +0000 (09:24 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 21 Jun 2012 09:24:53 +0000 (09:24 +0000)
2012-06-21  Richard Guenther  <rguenther@suse.de>

* tree-inline.c (estimate_num_insns): Estimate call cost for
tailcalls properly.

From-SVN: r188849

gcc/ChangeLog
gcc/tree-inline.c

index 543be452a170e5443a31b5f32be33581278e299a..42bddf93ff7bc46013e864cae2c368f6d143c7b7 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-21  Richard Guenther  <rguenther@suse.de>
+
+       * tree-inline.c (estimate_num_insns): Estimate call cost for
+       tailcalls properly.
+
 2012-06-20  RĂ¼diger Sonderfeld  <ruediger@c-plusplus.de>
 
        * tree.h (DECL_SOURCE_COLUMN): New accessor.
index 9a6db4040e95bed2d49aad7433eb910ab296f675..519cde42a445070446d8eb3dbd7077e6cdea020a 100644 (file)
@@ -3611,12 +3611,15 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
          }
 
        cost = node ? weights->call_cost : weights->indirect_call_cost;
-       if (gimple_call_lhs (stmt))
-         cost += estimate_move_cost (TREE_TYPE (gimple_call_lhs (stmt)));
-       for (i = 0; i < gimple_call_num_args (stmt); i++)
+       if (!gimple_call_tail_p (stmt))
          {
-           tree arg = gimple_call_arg (stmt, i);
-           cost += estimate_move_cost (TREE_TYPE (arg));
+           if (gimple_call_lhs (stmt))
+             cost += estimate_move_cost (TREE_TYPE (gimple_call_lhs (stmt)));
+           for (i = 0; i < gimple_call_num_args (stmt); i++)
+             {
+               tree arg = gimple_call_arg (stmt, i);
+               cost += estimate_move_cost (TREE_TYPE (arg));
+             }
          }
        break;
       }