public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110451] New: LIM fails to hoist comparisons
@ 2023-06-28 11:00 rguenth at gcc dot gnu.org
  2023-06-28 11:01 ` [Bug tree-optimization/110451] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-28 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110451
           Summary: LIM fails to hoist comparisons
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

For SPEC bwaves or gfortran.dg/pr81303.f we interchange the loop nest which
produces a conditional in the innermost loop like the following to handle
a reduction with invariant initialization:

  <bb 14> [local count: 955630226]:
  # l_93 = PHI <l_94(21), 1(13)>
  # ivtmp_58 = PHI <ivtmp_84(21), _85(13)>
  _30 = (integer(kind=8)) l_93;
  _31 = _29 + _30;
  y__I_lsm.120_22 = (*y_139(D))[_31];
  _23 = m_95 != 1;
  y__I_lsm.120_33 = _23 ? y__I_lsm.120_22 : 0.0;
  _42 = _30 + _41;
  _43 = (*a_141(D))[_42];

currently the LIM cost modeling finds it not profitable to hoist the
invariant m_95 != 1 compare.  This causes vectorization to choose
a larger vectorization factor to accomodate vectorizing this compare.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/110451] LIM fails to hoist comparisons
  2023-06-28 11:00 [Bug tree-optimization/110451] New: LIM fails to hoist comparisons rguenth at gcc dot gnu.org
@ 2023-06-28 11:01 ` rguenth at gcc dot gnu.org
  2023-06-28 13:05 ` cvs-commit at gcc dot gnu.org
  2023-06-28 13:09 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-28 11:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |missed-optimization
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2023-06-28
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/110451] LIM fails to hoist comparisons
  2023-06-28 11:00 [Bug tree-optimization/110451] New: LIM fails to hoist comparisons rguenth at gcc dot gnu.org
  2023-06-28 11:01 ` [Bug tree-optimization/110451] " rguenth at gcc dot gnu.org
@ 2023-06-28 13:05 ` cvs-commit at gcc dot gnu.org
  2023-06-28 13:09 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-28 13:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:237e83e2158a3d9b875f8775805d04d97e8b36c1

commit r14-2161-g237e83e2158a3d9b875f8775805d04d97e8b36c1
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 28 13:36:59 2023 +0200

    tree-optimization/110451 - hoist invariant compare after interchange

    The following adjusts the cost model of invariant motion to consider
    [VEC_]COND_EXPRs and comparisons producing a data value as expensive.
    For 503.bwaves_r this avoids an unnecessarily high vectorization
    factor because of an integer comparison besides data operations on
    double.

            PR tree-optimization/110451
            * tree-ssa-loop-im.cc (stmt_cost): [VEC_]COND_EXPR and
            tcc_comparison are expensive.

            * gfortran.dg/vect/pr110451.f: New testcase.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/110451] LIM fails to hoist comparisons
  2023-06-28 11:00 [Bug tree-optimization/110451] New: LIM fails to hoist comparisons rguenth at gcc dot gnu.org
  2023-06-28 11:01 ` [Bug tree-optimization/110451] " rguenth at gcc dot gnu.org
  2023-06-28 13:05 ` cvs-commit at gcc dot gnu.org
@ 2023-06-28 13:09 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-28 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-28 13:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 11:00 [Bug tree-optimization/110451] New: LIM fails to hoist comparisons rguenth at gcc dot gnu.org
2023-06-28 11:01 ` [Bug tree-optimization/110451] " rguenth at gcc dot gnu.org
2023-06-28 13:05 ` cvs-commit at gcc dot gnu.org
2023-06-28 13:09 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).