public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging
@ 2020-04-13  4:59 zhongyunde at tom dot com
  2020-04-14  7:12 ` [Bug tree-optimization/94573] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zhongyunde at tom dot com @ 2020-04-13  4:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94573
           Summary: Optimizer produces suboptimal code related to
                    -fstore-merging
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhongyunde at tom dot com
  Target Milestone: ---

For the following code, we can known init the array C000016DD is always 
consecutive, so we can use the more bigger mode size.
test base on the x86-64 gcc 9.2 on https://gcc.godbolt.org/, now it is still
handled DWORD by DWORD, and we except optimize it with QWORD or more bigger
size.

extern signed int C000016DD[43][12]; 

void C00001F93(int index)
{
    C000016DD[index][0] = 0;
    C000016DD[index][1] = 0;
    C000016DD[index][2] = 0;
    C000016DD[index][3] = 0;
    C000016DD[index][4] = 0;
    C000016DD[index][5] = 0;
    C000016DD[index][6] = 0;
    C000016DD[index][7] = 0;

    return;
}

============= related assemble =============
C00001F93(int):
        movsx   rdi, edi
        lea     rax, [rdi+rdi*2]
        sal     rax, 4
        mov     DWORD PTR C000016DD[rax], 0
        mov     DWORD PTR C000016DD[rax+4], 0
        mov     DWORD PTR C000016DD[rax+8], 0
        mov     DWORD PTR C000016DD[rax+12], 0
        mov     DWORD PTR C000016DD[rax+16], 0
        mov     DWORD PTR C000016DD[rax+20], 0
        mov     DWORD PTR C000016DD[rax+24], 0
        mov     DWORD PTR C000016DD[rax+28], 0
        ret

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

* [Bug tree-optimization/94573] Optimizer produces suboptimal code related to -fstore-merging
  2020-04-13  4:59 [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging zhongyunde at tom dot com
@ 2020-04-14  7:12 ` rguenth at gcc dot gnu.org
  2020-04-14  8:45 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-14  7:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
      Known to fail|                            |9.3.1
      Known to work|                            |10.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I see

C00001F93:
.LFB0:
        .cfi_startproc
        movslq  %edi, %rdi
        leaq    (%rdi,%rdi,2), %rax
        salq    $4, %rax
        movq    $0, C000016DD(%rax)
        movq    $0, C000016DD+8(%rax)
        movq    $0, C000016DD+16(%rax)
        movq    $0, C000016DD+24(%rax)
        ret

with GCC 10.  Confirmed it uses 4 byte moves with GCC 9.  Fixed in GCC 10 thus.

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

* [Bug tree-optimization/94573] Optimizer produces suboptimal code related to -fstore-merging
  2020-04-13  4:59 [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging zhongyunde at tom dot com
  2020-04-14  7:12 ` [Bug tree-optimization/94573] " rguenth at gcc dot gnu.org
@ 2020-04-14  8:45 ` jakub at gcc dot gnu.org
  2020-04-14  8:56 ` ebotcazou at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-14  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In particular, fixed with r10-3575-g629387a6586a753166f5cf53d587026a34362523
I thought that commit was about store merging with non-call-expceptions, but
apparently it affects more.

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

* [Bug tree-optimization/94573] Optimizer produces suboptimal code related to -fstore-merging
  2020-04-13  4:59 [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging zhongyunde at tom dot com
  2020-04-14  7:12 ` [Bug tree-optimization/94573] " rguenth at gcc dot gnu.org
  2020-04-14  8:45 ` jakub at gcc dot gnu.org
@ 2020-04-14  8:56 ` ebotcazou at gcc dot gnu.org
  2020-04-14 10:29 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2020-04-14  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> In particular, fixed with r10-3575-g629387a6586a753166f5cf53d587026a34362523
> I thought that commit was about store merging with non-call-expceptions, but
> apparently it affects more.

Possibly the adjust_bit_pos change.

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

* [Bug tree-optimization/94573] Optimizer produces suboptimal code related to -fstore-merging
  2020-04-13  4:59 [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging zhongyunde at tom dot com
                   ` (2 preceding siblings ...)
  2020-04-14  8:56 ` ebotcazou at gcc dot gnu.org
@ 2020-04-14 10:29 ` rguenth at gcc dot gnu.org
  2020-04-14 10:39 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-14 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Means we should add the testcase?

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

* [Bug tree-optimization/94573] Optimizer produces suboptimal code related to -fstore-merging
  2020-04-13  4:59 [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging zhongyunde at tom dot com
                   ` (3 preceding siblings ...)
  2020-04-14 10:29 ` rguenth at gcc dot gnu.org
@ 2020-04-14 10:39 ` jakub at gcc dot gnu.org
  2020-04-14 11:08 ` zhongyunde at huawei dot com
  2020-04-14 14:15 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-14 10:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I'll handle it.

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

* [Bug tree-optimization/94573] Optimizer produces suboptimal code related to -fstore-merging
  2020-04-13  4:59 [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging zhongyunde at tom dot com
                   ` (4 preceding siblings ...)
  2020-04-14 10:39 ` jakub at gcc dot gnu.org
@ 2020-04-14 11:08 ` zhongyunde at huawei dot com
  2020-04-14 14:15 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: zhongyunde at huawei dot com @ 2020-04-14 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from vfdff <zhongyunde at huawei dot com> ---
Created attachment 48267
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48267&action=edit
only get the adjust_bit_pos change

base on the adjust_bit_pos change only, I test it on the gcc 9, and find it
take effect.

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

* [Bug tree-optimization/94573] Optimizer produces suboptimal code related to -fstore-merging
  2020-04-13  4:59 [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging zhongyunde at tom dot com
                   ` (5 preceding siblings ...)
  2020-04-14 11:08 ` zhongyunde at huawei dot com
@ 2020-04-14 14:15 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-14 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:66b8801141f5c1a65613b8f42501e8cd4b9195d9

commit r10-7717-g66b8801141f5c1a65613b8f42501e8cd4b9195d9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Apr 14 16:14:47 2020 +0200

    testsuite: Add testcase for already fixed PR [PR94573]

    2020-04-14  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/94573
            * gcc.dg/store_merging_30.c: New test.

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

end of thread, other threads:[~2020-04-14 14:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13  4:59 [Bug c/94573] New: Optimizer produces suboptimal code related to -fstore-merging zhongyunde at tom dot com
2020-04-14  7:12 ` [Bug tree-optimization/94573] " rguenth at gcc dot gnu.org
2020-04-14  8:45 ` jakub at gcc dot gnu.org
2020-04-14  8:56 ` ebotcazou at gcc dot gnu.org
2020-04-14 10:29 ` rguenth at gcc dot gnu.org
2020-04-14 10:39 ` jakub at gcc dot gnu.org
2020-04-14 11:08 ` zhongyunde at huawei dot com
2020-04-14 14:15 ` cvs-commit 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).