* [Bug tree-optimization/107195] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
@ 2022-10-09 18:59 ` pinskia at gcc dot gnu.org
2022-10-09 18:59 ` [Bug tree-optimization/107195] [13 Regression] " pinskia at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-09 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It worked with:
gcc version 13.0.0 20221008 (experimental)
(Compiler-Explorer-Build-gcc-705ed42a1ad950860f46c51216ff69dbe0f4857a-binutils-2.38)
So definitely a recent regression.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2022-10-09 18:59 ` [Bug tree-optimization/107195] " pinskia at gcc dot gnu.org
@ 2022-10-09 18:59 ` pinskia at gcc dot gnu.org
2022-10-09 19:01 ` pinskia at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-09 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|wrong code with "-O1 |[13 Regression] wrong code
|-fno-tree-ccp" on |with "-O1 -fno-tree-ccp" on
|x86_64-linux-gnu |x86_64-linux-gnu
Known to work| |12.2.0
Target Milestone|--- |13.0
Keywords| |wrong-code
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2022-10-09 18:59 ` [Bug tree-optimization/107195] " pinskia at gcc dot gnu.org
2022-10-09 18:59 ` [Bug tree-optimization/107195] [13 Regression] " pinskia at gcc dot gnu.org
@ 2022-10-09 19:01 ` pinskia at gcc dot gnu.org
2022-10-10 7:24 ` rguenth at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-09 19:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is more recent than the patch which exposed PR 107172 though.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (2 preceding siblings ...)
2022-10-09 19:01 ` pinskia at gcc dot gnu.org
@ 2022-10-10 7:24 ` rguenth at gcc dot gnu.org
2022-10-10 13:23 ` [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd marxin at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-10 7:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-10-10
Keywords| |needs-reduction
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Version|unknown |13.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (3 preceding siblings ...)
2022-10-10 7:24 ` rguenth at gcc dot gnu.org
@ 2022-10-10 13:23 ` marxin at gcc dot gnu.org
2022-10-10 18:49 ` aldyh at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-10 13:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-reduction |
CC| |aldyh at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=107194
Summary|[13 Regression] wrong code |[13 Regression] wrong code
|with "-O1 -fno-tree-ccp" on |with "-O1 -fno-tree-ccp" on
|x86_64-linux-gnu |x86_64-linux-gnu since
| |r13-3090-gdf4c584c567263fd
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Also started with r13-3090-gdf4c584c567263fd.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (4 preceding siblings ...)
2022-10-10 13:23 ` [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd marxin at gcc dot gnu.org
@ 2022-10-10 18:49 ` aldyh at gcc dot gnu.org
2022-10-10 18:52 ` aldyh at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: aldyh at gcc dot gnu.org @ 2022-10-10 18:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
--- Comment #4 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
*** Bug 107194 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (5 preceding siblings ...)
2022-10-10 18:49 ` aldyh at gcc dot gnu.org
@ 2022-10-10 18:52 ` aldyh at gcc dot gnu.org
2022-10-10 18:53 ` aldyh at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: aldyh at gcc dot gnu.org @ 2022-10-10 18:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amacleod at redhat dot com
--- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
When solving 0 = _15 & 1, we calculate _15 as:
[irange] int [-INF, -2][0, +INF] NONZERO 0xfffffffe
The known value of _15 is [0, 1] NONZERO 0x1 which is intersected with
the above, yielding:
[0, 1] NONZERO 0x0
The final nonzero bits tells us the range is 0, but the range is still
[0, 1], which causes logical_combine to assume the range is not-zero,
as irange::zero_p() ignores the nonzero bits.
I think we should just normalize a nonzero mask of 0 to [0, 0] at
creation, thus avoiding all this.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (6 preceding siblings ...)
2022-10-10 18:52 ` aldyh at gcc dot gnu.org
@ 2022-10-10 18:53 ` aldyh at gcc dot gnu.org
2022-10-11 8:31 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: aldyh at gcc dot gnu.org @ 2022-10-10 18:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
--- Comment #6 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Created attachment 53687
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53687&action=edit
untested patch
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (7 preceding siblings ...)
2022-10-10 18:53 ` aldyh at gcc dot gnu.org
@ 2022-10-11 8:31 ` cvs-commit at gcc dot gnu.org
2022-10-11 9:02 ` aldyh at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-11 8:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <aldyh@gcc.gnu.org>:
https://gcc.gnu.org/g:c4d15dddf6b9eacb36f535807ad2ee364af46e04
commit r13-3217-gc4d15dddf6b9eacb36f535807ad2ee364af46e04
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Mon Oct 10 20:42:10 2022 +0200
[PR107195] Set range to zero when nonzero mask is 0.
When solving 0 = _15 & 1, we calculate _15 as:
[irange] int [-INF, -2][0, +INF] NONZERO 0xfffffffe
The known value of _15 is [0, 1] NONZERO 0x1 which is intersected with
the above, yielding:
[0, 1] NONZERO 0x0
This eventually gets copied to a _Bool [0, 1] NONZERO 0x0.
This is problematic because here we have a bool which is zero, but
returns false for irange::zero_p, since the latter does not look at
nonzero bits. This causes logical_combine to assume the range is
not-zero, and all hell breaks loose.
I think we should just normalize a nonzero mask of 0 to [0, 0] at
creation, thus avoiding all this.
PR tree-optimization/107195
gcc/ChangeLog:
* value-range.cc (irange::set_range_from_nonzero_bits): Set range
to [0,0] when nonzero mask is 0.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr107195-1.c: New test.
* gcc.dg/tree-ssa/pr107195-2.c: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (8 preceding siblings ...)
2022-10-11 8:31 ` cvs-commit at gcc dot gnu.org
@ 2022-10-11 9:02 ` aldyh at gcc dot gnu.org
2022-10-12 7:48 ` marxin at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: aldyh at gcc dot gnu.org @ 2022-10-11 9:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #8 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
fixed
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (9 preceding siblings ...)
2022-10-11 9:02 ` aldyh at gcc dot gnu.org
@ 2022-10-12 7:48 ` marxin at gcc dot gnu.org
2022-10-21 9:29 ` cvs-commit at gcc dot gnu.org
2022-10-21 9:29 ` cvs-commit at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-12 7:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vsevolod.livinskiy at gmail dot co
| |m
--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
*** Bug 107228 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (10 preceding siblings ...)
2022-10-12 7:48 ` marxin at gcc dot gnu.org
@ 2022-10-21 9:29 ` cvs-commit at gcc dot gnu.org
2022-10-21 9:29 ` cvs-commit at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-21 9:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Schwinge <tschwinge@gcc.gnu.org>:
https://gcc.gnu.org/g:436c4a210e8ff936063579dab3641632c06c8a7d
commit r13-3433-g436c4a210e8ff936063579dab3641632c06c8a7d
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Mon Oct 17 09:10:03 2022 +0200
Add 'gcc.dg/tree-ssa/pr107195-3.c' [PR107195]
... to display optimization performed as of recent
commit r13-3217-gc4d15dddf6b9eacb36f535807ad2ee364af46e04
"[PR107195] Set range to zero when nonzero mask is 0".
PR tree-optimization/107195
gcc/testsuite/
* gcc.dg/tree-ssa/pr107195-3.c: New.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug tree-optimization/107195] [13 Regression] wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu since r13-3090-gdf4c584c567263fd
2022-10-09 13:01 [Bug tree-optimization/107195] New: wrong code with "-O1 -fno-tree-ccp" on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
` (11 preceding siblings ...)
2022-10-21 9:29 ` cvs-commit at gcc dot gnu.org
@ 2022-10-21 9:29 ` cvs-commit at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-21 9:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107195
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Schwinge <tschwinge@gcc.gnu.org>:
https://gcc.gnu.org/g:a9de836c2b22f878cff592b96e11c1b95d4d36ee
commit r13-3434-ga9de836c2b22f878cff592b96e11c1b95d4d36ee
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Sun Oct 16 00:07:20 2022 +0200
Restore 'libgomp.oacc-c-c++-common/nvptx-sese-1.c' SESE regions checking
[PR107195, PR107344]
That is, adjust for optimization introduced with recent
commit r13-3217-gc4d15dddf6b9eacb36f535807ad2ee364af46e04
"[PR107195] Set range to zero when nonzero mask is 0", where GCC now
understands that after 'r *= 2;', 'r & 1' will never hold here, and thus
transforms/optimizes/"disturbs" the original code such that GCC/nvptx's
later
"Neuter whole SESE regions" optimization no longer is applicable to it:
UNSUPPORTED: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-sese-1.c
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O0
PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-sese-1.c
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2 (test
for excess errors)
PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-sese-1.c
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2
execution test
[-PASS:-]{+FAIL:+}
libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-sese-1.c
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -foffload=nvptx-none -O2
scan-nvptx-none-offload-rtl-dump mach "SESE regions:.*
[0-9]+{[0-9]+->[0-9]+(\\.[0-9]+)+}"
Same for C++.
It's unclear to me if this is an actual "problem", which optimization is
"more
important", so I've filed PR107344 "GCC/nvptx SESE region optimization" to
capture this question, and here restore what we intend to be testing (to my
understanding) in 'libgomp.oacc-c-c++-common/nvptx-sese-1.c'.
PR tree-optimization/107195
PR target/107344
libgomp/
* testsuite/libgomp.oacc-c-c++-common/nvptx-sese-1.c: Restore SESE
regions checking.
^ permalink raw reply [flat|nested] 14+ messages in thread