public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/65136] New: VRP inserts unnecessary constant copy in the loop
@ 2015-02-20  9:56 izamyatin at gmail dot com
  2015-02-20 12:43 ` [Bug tree-optimization/65136] [5 Regression] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: izamyatin at gmail dot com @ 2015-02-20  9:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65136
           Summary: VRP inserts unnecessary constant copy in the loop
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: izamyatin at gmail dot com

For the following piece of code

int foo (unsigned int cc)
{

   while ( cc >> 16 )
      {
      cc = (cc & 0xffff) + (cc >> 16);
      }

   return cc == 1;
}

at o2 we have 

        movl    %edi, %eax
        shrl    $16, %eax
        testl   %eax, %eax
        je      .L2
        .p2align 4,,10
        .p2align 3
.L3:
        movzwl  %di, %edi
        addl    %eax, %edi
        movl    $1, %eax        
        movl    %edi, %edx
        shrl    $16, %edx
        testl   %edx, %edx
        jne     .L3

while with -fno-tree-vrp

        jmp     .L8
        .p2align 4,,10
        .p2align 3
.L3:
        movzwl  %di, %edi
        addl    %eax, %edi
.L8:
        movl    %edi, %eax
        shrl    $16, %eax
        testl   %eax, %eax
        jne     .L3


vrp changes loop in a following way

  <bb 4>:
  # cc_12 = PHI <cc_2(D)(3), cc_5(4)>
  # _13 = PHI <_11(3), 1(4)>
  _4 = cc_12 & 65535;
  cc_5 = _13 + _4;
  _3 = cc_5 >> 16;
  if (_3 != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

resulted in constant copy to be inserted.


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

* [Bug tree-optimization/65136] [5 Regression] VRP inserts unnecessary constant copy in the loop
  2015-02-20  9:56 [Bug tree-optimization/65136] New: VRP inserts unnecessary constant copy in the loop izamyatin at gmail dot com
@ 2015-02-20 12:43 ` rguenth at gcc dot gnu.org
  2015-02-20 17:03 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-20 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uros at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
After the patch the assembly difference between 4.9 and 5 is

--- t.s.good    2015-02-20 13:26:52.337186388 +0100
+++ t.s 2015-02-20 13:26:56.769235529 +0100
@@ -21,7 +21,7 @@
        testl   %eax, %eax
        jne     .L3
        xorl    %eax, %eax
-       cmpw    $-1, %di
+       cmpl    $65535, %edi
        sete    %al
        ret
        .cfi_endproc

not sure why we prefer the bigger encoding now.


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

* [Bug tree-optimization/65136] [5 Regression] VRP inserts unnecessary constant copy in the loop
  2015-02-20  9:56 [Bug tree-optimization/65136] New: VRP inserts unnecessary constant copy in the loop izamyatin at gmail dot com
  2015-02-20 12:43 ` [Bug tree-optimization/65136] [5 Regression] " rguenth at gcc dot gnu.org
@ 2015-02-20 17:03 ` rguenth at gcc dot gnu.org
  2015-02-20 17:05 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-20 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


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

* [Bug tree-optimization/65136] [5 Regression] VRP inserts unnecessary constant copy in the loop
  2015-02-20  9:56 [Bug tree-optimization/65136] New: VRP inserts unnecessary constant copy in the loop izamyatin at gmail dot com
  2015-02-20 12:43 ` [Bug tree-optimization/65136] [5 Regression] " rguenth at gcc dot gnu.org
  2015-02-20 17:03 ` rguenth at gcc dot gnu.org
