public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not
@ 2010-10-13 16:54 jakub at gcc dot gnu.org
  2010-10-13 16:59 ` [Bug tree-optimization/46009] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-10-13 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ?: vectorized, very similar if is not
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: irar@gcc.gnu.org


void bar (int *);
void foo (int *a, int *b, int *c, int *d)
{
  int e[1024], i, g;
  for (i = 0; i < 1024; i++)
    {
      g = a[i] + b[i] + c[i] * d[i];;
#ifdef WORKS
      e[i] = g < 10 ? 1 : g;
#else
      if (g < 10)
        e[i] = 1;
      else
        e[i] = g;
#endif
    }
  bar (e);
}

is vectorized only if -DWORKS -O3, but not for -O3, although the code is really
identical.  Not sure if ifcvt should handle this, or instead some earlier pass
should detect that both bbs have the same memory destination and change
  if (g_25 <= 9)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:
  e[i_14] = 1;
  goto <bb 6>;

<bb 5>:
  e[i_14] = g_25;

<bb 6>:

into an unconditional assignment of a PHI result into e[i].


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

* [Bug tree-optimization/46009] ?: vectorized, very similar if is not
  2010-10-13 16:54 [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not jakub at gcc dot gnu.org
@ 2010-10-13 16:59 ` pinskia at gcc dot gnu.org
  2010-11-03 11:11 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-10-13 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-10-13 16:59:28 UTC ---
Related to PR 21998.


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

* [Bug tree-optimization/46009] ?: vectorized, very similar if is not
  2010-10-13 16:54 [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not jakub at gcc dot gnu.org
  2010-10-13 16:59 ` [Bug tree-optimization/46009] " pinskia at gcc dot gnu.org
@ 2010-11-03 11:11 ` jakub at gcc dot gnu.org
  2010-11-03 12:01 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-03 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2010.11.03 11:11:40
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-03 11:11:40 UTC ---
Created attachment 22245
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22245
gcc46-pr46009.patch

Untested fix.

As discussed on IRC, this is something that can be handled either in store
sinking pass, or in cselim (which has some infrastructure for it), or both.

This patch implements it in cselim.


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

* [Bug tree-optimization/46009] ?: vectorized, very similar if is not
  2010-10-13 16:54 [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not jakub at gcc dot gnu.org
  2010-10-13 16:59 ` [Bug tree-optimization/46009] " pinskia at gcc dot gnu.org
  2010-11-03 11:11 ` jakub at gcc dot gnu.org
@ 2010-11-03 12:01 ` jakub at gcc dot gnu.org
  2010-11-03 15:19 ` jakub at gcc dot gnu.org
  2011-08-25 15:55 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-03 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #22245|0                           |1
        is obsolete|                            |

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-03 12:01:18 UTC ---
Created attachment 22247
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22247
gcc46-pr46009.patch

Updated patch for richi's comments on IRC.


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

* [Bug tree-optimization/46009] ?: vectorized, very similar if is not
  2010-10-13 16:54 [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2010-11-03 12:01 ` jakub at gcc dot gnu.org
@ 2010-11-03 15:19 ` jakub at gcc dot gnu.org
  2011-08-25 15:55 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-03 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-03 15:18:55 UTC ---
Author: jakub
Date: Wed Nov  3 15:18:50 2010
New Revision: 166251

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166251
Log:
    PR tree-optimization/46009
    * tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Call
    cond_if_else_store_replacement if bb1 and bb2 have the same
    single successor.
    (cond_store_replacement): Use gimple_assign_single_p, don't
    check if rhs is SSA_NAME or invariant.  Call release_defs for
    assign.
    (cond_if_else_store_replacement): New function.

    * gcc.dg/vect/pr46009.c: New function.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr46009.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-phiopt.c


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

* [Bug tree-optimization/46009] ?: vectorized, very similar if is not
  2010-10-13 16:54 [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2010-11-03 15:19 ` jakub at gcc dot gnu.org
@ 2011-08-25 15:55 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2011-08-25 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

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

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2011-08-25 15:37:02 UTC ---
Fixed.


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

end of thread, other threads:[~2011-08-25 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-13 16:54 [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not jakub at gcc dot gnu.org
2010-10-13 16:59 ` [Bug tree-optimization/46009] " pinskia at gcc dot gnu.org
2010-11-03 11:11 ` jakub at gcc dot gnu.org
2010-11-03 12:01 ` jakub at gcc dot gnu.org
2010-11-03 15:19 ` jakub at gcc dot gnu.org
2011-08-25 15:55 ` hjl.tools at gmail dot com

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).