public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop
@ 2020-07-23 10:17 zsojka at seznam dot cz
2020-07-23 11:50 ` [Bug tree-optimization/96298] " rguenth at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2020-07-23 10:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
Bug ID: 96298
Summary: [11 Regression] wrong code with -O -fno-tree-forwprop
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: powerpc64-unknown-linux-gnu
Created attachment 48920
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48920&action=edit
reduced testcase
Multiple targets are failing this testcase; x86_64-pc-linux-gnu doesn't fail.
$ powerpc64-unknown-linux-gnu-gcc -O -fno-tree-forwprop testcase.c -static
$ ./a.out
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
$ powerpc64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-powerpc64/bin/powerpc64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r11-2284-20200723104325-g02cada26e47-checking-yes-rtl-df-extra-powerpc64/bin/../libexec/gcc/powerpc64-unknown-linux-gnu/11.0.0/lto-wrapper
Target: powerpc64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl
--with-sysroot=/usr/powerpc64-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=powerpc64-unknown-linux-gnu
--with-ld=/usr/bin/powerpc64-unknown-linux-gnu-ld
--with-as=/usr/bin/powerpc64-unknown-linux-gnu-as --disable-multilib
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r11-2284-20200723104325-g02cada26e47-checking-yes-rtl-df-extra-powerpc64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.0.0 20200723 (experimental) (GCC)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
@ 2020-07-23 11:50 ` rguenth at gcc dot gnu.org
2020-07-23 11:55 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23 11:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|powerpc64-unknown-linux-gnu |powerpc64-unknown-linux-gnu
| |, x86_64-*-*
Ever confirmed|0 |1
Last reconfirmed| |2020-07-23
Status|UNCONFIRMED |NEW
Target Milestone|--- |11.0
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
On ppc64le I for example see
<bb 2> [local count: 119292720]:
a.0_1 = a;
_13 = VIEW_CONVERT_EXPR<long unsigned int>(a.0_1);
_6 = ~_13;
_10 = _13 & 9187201950435737471;
_12 = _6 & 9259542123273814144;
_21 = _10 + 9187201950435737471;
_22 = _21 ^ _12;
_23 = VIEW_CONVERT_EXPR<vector(8) unsigned char>(_22);
_28 = 9259542123273814144 - _10;
_29 = _12 ^ _28;
_30 = VIEW_CONVERT_EXPR<vector(8) unsigned char>(_29);
_31 = VIEW_CONVERT_EXPR<long unsigned int>(_30);
_32 = VIEW_CONVERT_EXPR<long unsigned int>(_23);
_33 = _32 ^ _31;
_34 = VIEW_CONVERT_EXPR<vector(8) unsigned char>(_33);
x = _34;
likewise on x86_64 with -mno-sse where it fails as well.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
2020-07-23 11:50 ` [Bug tree-optimization/96298] " rguenth at gcc dot gnu.org
@ 2020-07-23 11:55 ` rguenth at gcc dot gnu.org
2020-07-23 12:10 ` [Bug rtl-optimization/96298] " segher at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23 11:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |segher at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
-fdisable-rtl-combine fixes it. In the end it elides an xor, but it prints
many matches so not sure what goes on. Likely an issue in some
simplify-rtx thing.
@@ -175,15 +1453,7 @@
(expr_list:REG_EQUAL (plus:DI (reg:DI 85 [ _10 ])
(const_int 9187201950435737471 [0x7f7f7f7f7f7f7f7f]))
(nil)))))
-(insn 14 13 17 2 (parallel [
- (set (reg:DI 108)
- (xor:DI (reg:DI 106)
- (reg:DI 86 [ _12 ])))
- (clobber (reg:CC 17 flags))
- ]) "t.c":8:18 521 {*xordi_1}
- (expr_list:REG_DEAD (reg:DI 106)
- (expr_list:REG_UNUSED (reg:CC 17 flags)
- (nil))))
+(note 14 13 17 2 NOTE_INSN_DELETED)
(insn 17 14 18 2 (parallel [
(set (reg:DI 110)
(minus:DI (reg:DI 105)
@@ -199,22 +1469,22 @@
(insn 18 17 20 2 (parallel [
(set (reg:DI 112)
(xor:DI (reg:DI 110)
- (reg:DI 86 [ _12 ])))
+ (reg:DI 106)))
(clobber (reg:CC 17 flags))
]) "t.c":8:25 521 {*xordi_1}
- (expr_list:REG_DEAD (reg:DI 110)
- (expr_list:REG_DEAD (reg:DI 86 [ _12 ])
- (expr_list:REG_UNUSED (reg:CC 17 flags)
+ (expr_list:REG_UNUSED (reg:CC 17 flags)
+ (expr_list:REG_DEAD (reg:DI 106)
+ (expr_list:REG_DEAD (reg:DI 110)
(nil)))))
(insn 20 18 21 2 (parallel [
(set (reg:DI 114)
- (xor:DI (reg:DI 108)
- (reg:DI 112)))
+ (xor:DI (reg:DI 112)
+ (reg:DI 86 [ _12 ])))
(clobber (reg:CC 17 flags))
]) "t.c":8:23 521 {*xordi_1}
- (expr_list:REG_DEAD (reg:DI 112)
- (expr_list:REG_DEAD (reg:DI 108)
- (expr_list:REG_UNUSED (reg:CC 17 flags)
+ (expr_list:REG_DEAD (reg:DI 86 [ _12 ])
+ (expr_list:REG_UNUSED (reg:CC 17 flags)
+ (expr_list:REG_DEAD (reg:DI 112)
(nil)))))
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
2020-07-23 11:50 ` [Bug tree-optimization/96298] " rguenth at gcc dot gnu.org
2020-07-23 11:55 ` rguenth at gcc dot gnu.org
@ 2020-07-23 12:10 ` segher at gcc dot gnu.org
2020-07-23 12:13 ` marxin at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2020-07-23 12:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
It doesn't fail with 9.3 .
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
` (2 preceding siblings ...)
2020-07-23 12:10 ` [Bug rtl-optimization/96298] " segher at gcc dot gnu.org
@ 2020-07-23 12:13 ` marxin at gcc dot gnu.org
2020-07-23 12:56 ` segher at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-23 12:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
I'm gonna bisect that.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
` (3 preceding siblings ...)
2020-07-23 12:13 ` marxin at gcc dot gnu.org
@ 2020-07-23 12:56 ` segher at gcc dot gnu.org
2020-07-23 14:01 ` marxin at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2020-07-23 12:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
--- Comment #5 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Trying 17, 14 -> 18:
17: r147:DI=r145:DI^r121:DI
REG_DEAD r145:DI
REG_DEAD r121:DI
14: r144:DI=r142:DI^r121:DI
REG_DEAD r142:DI
18: r148:DI=r144:DI^r147:DI
REG_DEAD r147:DI
REG_DEAD r144:DI
(no other insn here not mentioned uses r144 or r147)
This could simplify to just r142^r145. But we go completely wrong here,
instead:
Failed to match this instruction:
(set (reg:DI 148)
(xor:DI (xor:DI (reg:DI 145)
(reg:DI 142))
(reg:DI 121 [ _12 ])))
Successfully matched this instruction:
(set (reg:DI 147)
(xor:DI (reg:DI 145)
(reg:DI 142)))
Successfully matched this instruction:
(set (reg:DI 148)
(xor:DI (reg:DI 147)
(reg:DI 121 [ _12 ])))
allowing combination of insns 14, 17 and 18
original costs 4 + 4 + 4 = 12
replacement costs 4 + 4 = 8
deferring deletion of insn with uid = 14.
modifying insn i2 17: r147:DI=r145:DI^r142:DI
REG_DEAD r142:DI
REG_DEAD r145:DI
deferring rescan insn with uid = 17.
modifying insn i3 18: r148:DI=r147:DI^r121:DI
REG_DEAD r121:DI
REG_DEAD r147:DI
deferring rescan insn with uid = 18.
That sounds like simplify-rtx yes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
` (4 preceding siblings ...)
2020-07-23 12:56 ` segher at gcc dot gnu.org
@ 2020-07-23 14:01 ` marxin at gcc dot gnu.org
2020-07-23 17:14 ` segher at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-23 14:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-1715-g346bce6fe0cf1ed5f6a7ad732d2361d77b203c87.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
` (5 preceding siblings ...)
2020-07-23 14:01 ` marxin at gcc dot gnu.org
@ 2020-07-23 17:14 ` segher at gcc dot gnu.org
2020-07-23 17:49 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2020-07-23 17:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
Segher Boessenkool <segher at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|segher at gcc dot gnu.org |sayle at gcc dot gnu.org
--- Comment #7 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Roger has a fix, reassigning.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
` (6 preceding siblings ...)
2020-07-23 17:14 ` segher at gcc dot gnu.org
@ 2020-07-23 17:49 ` cvs-commit at gcc dot gnu.org
2020-08-18 13:46 ` cvs-commit at gcc dot gnu.org
2020-08-18 13:58 ` roger at nextmovesoftware dot com
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-23 17:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:
https://gcc.gnu.org/g:d4b3ea941b1a15cadb79e7ff8a36891131f8804b
commit r11-2296-gd4b3ea941b1a15cadb79e7ff8a36891131f8804b
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Thu Jul 23 18:48:54 2020 +0100
Resolve regression rtl-optimization/96298. Sorry for the breakage.
2020-07-23 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR rtl-optimization/96298
* simplify-rtx.c (simplify_binary_operation_1) [XOR]: Xor doesn't
distribute over xor, so (a^b)^(c^b) is not the same as (a^c)^b.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
` (7 preceding siblings ...)
2020-07-23 17:49 ` cvs-commit at gcc dot gnu.org
@ 2020-08-18 13:46 ` cvs-commit at gcc dot gnu.org
2020-08-18 13:58 ` roger at nextmovesoftware dot com
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-18 13:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:
https://gcc.gnu.org/g:d850dec9b7bd02ef925def138894402038cca78d
commit r11-2737-gd850dec9b7bd02ef925def138894402038cca78d
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Tue Aug 18 14:45:52 2020 +0100
New tests for PR rtl-optimization/96298.
Tests to confirm PR rtl-optimization is now fixed, remains so.
2020-08-18 Roger Sayle <roger@nextmovesoftware.com>
Zdenek Sojka <zsojka@seznam.cz>
gcc/testsuite/ChangeLog
PR rtl-optimization/96298
* gcc.dg/pr96298.c: New test.
* gcc.target/i386/pr96298.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/96298] [11 Regression] wrong code with -O -fno-tree-forwprop
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
` (8 preceding siblings ...)
2020-08-18 13:46 ` cvs-commit at gcc dot gnu.org
@ 2020-08-18 13:58 ` roger at nextmovesoftware dot com
9 siblings, 0 replies; 11+ messages in thread
From: roger at nextmovesoftware dot com @ 2020-08-18 13:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96298
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Roger Sayle <roger at nextmovesoftware dot com> ---
Fixed. Thanks for everyone's help. Sorry again.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-08-18 13:58 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23 10:17 [Bug tree-optimization/96298] New: [11 Regression] wrong code with -O -fno-tree-forwprop zsojka at seznam dot cz
2020-07-23 11:50 ` [Bug tree-optimization/96298] " rguenth at gcc dot gnu.org
2020-07-23 11:55 ` rguenth at gcc dot gnu.org
2020-07-23 12:10 ` [Bug rtl-optimization/96298] " segher at gcc dot gnu.org
2020-07-23 12:13 ` marxin at gcc dot gnu.org
2020-07-23 12:56 ` segher at gcc dot gnu.org
2020-07-23 14:01 ` marxin at gcc dot gnu.org
2020-07-23 17:14 ` segher at gcc dot gnu.org
2020-07-23 17:49 ` cvs-commit at gcc dot gnu.org
2020-08-18 13:46 ` cvs-commit at gcc dot gnu.org
2020-08-18 13:58 ` roger at nextmovesoftware 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).