[Bug target/125992] [16/17 Regression] veusz miscompilation on s390x with -march=z13 -O2 since r16-3301
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jun 27 19:39:53 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125992
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:32c1d1988cc7f56f1a7a9e550936267de6b152c2
commit r16-9180-g32c1d1988cc7f56f1a7a9e550936267de6b152c2
Author: Jakub Jelinek <jakub@redhat.com>
Date: Sat Jun 27 21:33:00 2026 +0200
s390: Fix up *brx_stage1_<GPR:mode> [PR125992]
The following testcase is miscompiled since r16-3301 but the problem is
much
older.
The *brx_stage1_<GPR:mode> define_insn_and_split pattern doesn't describe
that it clobbers CC_REGNUM, but splits (before reload) into something which
does clobber CC_REGNUM unconditionally.
Since r16-3301 on this testcase the late_combine1 pass figures it can
extend
the lifetime of CC_REGNUM across such an instruction, but when it is in
split1 pass split into something that does clobber CC_REGNUM, the value
from
earlier comparison till later use is not preserved anymore.
The following patch fixes it by adding clobber for CC_REGNUM even to the
*brx_stage1_<GPR:mode> pattern, so that df/late_combine etc. know that it
is
CC_REGNUM is clobbered by it.
I had to put the clobber before the match_scratch clobber, otherwise there
is endless loop trying to split this insn in split1 pass, the insn it is
split into matches the pattern again and is split again etc. forever.
Even with this patch combine can match this insn, we have code to add the
missing clobbers if the register isn't live across it.
2026-06-27 Jakub Jelinek <jakub@redhat.com>
PR target/125992
* config/s390/s390.md (*brx_stage1_<GPR:mode>): Add CC_REGNUM
clobber.
* gcc.target/s390/pr125992.c: New test.
Reviewed-by: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
(cherry picked from commit 13529401b15fe82c0b1d44b0b0a8bf5d2d72a1b3)
More information about the Gcc-bugs
mailing list