https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68238

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-11-09
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Interesting.  The trunk patch wasn't supposed to change behavior ;)

Btw, confirmed on x86_64 for the 5 branch:

slp-costs.c:7:3: note: Cost model analysis:
  Vector inside of loop cost: 32
  Vector prologue cost: 1033
  Vector epilogue cost: 0
  Scalar iteration cost: 64
  Scalar outside cost: 1
  Vector outside cost: 1033
  prologue iterations: 0
  epilogue iterations: 0
  Calculated minimum iters for profitability: 33


Ah, the fix that sneaked in and to be backported is

        * tree-vect-loop.c (new_loop_vec_info):
...
        (vect_estimate_min_profitable_iters): Use LOOP_VINFO_COMP_ALIAS_DDRS
        to estimate alias versioning cost.

which is very simple.

Breakpoint 5, vect_estimate_min_profitable_iters (loop_vinfo=0x22847b0, 
    ret_min_profitable_niters=0x7fffffffd7f0, 
    ret_min_profitable_estimate=0x7fffffffd7ec)
    at /space/rguenther/src/svn/gcc-5-branch/gcc/tree-vect-loop.c:2828
2828          unsigned len = LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo).length ();
(gdb) n
2830                                vect_prologue);
(gdb) p len
$1 = 1024
(gdb) p loop_vinfo->comp_alias_ddrs.m_vec->m_vecpfx
$3 = {m_alloc = 1024, m_using_auto_storage = 0, m_num = 1}

so only one check is actually added but we account for 1024...

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c        (revision 229701)
+++ gcc/tree-vect-loop.c        (working copy)
@@ -2825,7 +2825,7 @@ vect_estimate_min_profitable_iters (loop
   if (LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo))
     {
       /*  FIXME: Make cost depend on complexity of individual check.  */
-      unsigned len = LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo).length ();
+      unsigned len = LOOP_VINFO_COMP_ALIAS_DDRS (loop_vinfo).length ();
       (void) add_stmt_cost (target_cost_data, len, vector_stmt, NULL, 0,
                            vect_prologue);
       dump_printf (MSG_NOTE,

backport pre-approved.  With the above patch:

slp-costs.c:7:3: note: Cost model analysis:
  Vector inside of loop cost: 32
  Vector prologue cost: 10
  Vector epilogue cost: 0
  Scalar iteration cost: 64
  Scalar outside cost: 1
  Vector outside cost: 10
  prologue iterations: 0
  epilogue iterations: 0
  Calculated minimum iters for profitability: 1

Reply via email to