[Bug tree-optimization/103941] uavgv2qi3_ceil is not used (SLP costing and patterns vs live stmts)

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 10 10:53:41 GMT 2022


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-* i?86-*-*
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2022-01-10
             Blocks|                            |53947
            Summary|uavgv2qi3_ceil is not used  |uavgv2qi3_ceil is not used
                   |                            |(SLP costing and patterns
                   |                            |vs live stmts)
           Keywords|                            |missed-optimization

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
t.c:8:11: note: Costing subgraph:
t.c:8:11: note: node 0x409a000 (max_nunits=2, refcnt=1)
t.c:8:11: note: op template: ur[0] = _23;
t.c:8:11: note:         stmt 0 ur[0] = _23;
t.c:8:11: note:         stmt 1 ur[1] = _35;
t.c:8:11: note:         children 0x409a088
t.c:8:11: note: node 0x409a088 (max_nunits=2, refcnt=1)
t.c:8:11: note: op template: patt_58 = (unsigned char) patt_56;
t.c:8:11: note:         stmt 0 patt_58 = (unsigned char) patt_56;
t.c:8:11: note:         stmt 1 patt_71 = (unsigned char) patt_69;
t.c:8:11: note:         children 0x409a110
t.c:8:11: note: node 0x409a110 (max_nunits=2, refcnt=1)
t.c:8:11: note: op template: patt_56 = .AVG_CEIL (_16, _18);
t.c:8:11: note:         stmt 0 patt_56 = .AVG_CEIL (_16, _18);
t.c:8:11: note:         stmt 1 patt_69 = .AVG_CEIL (_28, _30);
t.c:8:11: note:         children 0x409a220 0x409a198
t.c:8:11: note: node 0x409a220 (max_nunits=2, refcnt=1)
t.c:8:11: note: op template: _16 = ua[0];
t.c:8:11: note:         stmt 0 _16 = ua[0];
t.c:8:11: note:         stmt 1 _28 = ua[1];
t.c:8:11: note: node 0x409a198 (max_nunits=2, refcnt=1)
t.c:8:11: note: op template: _18 = ub[0];
t.c:8:11: note:         stmt 0 _18 = ub[0];
t.c:8:11: note:         stmt 1 _30 = ub[1];
t.c:8:11: note: Cost model analysis:
_23 1 times scalar_store costs 12 in body
_35 1 times scalar_store costs 12 in body
(unsigned char) _22 1 times scalar_stmt costs 4 in body
(unsigned char) _34 1 times scalar_stmt costs 4 in body
ua[0] 1 times vector_load costs 12 in body
ub[0] 1 times vector_load costs 12 in body
.AVG_CEIL (_16, _18) 1 times vector_stmt costs 4 in body
_23 1 times vector_store costs 12 in body
ua[0] 1 times vec_to_scalar costs 4 in epilogue
ua[1] 1 times vec_to_scalar costs 4 in epilogue
ub[0] 1 times vec_to_scalar costs 4 in epilogue
ub[1] 1 times vec_to_scalar costs 4 in epilogue
t.c:8:11: note: Cost model analysis for part in loop 0:
  Vector cost: 56
  Scalar cost: 32
t.c:8:11: missed: not vectorized: vectorization is not profitable.

it looks like somehow the scalar costing is off and the scalar loads from
ua and ub are considered live.  Possibly an artifact of patterns.

It's vectorized fine with -fno-vect-cost-model.

I will have a look, eventually not for GCC 12.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations


More information about the Gcc-bugs mailing list