This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/80693] New: [6/7/8 Regression] wrong code with -O -fno-tree-coalesce-vars
- From: "zsojka at seznam dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 09 May 2017 11:19:31 +0000
- Subject: [Bug rtl-optimization/80693] New: [6/7/8 Regression] wrong code with -O -fno-tree-coalesce-vars
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80693
Bug ID: 80693
Summary: [6/7/8 Regression] wrong code with -O
-fno-tree-coalesce-vars
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Created attachment 41335
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41335&action=edit
reduced testcase
Output:
$ x86_64-pc-linux-gnu-gcc -O -fno-tree-coalesce-vars testcase.c
$ ./a.out
Aborted
The .combine dump shows:
...
Trying 18, 19 -> 20:
Failed to match this instruction:
(set (reg:HI 116)
(and:HI (not:HI (reg/v:HI 112 [ u16_1D.1800 ]))
(const_int 1 [0x1])))
Successfully matched this instruction:
(set (reg:HI 117)
(not:HI (reg/v:HI 112 [ u16_1D.1800 ])))
Successfully matched this instruction:
(set (reg:HI 116)
(and:HI (reg:HI 117)
(const_int 1 [0x1])))
allowing combination of insns 18, 19 and 20
original costs 0 + 4 + 4 = 0
replacement costs 4 + 4 = 8
deferring deletion of insn with uid = 18.
modifying insn i2 19: r117:HI=!r112:HI
deferring rescan insn with uid = 19.
modifying insn i3 20: {r116:HI=r117:HI&0x1;clobber flags:CC;}
REG_UNUSED flags:CC
REG_DEAD r117:HI
deferring rescan insn with uid = 20.
...
Trying 19 -> 20:
Successfully matched this instruction:
(parallel [
(set (reg:HI 116)
(xor:HI (reg/v:HI 112 [ u16_1D.1800 ])
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
])
allowing combination of insns 19 and 20
original costs 4 + 4 = 8
replacement cost 4
deferring deletion of insn with uid = 19.
modifying insn i3 20: {r116:HI=r112:HI^0x1;clobber flags:CC;}
REG_UNUSED flags:CC
deferring rescan insn with uid = 20.
...
Which looks wrong, since it changes "r116:HI=!r112:HI&1" (can be 0 or 1) to
"r116:HI=r112:HI^0x1" (can be anything).
Also, the costs dump in the first replacement looks wrong:
original costs 0 + 4 + 4 = 0
$ x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-247635-checking-yes-rtl-df-extra-nographite-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--without-cloog --without-ppl --without-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-247635-checking-yes-rtl-df-extra-nographite-amd64
Thread model: posix
gcc version 8.0.0 20170505 (experimental) (GCC)
Tested revisions:
trunk r247635 - FAIL
7-branch r247545 - FAIL
6-branch r247359 - FAIL
5-branch r247456 - OK