Patchwork Incorporate INLINE_HINT_array_index in IPA-CP heuristics

login
register
mail settings
Submitter Martin Jambor
Date March 19, 2013, 12:41 p.m.
Message ID <20130319124123.GA4334@virgil.suse>
Download mbox | patch
Permalink /patch/229380/
State New
Headers show

Comments

Martin Jambor - March 19, 2013, 12:41 p.m.
Hi,

either it was added very late or I simply missed it in last stage1,
but currently IPA-CP does not use INLINE_HINT_array_index in any way.
This patch incorporates it to heuristics computations.  I chose the
bonus value to simply be slightly smaller than the bonuses for known
strides and sizes, I plan to re-examine them once we have better
aggregate jump functions and we start getting these hints in real
Fortran benchmarks.

Bootstrapped and tested on x86_64-linux.  OK for trunk?

Thanks,

Martin


2013-01-21  Martin Jambor  <mjambor@suse.cz>

	* params.def (PARAM_IPA_CP_ARRAY_INDEX_HINT_BONUS): New parameter.
	* ipa-cp.c (hint_time_bonus): Add abonus for known array indices.
Jan Hubicka - March 20, 2013, 3:01 p.m.
> Hi,
> 
> either it was added very late or I simply missed it in last stage1,
> but currently IPA-CP does not use INLINE_HINT_array_index in any way.
> This patch incorporates it to heuristics computations.  I chose the
> bonus value to simply be slightly smaller than the bonuses for known
> strides and sizes, I plan to re-examine them once we have better
> aggregate jump functions and we start getting these hints in real
> Fortran benchmarks.
> 
> Bootstrapped and tested on x86_64-linux.  OK for trunk?
OK,
Thanks!
Honza

Patch

Index: src/gcc/ipa-cp.c
===================================================================
--- src.orig/gcc/ipa-cp.c
+++ src/gcc/ipa-cp.c
@@ -1606,9 +1606,12 @@  devirtualization_time_bonus (struct cgra
 static int
 hint_time_bonus (inline_hints hints)
 {
+  int result = 0;
   if (hints & (INLINE_HINT_loop_iterations | INLINE_HINT_loop_stride))
-    return PARAM_VALUE (PARAM_IPA_CP_LOOP_HINT_BONUS);
-  return 0;
+    result += PARAM_VALUE (PARAM_IPA_CP_LOOP_HINT_BONUS);
+  if (hints & INLINE_HINT_array_index)
+    result += PARAM_VALUE (PARAM_IPA_CP_ARRAY_INDEX_HINT_BONUS);
+  return result;
 }
 
 /* Return true if cloning NODE is a good idea, given the estimated TIME_BENEFIT
Index: src/gcc/params.def
===================================================================
--- src.orig/gcc/params.def
+++ src/gcc/params.def
@@ -919,6 +919,12 @@  DEFPARAM (PARAM_IPA_CP_LOOP_HINT_BONUS,
 	  "bounds or strides known.",
 	  64, 0, 0)
 
+DEFPARAM (PARAM_IPA_CP_ARRAY_INDEX_HINT_BONUS,
+	  "ipa-cp-array-index-hint-bonus",
+	  "Compile-time bonus IPA-CP assigns to candidates which make an array "
+	  "index known.",
+	  48, 0, 0)
+
 /* WHOPR partitioning configuration.  */
 
 DEFPARAM (PARAM_LTO_PARTITIONS,