* doc/invoke.texi (comdat-sharing-probability): Document.
* ipa-inline.c (cgraph_estimate_growth): Handle COMDATs
* params.def (PARAM_COMDAT_SHARING_PROBABILITY): New param.
* g++.dg/tree-ssa/pr46228.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166555
138bc75d-0d04-0410-961f-
82ee72b054a4
indirect calls early inliner can resolve. Deeper chains are still handled by
late inlining.
+@item comdat-sharing-probability
+@itemx comdat-sharing-probability
+Probability (in percent) that C++ inline function with comdat visibility
+will be shared acroess multiple compilation units. The default value is 20.
+
@item min-vect-loop-bound
The minimum number of iterations under which a loop will not get vectorized
when @option{-ftree-vectorize} is used. The number of iterations after
if (cgraph_will_be_removed_from_program_if_no_direct_calls (node)
&& !DECL_EXTERNAL (node->decl) && !self_recursive)
growth -= node->global.size;
+ /* COMDAT functions are very often not shared across multiple units since they
+ come from various template instantiations. Take this into account. */
+ else if (DECL_COMDAT (node->decl) && !self_recursive
+ && cgraph_can_remove_if_no_direct_calls_p (node))
+ growth -= (node->global.size
+ * (100 - PARAM_VALUE (PARAM_COMDAT_SHARING_PROBABILITY)) + 50) / 100;
node->global.estimated_growth = growth;
return growth;
10, 0, 0)
/* Limit on probability of entry BB. */
+DEFPARAM (PARAM_COMDAT_SHARING_PROBABILITY,
+ "comdat-sharing-probability",
+ "Probability that COMDAT function will be shared with different compilatoin unit",
+ 20, 0, 0)
+
+/* Limit on probability of entry BB. */
DEFPARAM (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY,
"partial-inlining-entry-probability",
"Maximum probability of the entry BB of split region (in percent relative to entry BB of the function) to make partial inlining happen",
+2010-11-10 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimize/46228
+ * g++.dg/tree-ssa/pr46228.C: New testcase.
+
2010-11-10 H.J. Lu <hongjiu.lu@intel.com>
PR tree-optimization/46414
--- /dev/null
+// { dg-options "-fdump-tree-optimized -Os" }
+#include <set>
+#include <stdio.h>
+
+int main()
+{
+ static const int array[] = { 1,2,3,4,5,6,7,8,9,10,6 };
+ std::set<int> the_set;
+ int count = 0;
+ for (unsigned i = 0; i < sizeof(array)/sizeof(*array); i++)
+ {
+ std::pair<std::set<int>::iterator, bool> result =
+ the_set.insert(array[i]);
+ if (result.second)
+ count++;
+ }
+ printf("%d unique items in array.\n", count);
+ return 0;
+}
+
+// This function is small enough to be inlined even at -Os.
+// { dg-final { scan-tree-dump-not "_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEED2Ev" "optimized" } }
+// { dg-final { cleanup-tree-dump "optimized" } }