public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion
       [not found] <bug-43423-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-20  2:47 ` pinskia at gcc dot gnu.org
  2021-09-14  6:34 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-20  2:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Severity|normal                      |enhancement
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The improvement in comment #12 is something which I am working on.

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

* [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion
       [not found] <bug-43423-4@http.gcc.gnu.org/bugzilla/>
  2021-07-20  2:47 ` [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion pinskia at gcc dot gnu.org
@ 2021-09-14  6:34 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-14  6:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |7.0
             Status|ASSIGNED                    |RESOLVED

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So GCC 7 is able to optimize this loop fully and split it into two at -O3
(r7-3966) after my comment #12.

Also starting with GCC 7, we were able to vectorize the loop at -O2
-ftree-vectorize since tree-if-conv.c can do the ifconversion (I don't have the
revision).

So this is all fixed anyways.

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

* [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion
  2010-03-18 18:01 [Bug c/43423] New: gcc should vectorize this loop through "iteration range splitting" changpeng dot fang at amd dot com
                   ` (4 preceding siblings ...)
  2010-05-24 23:02 ` spop at gcc dot gnu dot org
@ 2010-05-25 23:33 ` spop at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-05-25 23:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from spop at gcc dot gnu dot org  2010-05-25 23:33 -------
This is not a IV type problem: the number of iterations may be zero when mid ==
0 or mid == n, so the number of iterations analysis has a condition under which
niter may_be_zero.

I sent out a patch that makes niter return a COND_EXPR
instead of a chrec_dont_know:
http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01927.html

With that patch I now get 
  note: not vectorized: data ref analysis failed D.2726_51 = a[var.9_55];


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43423


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

* [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion
  2010-03-18 18:01 [Bug c/43423] New: gcc should vectorize this loop through "iteration range splitting" changpeng dot fang at amd dot com
                   ` (3 preceding siblings ...)
  2010-05-24 22:47 ` changpeng dot fang at amd dot com
@ 2010-05-24 23:02 ` spop at gcc dot gnu dot org
  2010-05-25 23:33 ` spop at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-05-24 23:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from spop at gcc dot gnu dot org  2010-05-24 23:02 -------
note: not vectorized: number of iterations cannot be computed.

Graphite has a problem with the generation of induction variables types
that makes the code harder to analyze after Graphite.  I will try to get this
fixed to make this loop vectorized with the iteration range splitting that
Graphite does by default. 

Sebastian


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43423


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

* [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion
  2010-03-18 18:01 [Bug c/43423] New: gcc should vectorize this loop through "iteration range splitting" changpeng dot fang at amd dot com
                   ` (2 preceding siblings ...)
  2010-05-24 22:44 ` spop at gcc dot gnu dot org
@ 2010-05-24 22:47 ` changpeng dot fang at amd dot com
  2010-05-24 23:02 ` spop at gcc dot gnu dot org
  2010-05-25 23:33 ` spop at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-05-24 22:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from changpeng dot fang at amd dot com  2010-05-24 22:47 -------
(In reply to comment #8)
> -fgraphite-identity does iteration splitting for this case.

Do you know why it could not be vectorized after iteration 
range splitting?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43423


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

* [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion
  2010-03-18 18:01 [Bug c/43423] New: gcc should vectorize this loop through "iteration range splitting" changpeng dot fang at amd dot com
  2010-04-08 17:47 ` [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion spop at gcc dot gnu dot org
  2010-05-07 21:41 ` changpeng dot fang at amd dot com
@ 2010-05-24 22:44 ` spop at gcc dot gnu dot org
  2010-05-24 22:47 ` changpeng dot fang at amd dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-05-24 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from spop at gcc dot gnu dot org  2010-05-24 22:44 -------
-fgraphite-identity does iteration splitting for this case.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43423


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

* [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion
  2010-03-18 18:01 [Bug c/43423] New: gcc should vectorize this loop through "iteration range splitting" changpeng dot fang at amd dot com
  2010-04-08 17:47 ` [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion spop at gcc dot gnu dot org
@ 2010-05-07 21:41 ` changpeng dot fang at amd dot com
  2010-05-24 22:44 ` spop at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-05-07 21:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from changpeng dot fang at amd dot com  2010-05-07 21:41 -------
(In reply to comment #4)
> (In reply to comment #3)
> > Subject: Re:  gcc should vectorize this loop 
> >         through "iteration range splitting"
> > You mean that the problem is the if-conversion of the stores
> > "a[i] = ..."
> 
> If we rewrite the code like:
> int a[100], b[100], c[100];
> 
> void foo(int n, int mid)
> {
>   int i;
>   for(i=0; i<n; i++)
>     {
>       int t;
>       int ai = a[i], bi = b[i], ci = c[i];
>       if (i < mid)
>         t = ai + bi;
>       else
>         t = ai + ci;
>       a[i] = t;
>     }
> }
> 
> --- CUT ---
> This gets vectorized as we produce an if-cvt first.
> 

There are both correctness and performance issues in the re-written code.
b[i] or c[i] may not be executed in the original loop.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43423


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

* [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion
  2010-03-18 18:01 [Bug c/43423] New: gcc should vectorize this loop through "iteration range splitting" changpeng dot fang at amd dot com
@ 2010-04-08 17:47 ` spop at gcc dot gnu dot org
  2010-05-07 21:41 ` changpeng dot fang at amd dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: spop at gcc dot gnu dot org @ 2010-04-08 17:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from spop at gcc dot gnu dot org  2010-04-08 17:47 -------
I changed the title of this bug to match the comments in the PR:
we should vectorize this loop using if-conversion, and not "iteration
range splitting".

Also note that in general, by doing an "iteration range splitting" the data 
locality in the two loops could be worse than in the if-converted loop.


-- 

spop at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|gcc should vectorize this   |gcc should vectorize this
                   |loop through "iteration     |loop through if-conversion
                   |range splitting"            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43423


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

end of thread, other threads:[~2021-09-14  6:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-43423-4@http.gcc.gnu.org/bugzilla/>
2021-07-20  2:47 ` [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion pinskia at gcc dot gnu.org
2021-09-14  6:34 ` pinskia at gcc dot gnu.org
2010-03-18 18:01 [Bug c/43423] New: gcc should vectorize this loop through "iteration range splitting" changpeng dot fang at amd dot com
2010-04-08 17:47 ` [Bug tree-optimization/43423] gcc should vectorize this loop through if-conversion spop at gcc dot gnu dot org
2010-05-07 21:41 ` changpeng dot fang at amd dot com
2010-05-24 22:44 ` spop at gcc dot gnu dot org
2010-05-24 22:47 ` changpeng dot fang at amd dot com
2010-05-24 23:02 ` spop at gcc dot gnu dot org
2010-05-25 23:33 ` spop at gcc dot gnu dot 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).