public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/103440] New: wrong code at -Os and above on x86_64-linux-gnu
@ 2021-11-26 12:17 zhendong.su at inf dot ethz.ch
  2021-11-26 13:39 ` [Bug tree-optimization/103440] [12 Regression] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2021-11-26 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103440
           Summary: wrong code at -Os and above on x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It seems to be recent and a regression from GCC 11.2.

[671] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211126 (experimental) [master r12-4647-g3f861a5c8fd] (GCC) 
[672] % 
[672] % gcctk -O1 small.c; ./a.out
[673] % 
[673] % gcctk -Os small.c
[674] % timeout -s 9 10 ./a.out
Killed
[675] % 
[675] % cat small.c
int a, b, c, d, e;
int main() {
  int f = 2, g = 1, h = -3;
L1:
  c = b ^ 1;
  if (!f)
    goto L3;
  if (d)
    g = e;
  f = h;
  if (!c)
    goto L1;
L2:
  if (g)
    a = 0;
L3:
  if (d == g)
    goto L2;
  return 0;
}

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

* [Bug tree-optimization/103440] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu
  2021-11-26 12:17 [Bug tree-optimization/103440] New: wrong code at -Os and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
@ 2021-11-26 13:39 ` rguenth at gcc dot gnu.org
  2021-11-26 14:06 ` [Bug tree-optimization/103440] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5522-g661c02e54ea72fb5 marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-26 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |needs-bisection, wrong-code
   Last reconfirmed|                            |2021-11-26
     Ever confirmed|0                           |1
   Target Milestone|---                         |12.0
      Known to work|                            |11.2.1
            Version|unknown                     |12.0
            Summary|wrong code at -Os and above |[12 Regression] wrong code
                   |on x86_64-linux-gnu         |at -Os and above on
                   |                            |x86_64-linux-gnu
           Priority|P3                          |P1

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

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

* [Bug tree-optimization/103440] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5522-g661c02e54ea72fb5
  2021-11-26 12:17 [Bug tree-optimization/103440] New: wrong code at -Os and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2021-11-26 13:39 ` [Bug tree-optimization/103440] [12 Regression] " rguenth at gcc dot gnu.org
@ 2021-11-26 14:06 ` marxin at gcc dot gnu.org
  2021-11-29 17:21 ` amacleod at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-26 14:06 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
            Summary|[12 Regression] wrong code  |[12 Regression] wrong code
                   |at -Os and above on         |at -Os and above on
                   |x86_64-linux-gnu            |x86_64-linux-gnu since
                   |                            |r12-5522-g661c02e54ea72fb5
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |amacleod at redhat dot com,
                   |                            |marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-5522-g661c02e54ea72fb5.

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

* [Bug tree-optimization/103440] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5522-g661c02e54ea72fb5
  2021-11-26 12:17 [Bug tree-optimization/103440] New: wrong code at -Os and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
  2021-11-26 13:39 ` [Bug tree-optimization/103440] [12 Regression] " rguenth at gcc dot gnu.org
  2021-11-26 14:06 ` [Bug tree-optimization/103440] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5522-g661c02e54ea72fb5 marxin at gcc dot gnu.org
@ 2021-11-29 17:21 ` amacleod at redhat dot com
  2021-11-30 14:10 ` cvs-commit at gcc dot gnu.org
  2021-11-30 14:12 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: amacleod at redhat dot com @ 2021-11-29 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Macleod <amacleod at redhat dot com> ---
I need to adjust the original patch, I shouldn't have continued the loop when
dealing with equivalences.    An equivalence is not the same as an undefined
value...  we might be able to ignore the range from it for calculation
purposes, but we cannot ignore the fact that it is a different SSA_NAME and may
contain a different value that we do care about.

There are other checks in then loop which will allow us to assign an
equivalence between the DEF and an argument if we are ignoring the other
ssa_names..  such as when there are undefined values.

a_3 = PHI <a_1(4), a_2(6)>

if a_2 is undefined, we can create an equivalence between a_3 and a_1 as the
value of a_2 is irrelevant and can be whatever we want it to be.

if a_2 is instead an equivalence with a_3, we do not want to create an
equivalence between a_3 and a_1 in this block as we may then turn it into a
copy.. we'd only be able to do this if there was an equivalence between a_1 and
a_2, and we are not checking that.

Although we are may not be adding the range for a_2 into the cumulative
knowledge of a_3's range, we do need to keep the edge to retain the copy as its
value is important and could be different than the other argument... and we
need to retain the copy when we go out of ssa.

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

* [Bug tree-optimization/103440] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5522-g661c02e54ea72fb5
  2021-11-26 12:17 [Bug tree-optimization/103440] New: wrong code at -Os and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2021-11-29 17:21 ` amacleod at redhat dot com
@ 2021-11-30 14:10 ` cvs-commit at gcc dot gnu.org
  2021-11-30 14:12 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-30 14:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Macleod <amacleod@gcc.gnu.org>:

https://gcc.gnu.org/g:e43b15c88c242b14a8ced8e631c1f9b80e83d63c

commit r12-5628-ge43b15c88c242b14a8ced8e631c1f9b80e83d63c
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Nov 29 09:19:34 2021 -0500

    Always track arguments, even when ignoring equiv params.

    To "ignore" ranges from equivalences, we should track the range separately,
    but still do the other name processing which determiens if there is a
single
    name or not for equivalence.  Otherwise we mistakently think we can
introduce
    an equivalences.

            gcc/
            PR tree-optimization/103440
            * gimple-range-fold.cc (fold_using_range::range_of_phi): Continue
            normal param processing for equiv params.

            gcc/testsuite/
            * gcc.dg/pr103440.c: New.

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

* [Bug tree-optimization/103440] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5522-g661c02e54ea72fb5
  2021-11-26 12:17 [Bug tree-optimization/103440] New: wrong code at -Os and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2021-11-30 14:10 ` cvs-commit at gcc dot gnu.org
@ 2021-11-30 14:12 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: amacleod at redhat dot com @ 2021-11-30 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Macleod <amacleod at redhat dot com> changed:

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

--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> ---
fixed.

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

end of thread, other threads:[~2021-11-30 14:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26 12:17 [Bug tree-optimization/103440] New: wrong code at -Os and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2021-11-26 13:39 ` [Bug tree-optimization/103440] [12 Regression] " rguenth at gcc dot gnu.org
2021-11-26 14:06 ` [Bug tree-optimization/103440] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5522-g661c02e54ea72fb5 marxin at gcc dot gnu.org
2021-11-29 17:21 ` amacleod at redhat dot com
2021-11-30 14:10 ` cvs-commit at gcc dot gnu.org
2021-11-30 14:12 ` amacleod at redhat 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).