public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/97967] New: Missed optimization opportunity for VRP
@ 2020-11-24 12:32 ishiura-compiler at ml dot kwansei.ac.jp
  2021-07-28 20:54 ` [Bug tree-optimization/97967] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: ishiura-compiler at ml dot kwansei.ac.jp @ 2020-11-24 12:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97967
           Summary: Missed optimization opportunity for VRP
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ishiura-compiler at ml dot kwansei.ac.jp
  Target Milestone: ---

We have another VRP related test case for GCC-10.2.0. 

We expect A1.c and A2.c should compile to the same codes, but they did
not.

+---------------------------------+---------------------------------+
|                A1.c             |              A2.c               |
+---------------------------------+---------------------------------+
|int main (void)                  |int main (void)                  |
|{                                |{                                |
|  volatile int a = 1;            |  volatile int a = 1;            |
|                                 |                                 |
|  int b = a%2;                   |  a;                             |
|  int t = 200<(short)(-50*b);    |  int t = 0;                     |
|                                 |                                 |
|  if (t != 0) __builtin_abort(); |  if (t != 0) __builtin_abort(); |
|                                 |                                 |
|  return 0;                      |  return 0;                      |
|}                                |}                                |
+---------------------------------+---------------------------------+

+-------------------------------+------------------------------+
| A1.s (gcc-10.2.0 A1.c -O3 -S) | A2.s (gcc-10.2.0 A2.c -O3 -S)|
+-------------------------------+------------------------------+
|main:                          |main:                         |
|.LFB0:                         |.LFB0:                        |
|   .cfi_startproc              |   .cfi_startproc             |
|   subq    $24, %rsp           |   movl    $1, -4(%rsp)       |
|   .cfi_def_cfa_offset 32      |   movl    -4(%rsp), %eax     |
|   movl    $1, 12(%rsp)        |                              |
|   movl    12(%rsp), %eax      |                              |
|   movl    %eax, %edx          |                              |
|   shrl    $31, %edx           |                              |
|   addl    %edx, %eax          |                              |
|   andl    $1, %eax            |                              |
|   subl    %edx, %eax          |                              |
|   imull   $-50, %eax, %eax    |                              |
|   cmpw    $200, %ax           |                              |
|   jg      .L3                 |                              |
|   xorl    %eax, %eax          |   xorl    %eax, %eax         |
|   addq    $24, %rsp           |                              |
|   .cfi_def_cfa_offset 8       |                              |
|   ret                         |   ret                        |
|   .cfi_endproc                |   .cfi_endproc               |
|   .section   .text.unlikely   |                              |
|   .cfi_startproc              |                              |
|   .type   main.cold, @function|                              |
|main.cold:                     |                              |
|.LFSB0:                        |                              |
|.L3:                           |                              |
|    .cfi_def_cfa_offset 32     |                              |
|    call    abort              |                              |
|    .cfi_endproc               |                              |
|.LFE0:                         |.LFE0:                        |
|    .section  text.startup     |                              |
|    .size   main, .-main       |   .size   main, .-main       |
|    .section  .text.unlikely   |                              |
|    .size   main.cold, .-mai...|                              |
|.LCOLDE0:                      |                              |
|    .section  .text.startup    |                              |
|.LHOTE0:                       |                              |
|    .ident  "GCC: (GNU) 10.2.0"|   .ident  "GCC: (GNU) 10.2.0"|
|    .section  .note.GNU-stac...|   .section  .note.GNU-stac...|
+--------------------------------------------------------------+

$ gcc -v
using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
target: x86_64-pc-linux-gnu
configure woth: ../configure --enable-languages=c,c++ --prefix=/usr/local
--disable-bootstrap --disable-multilib
thred model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)

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

* [Bug tree-optimization/97967] Missed optimization opportunity for VRP
  2020-11-24 12:32 [Bug tree-optimization/97967] New: Missed optimization opportunity for VRP ishiura-compiler at ml dot kwansei.ac.jp
@ 2021-07-28 20:54 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-28 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |11.0
         Resolution|---                         |FIXED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 11 already.

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

end of thread, other threads:[~2021-07-28 20:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 12:32 [Bug tree-optimization/97967] New: Missed optimization opportunity for VRP ishiura-compiler at ml dot kwansei.ac.jp
2021-07-28 20:54 ` [Bug tree-optimization/97967] " pinskia at gcc dot gnu.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).