public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23115] New: -ftree-vectorize generates wrong code
@ 2005-07-28 18:40 p dot van-hoof at qub dot ac dot uk
  2005-07-28 18:43 ` [Bug tree-optimization/23115] " p dot van-hoof at qub dot ac dot uk
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: p dot van-hoof at qub dot ac dot uk @ 2005-07-28 18:40 UTC (permalink / raw)
  To: gcc-bugs

The vectorizer generates wrong code for the attached example

dogbert> gcc o.c
dogbert> a.out
 this is where I should be (R = 1.0e+00)...
dogbert> gcc -O1 -ftree-vectorize o.c
dogbert> a.out
 I should not be here (R = -1.0e+300)...
dogbert> gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/usr/local/gcc410
--enable-languages=c,c++,f95
Thread model: posix
gcc version 4.1.0 20050725 (experimental)

This behavior shows up on the mainline, but not the 4.0 branch. I could
reproduce the problem on i686-pc-linux-gnu, x86_64-unknown-linux-gnu, and
sparc-sun-solaris2.9, so doesn't seem to be target specific.

-- 
           Summary: -ftree-vectorize generates wrong code
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: p dot van-hoof at qub dot ac dot uk
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/23115] -ftree-vectorize generates wrong code
  2005-07-28 18:40 [Bug tree-optimization/23115] New: -ftree-vectorize generates wrong code p dot van-hoof at qub dot ac dot uk
@ 2005-07-28 18:43 ` p dot van-hoof at qub dot ac dot uk
  2005-07-28 18:54 ` [Bug tree-optimization/23115] [4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: p dot van-hoof at qub dot ac dot uk @ 2005-07-28 18:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From p dot van-hoof at qub dot ac dot uk  2005-07-28 18:40 -------
Created an attachment (id=9380)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9380&action=view)
code that triggers the bug


-- 


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
  2005-07-28 18:40 [Bug tree-optimization/23115] New: -ftree-vectorize generates wrong code p dot van-hoof at qub dot ac dot uk
  2005-07-28 18:43 ` [Bug tree-optimization/23115] " p dot van-hoof at qub dot ac dot uk
@ 2005-07-28 18:54 ` pinskia at gcc dot gnu dot org
  2005-09-08 20:03 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-28 18:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-28 18:51 -------
This is caused by tree if conversion.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-28 18:51:44
               date|                            |
            Summary|-ftree-vectorize generates  |[4.1 Regression] -ftree-
                   |wrong code                  |vectorize generates wrong
                   |                            |code
   Target Milestone|---                         |4.1.0


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
  2005-07-28 18:40 [Bug tree-optimization/23115] New: -ftree-vectorize generates wrong code p dot van-hoof at qub dot ac dot uk
  2005-07-28 18:43 ` [Bug tree-optimization/23115] " p dot van-hoof at qub dot ac dot uk
  2005-07-28 18:54 ` [Bug tree-optimization/23115] [4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-09-08 20:03 ` pinskia at gcc dot gnu dot org
  2005-09-09 22:19 ` janis at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-08 20:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-08 20:03 -------
Before:
  if (x_16 < x_26) goto <L3>; else goto <L14>;

<L14>:;

  # x_4 = PHI <x_26(1), x_16(2)>;
<L3>:;
  if (x_16 > n_17) goto <L6>; else goto <L15>;

<L15>:;

  # n_5 = PHI <n_17(3), x_16(4)>;
<L6>:;

After:
  x_4 = x_16 < x_26 ? x_26 : x_16;
  n_5 = 1 ? n_17 : x_16;

That 1 is just wrong.

-- 


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
  2005-07-28 18:40 [Bug tree-optimization/23115] New: -ftree-vectorize generates wrong code p dot van-hoof at qub dot ac dot uk
                   ` (2 preceding siblings ...)
  2005-09-08 20:03 ` pinskia at gcc dot gnu dot org
@ 2005-09-09 22:19 ` janis at gcc dot gnu dot org
  2005-09-30 23:52 ` dpatel at apple dot com
  2005-09-30 23:54 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 14+ messages in thread
From: janis at gcc dot gnu dot org @ 2005-09-09 22:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From janis at gcc dot gnu dot org  2005-09-09 22:18 -------
A regression hunt of mainline on powerpc-linux shows that the test starts
failing with a merge from tree-cleanup-branch on 20050409.  The test passes,
however, with a compiler built after the final patch was added to that branch
on 20050401; looks like it could be a merge problem.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
  2005-07-28 18:40 [Bug tree-optimization/23115] New: -ftree-vectorize generates wrong code p dot van-hoof at qub dot ac dot uk
                   ` (3 preceding siblings ...)
  2005-09-09 22:19 ` janis at gcc dot gnu dot org
@ 2005-09-30 23:52 ` dpatel at apple dot com
  2005-09-30 23:54 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 14+ messages in thread
From: dpatel at apple dot com @ 2005-09-30 23:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dpatel at apple dot com  2005-09-30 23:52 -------
Assign this bug to me. Thanks.

-- 


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
  2005-07-28 18:40 [Bug tree-optimization/23115] New: -ftree-vectorize generates wrong code p dot van-hoof at qub dot ac dot uk
                   ` (4 preceding siblings ...)
  2005-09-30 23:52 ` dpatel at apple dot com