@ 2015-02-20 17:05 ` rguenth at gcc dot gnu.org
  2015-02-20 18:20 ` ubizjak at gmail dot com
  2015-02-23 10:00 ` rguenther at suse dot de
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-20 17:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Feb 20 16:58:11 2015
New Revision: 220876

URL: https://gcc.gnu.org/viewcvs?rev=220876&root=gcc&view=rev
Log:
2015-02-20  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/65136
    * tree-ssa-propagate.c: Include cfgloop.h.
    (replace_phi_args_in): Avoid replacing loop latch edge PHI
    arguments with constants.

    * gcc.dg/tree-ssa/pr65136.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr65136.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-propagate.c


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

* [Bug tree-optimization/65136] [5 Regression] VRP inserts unnecessary constant copy in the loop
  2015-02-20  9:56 [Bug tree-optimization/65136] New: VRP inserts unnecessary constant copy in the loop izamyatin at gmail dot com
                   ` (2 preceding siblings ...)
  2015-02-20 17:05 ` rguenth at gcc dot gnu.org
@ 2015-02-20 18:20 ` ubizjak at gmail dot com
  2015-02-23 10:00 ` rguenther at suse dot de
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2015-02-20 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Richard Biener from comment #3)
> After the patch the assembly difference between 4.9 and 5 is

Hm, I don't see the difference with -O2, 4.9.3 vs. 5.0:

--- pr65136_493.s       2015-02-20 18:50:30.939970811 +0100
+++ pr65136_5.s 2015-02-20 18:50:36.860907527 +0100
@@ -31,5 +31,5 @@
 .LCOLDE0:
        .text
 .LHOTE0:
-       .ident  "GCC: (GNU) 4.9.3 20150204 (prerelease) [gcc-4_9-branch
revision 220411]"
+       .ident  "GCC: (GNU) 5.0.0 20150220 (experimental) [trunk revision
220876]"
        .section        .note.GNU-stack,"",@progbits
>From gcc-bugs-return-477987-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 20 18:06:04 2015
Return-Path: <gcc-bugs-return-477987-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30274 invoked by alias); 20 Feb 2015 18:06:04 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 30049 invoked by uid 48); 20 Feb 2015 18:06:00 -0000
From: "zbeekman at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/65144] New: Problems printing, reading and accessing substrings of ISO_10646 character variables
Date: Fri, 20 Feb 2015 18:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zbeekman at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-65144-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg02319.txt.bz2
Content-length: 1471

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

            Bug ID: 65144
           Summary: Problems printing, reading and accessing substrings of
                    ISO_10646 character variables
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zbeekman at gmail dot com

Created attachment 34820
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34820&action=edit
reproducer program

This bug may be related to 65125,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65125 I’m not sure.

Basically it seems that 3 things are happening:

 - Unicode strings aren’t being output correctly to to stdout, it seems only
the first few characters are output. This *could* be an issue related to what
gfortran thinks the encoding of the tty is. Further testing reveals that it
seems to output to a file opened with uff-8 encoding OK
 - Unicode substrings retain the correct kind as long as they are not
parameters (see 65141 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65141) BUT
the resulting representation seems to be that of DEFAULT character kind. (i.e.
the characters change when a substring expression is used, characters 2-4 in
str(2:4) are different than characters 2-4 in str). This happens even when
writing to a file opened with uff-8 encoding.
>From gcc-bugs-return-477988-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 20 18:20:20 2015
Return-Path: <gcc-bugs-return-477988-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6245 invoked by alias); 20 Feb 2015 18:20:20 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 6196 invoked by uid 48); 20 Feb 2015 18:20:16 -0000
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65109] [5 Regression] r220674 causes FAIL: gcc.target/powerpc/ppc64-abi-1.c execution test
Date: Fri, 20 Feb 2015 18:49:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: law at redhat dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: msebor at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-65109-4-zZ36rIIItm@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65109-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65109-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg02320.txt.bz2
Content-length: 634

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide109

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com

--- Comment #6 from Jeffrey A. Law <law at redhat dot com> ---
Martin,

Does the test pass if the schedulers are turned off?  If so, turning off the
schedulers would be less invasive.  Still leaves us with a bit of a fragile
test, but it's been like this for ~12 years or so.  Revisiting it once every
dozen years isn't so bad.


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

* [Bug tree-optimization/65136] [5 Regression] VRP inserts unnecessary constant copy in the loop
  2015-02-20  9:56 [Bug tree-optimization/65136] New: VRP inserts unnecessary constant copy in the loop izamyatin at gmail dot com
                   ` (3 preceding siblings ...)
  2015-02-20 18:20 ` ubizjak at gmail dot com
@ 2015-02-23 10:00 ` rguenther at suse dot de
  4 siblings, 0 replies; 6+ messages in thread
From: rguenther at suse dot de @ 2015-02-23 10:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 20 Feb 2015, ubizjak at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65136
> 
> --- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
> (In reply to Richard Biener from comment #3)
> > After the patch the assembly difference between 4.9 and 5 is
> 
> Hm, I don't see the difference with -O2, 4.9.3 vs. 5.0:

Must be local patches in my tree then.
>From gcc-bugs-return-478145-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Feb 23 09:51:56 2015
Return-Path: <gcc-bugs-return-478145-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30950 invoked by alias); 23 Feb 2015 09:51:55 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 30897 invoked by uid 48); 23 Feb 2015 09:51:50 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/65148] ICE:  in get_biv_step, at loop-iv.c:823
Date: Mon, 23 Feb 2015 10:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65148-4-t1hX85yz44@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65148-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65148-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg02477.txt.bz2
Content-length: 179

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide148

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Works for me on x86_64, so probably also latent on trunk?


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

end of thread, other threads:[~2015-02-23  9:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20  9:56 [Bug tree-optimization/65136] New: VRP inserts unnecessary constant copy in the loop izamyatin at gmail dot com
2015-02-20 12:43 ` [Bug tree-optimization/65136] [5 Regression] " rguenth at gcc dot gnu.org
2015-02-20 17:03 ` rguenth at gcc dot gnu.org
2015-02-20 17:05 ` rguenth at gcc dot gnu.org
2015-02-20 18:20 ` ubizjak at gmail dot com
2015-02-23 10:00 ` rguenther at suse dot de

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