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

            Bug ID: 126306
           Summary: BB SLP build force-fails too early because of
                    unrolling
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
            Blocks: 53947
  Target Milestone: ---

The testcase in PR126053 shows that we fail prematurely during SLP discovery:

t.ii:67:20: note:   starting SLP discovery for node 0x567f820
t.ii:67:20: note:   get vectype for scalar type (group size 12): BigReal
t.ii:67:20: note:   vectype: vector(8) double
t.ii:67:20: note:   nunits = 8
t.ii:67:20: missed:   Build SLP failed: unrolling required in basic block SLP
t.ii:67:20: note:   Build SLP for *reduction_124(D) = _65;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 8B] = _67;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 16B] = _69;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 24B] = _71;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 32B] = _73;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 40B] = _75;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 48B] = _77;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 56B] = _79;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 64B] = _81;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 72B] = _83;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 80B] = _85;
t.ii:67:20: note:   Build SLP for MEM[(BigReal *)reduction_124(D) + 88B] = _87;
t.ii:67:20: note:   SLP discovery for node 0x567f820 failed
t.ii:67:20: note:   Splitting SLP group at stmt 8
t.ii:67:20: note:   Split group into 8 and 4

but the store itself would pass discovery just fine.  The next node
would reveal a more suitable split point:

  _67 = _66 + virial_xy_252;
  _69 = _68 + virial_xz_258;
  _71 = _70 + virial_yy_264;
  _73 = _72 + virial_yz_270;
  _75 = _74 + virial_zz_276;
  _77 = _76 + 0.0;
  _79 = _78 + 0.0;
  _81 = _80 + 0.0;
  _83 = _82 + 0.0;
  _85 = _84 + 0.0;
  _87 = _86 + 0.0;

The idea is to delay failing due to unrolling for longer, giving the chance
to yield an appropriate fail matches[] (but once soft-failed, no longer
consider building ops from scalars).

This might or might not be easier than PR126080


Referenced Bugs:

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

Reply via email to