@ 2005-09-30 23:54 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-30 23:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-30 23:54 -------
(In reply to comment #5)
> Assign this bug to me. Thanks.
Done, you also now have the premissions to do that yourself.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dpatel at apple dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
       [not found] <bug-23115-1396@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2007-07-01 13:40 ` ubizjak at gmail dot com
@ 2007-07-04  5:53 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2007-07-04  5:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from ubizjak at gmail dot com  2007-07-04 05:53 -------
(In reply to comment #11)

> It is up to bugmaster to reopen this PR, as the fix is not effective.

This is OK to leave as fixed.


-- 


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
       [not found] <bug-23115-1396@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2005-11-08 22:13 ` pinskia at gcc dot gnu dot org
@ 2007-07-01 13:40 ` ubizjak at gmail dot com
  2007-07-04  5:53 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 14+ messages in thread
From: ubizjak at gmail dot com @ 2007-07-01 13:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from ubizjak at gmail dot com  2007-07-01 13:40 -------
(In reply to comment #9)

>        PR tree-optimization/23115
>        * tree-if-conv.c (find_phi_replacement_condition): Check domninated_by
>        relation.

This fix is not enough to solve problems described in Comment #8. Actually, the
condition, introduced by attached patch:

+      || dominated_by_p (CDI_DOMINATORS, second_bb, first_bb))

doesn't even trigger anymore for the testcase in this PR, and at least gcc
4.3.0 passes mentioned testcase _only_ due to slightly different CFG. However,
the same problem (wrong handling of non perfect diamond) is the root cause of
PR 31966.

It is up to bugmaster to reopen this PR, as the fix is not effective.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |31966
              nThis|                            |


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
       [not found] <bug-23115-1396@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2005-11-08 20:21 ` dpatel at gcc dot gnu dot org
@ 2005-11-08 22:13 ` pinskia at gcc dot gnu dot org
  2007-07-01 13:40 ` ubizjak at gmail dot com
  2007-07-04  5:53 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-08 22:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2005-11-08 22:13 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
       [not found] <bug-23115-1396@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-11-08  2:23 ` dpatel at apple dot com
@ 2005-11-08 20:21 ` dpatel at gcc dot gnu dot org
  2005-11-08 22:13 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: dpatel at gcc dot gnu dot org @ 2005-11-08 20:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from dpatel at gcc dot gnu dot org  2005-11-08 20:21 -------
Subject: Bug 23115

Author: dpatel
Date: Tue Nov  8 20:21:15 2005
New Revision: 106653

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106653
Log:
       PR tree-optimization/23115
       * tree-if-conv.c (find_phi_replacement_condition): Check domninated_by
       relation.

       * gcc.dg/tree-ssa/pr23115.c: New.


Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr23115.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-if-conv.c


-- 


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
       [not found] <bug-23115-1396@http.gcc.gnu.org/bugzilla/>
  2005-10-22 21:56 ` pinskia at gcc dot gnu dot org
  2005-10-31  4:23 ` mmitchel at gcc dot gnu dot org
@ 2005-11-08  2:23 ` dpatel at apple dot com
  2005-11-08 20:21 ` dpatel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: dpatel at apple dot com @ 2005-11-08  2:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from dpatel at apple dot com  2005-11-08 02:22 -------
tree if-conversion  was expecting perfect dimond, but it is not always true
after tree-cleanup-branch work. I've started overnight patch test run.
Hopefully, I'll send patch tomorrow for review.


-- 


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
       [not found] <bug-23115-1396@http.gcc.gnu.org/bugzilla/>
  2005-10-22 21:56 ` pinskia at gcc dot gnu dot org
@ 2005-10-31  4:23 ` mmitchel at gcc dot gnu dot org
  2005-11-08  2:23 ` dpatel at apple dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  4:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mmitchel at gcc dot gnu dot org  2005-10-31 04:23 -------
I'm on the fence as to whether to call this P1 or P2.  People have really
started to use -ftree-vectorize and it's a major advantage of the more recent
compilers over 3.4.x, so I'd really like to see this fixed.  On the other hand,
I'm not quite willing to call this a showstopper, so ... P2.


-- 


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


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

* [Bug tree-optimization/23115] [4.1 Regression] -ftree-vectorize generates wrong code
       [not found] <bug-23115-1396@http.gcc.gnu.org/bugzilla/>
@ 2005-10-22 21:56 ` pinskia at gcc dot gnu dot org
  2005-10-31  4:23 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-22 21:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


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


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

end of thread, other threads:[~2007-07-04  5:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-28 18:40 [Bug tree-optimization/23115] New: -ftree-vectorize generates wrong code p dot van-hoof at qub dot ac dot uk
2005-07-28 18:43 ` [Bug tree-optimization/23115] " p dot van-hoof at qub dot ac dot uk
2005-07-28 18:54 ` [Bug tree-optimization/23115] [4.1 Regression] " pinskia at gcc dot gnu dot org
2005-09-08 20:03 ` pinskia at gcc dot gnu dot org
2005-09-09 22:19 ` janis at gcc dot gnu dot org
2005-09-30 23:52 ` dpatel at apple dot com
2005-09-30 23:54 ` pinskia at gcc dot gnu dot org
     [not found] <bug-23115-1396@http.gcc.gnu.org/bugzilla/>
2005-10-22 21:56 ` pinskia at gcc dot gnu dot org
2005-10-31  4:23 ` mmitchel at gcc dot gnu dot org
2005-11-08  2:23 ` dpatel at apple dot com
2005-11-08 20:21 ` dpatel at gcc dot gnu dot org
2005-11-08 22:13 ` pinskia at gcc dot gnu dot org
2007-07-01 13:40 ` ubizjak at gmail dot com
2007-07-04  5:53 ` ubizjak 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).