public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/102756] [12 Regression] Complete unrolling is too senative to PRE; c-c++-common/torture/vector-compare-2.c
Date: Fri, 15 Oct 2021 00:29:27 +0000	[thread overview]
Message-ID: <bug-102756-4-bccNuN6UuP@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102756-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-10-15
           Keywords|                            |missed-optimization
            Summary|[12 Regression] Vectorizer  |[12 Regression] Complete
                   |change creates poor code    |unrolling is too senative
                   |for                         |to PRE;
                   |c-c++-common/torture/vector |c-c++-common/torture/vector
                   |-compare-2.c                |-compare-2.c
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
With -ftree-vectorize
size: 7-4, last_iteration: 7-4
  Loop size: 7
  Estimated size after unrolling: 8


  _1 = VIEW_CONVERT_EXPR<int[4]>(r)[i_10];


With -fno-tree-vectorize
size: 7-4, last_iteration: 6-4
  Loop size: 7
  Estimated size after unrolling: 7

  pretmp_2 = MEM[(vector(4) int *)&r][i_7];


Also -O2 -fno-tree-vectorize -fno-tree-pre produces the same as the -O2
-ftree-vectorize case.



------------------- CUT ----------------------------
Loop 1 iterates 3 times.
Loop 1 iterates at most 3 times.
Loop 1 likely iterates at most 3 times.
Estimating sizes for loop 1
 BB: 3, after_exit: 0
  size:   1 _1 = VIEW_CONVERT_EXPR<int[4]>(r)[i_10];
  size:   2 if (_1 != -3)
 BB: 7, after_exit: 1
 BB: 5, after_exit: 0
  size:   1 i_7 = i_10 + 1;
   Induction variable computation will be folded away.
  size:   1 ivtmp_9 = ivtmp_2 - 1;
   Induction variable computation will be folded away.
  size:   2 if (ivtmp_9 != 0)
   Exit condition will be eliminated in peeled copies.
   Exit condition will be eliminated in last copy.
   Constant conditional.
size: 7-4, last_iteration: 7-4
  Loop size: 7
  Estimated size after unrolling: 8
Not unrolling loop 1: size would grow.


vs:
Estimating sizes for loop 1
 BB: 3, after_exit: 0
  size:   2 if (prephitmp_9 != -3)
 BB: 6, after_exit: 1
  size:   1 pretmp_2 = MEM[(vector(4) int *)&r][i_7];
 BB: 5, after_exit: 0
  size:   1 i_7 = i_10 + 1;
   Induction variable computation will be folded away.
  size:   1 ivtmp_11 = ivtmp_1 - 1;
   Induction variable computation will be folded away.
  size:   2 if (ivtmp_11 != 0)
   Exit condition will be eliminated in peeled copies.
   Exit condition will be eliminated in last copy.
   Constant conditional.
size: 7-4, last_iteration: 6-4
  Loop size: 7
  Estimated size after unrolling: 7


PRE decides to do the load for MEM[(vector(4) int *)&r][0] which is why the
last iteration is 6-4 rather than 7-4.

  reply	other threads:[~2021-10-15  0:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15  0:16 [Bug tree-optimization/102756] New: [12 Regression] Vectorizer change creates poor code for c-c++-common/torture/vector-compare-2.c law at gcc dot gnu.org
2021-10-15  0:29 ` pinskia at gcc dot gnu.org [this message]
2021-10-15  0:29 ` [Bug tree-optimization/102756] [12 Regression] Complete unrolling is too senative to PRE; c-c++-common/torture/vector-compare-2.c pinskia at gcc dot gnu.org
2021-10-15  6:25 ` rguenth at gcc dot gnu.org
2021-10-15 14:44 ` law at gcc dot gnu.org
2021-11-17 16:28 ` law at gcc dot gnu.org
2021-11-17 16:29 ` law at gcc dot gnu.org
2022-01-19  8:22 ` rguenth at gcc dot gnu.org
2022-05-06  8:31 ` [Bug tree-optimization/102756] [12/13 " jakub at gcc dot gnu.org
2022-07-26 13:23 ` rguenth at gcc dot gnu.org
2023-05-08 12:22 ` [Bug tree-optimization/102756] [12/13/14 " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-102756-4-bccNuN6UuP@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).