Go to file
Jakub Jelinek 526fbcfa63 internal-fn: Call do_pending_stack_adjust in expand_SPACESHIP [PR104679]
The following testcase is miscompiled on ia32 at -O2, because
when expand_SPACESHIP is called, we have pending stack adjustment
from the foo call right before it.
Now, ix86_expand_fp_spaceship uses emit_jump_insn several times
but then emit_jump also several times.  While emit_jump_insn doesn't
do do_pending_stack_adjust (), emit_jump does, so we end up with:
...
    8: call [`_Z3foodl'] argc:0x10
      REG_CALL_DECL `_Z3foodl'
    9: r88:DF=[`a']
   10: r89:HI=unspec[cmp(r88:DF,0.0)] 25
   11: flags:CC=unspec[r89:HI] 26
   12: pc={(unordered(flags:CCFP,0))?L27:pc}
      REG_BR_PROB 536868
   66: NOTE_INSN_BASIC_BLOCK 4
   13: pc={(uneq(flags:CCFP,0))?L19:pc}
      REG_BR_PROB 214748364
   67: NOTE_INSN_BASIC_BLOCK 5
   14: pc={(flags:CCFP>0)?L23:pc}
      REG_BR_PROB 536870916
   68: NOTE_INSN_BASIC_BLOCK 6
   15: r86:SI=0xffffffffffffffff
   16: {sp:SI=sp:SI+0x10;clobber flags:CC;}
      REG_ARGS_SIZE 0
   17: pc=L29
   18: barrier
   19: L19:
   69: NOTE_INSN_BASIC_BLOCK 7
...
The sp += 16 pending stuck adjust was emitted in the middle of the
sequence and is effective only for the single case of the 4 possibilities
where .SPACESHIP returns -1, in all other cases the stack isn't adjusted
and so we ICE during dwarf2cfi.

Now, we could either call do_pending_stack_adjust in
ix86_expand_fp_spaceship, or use there calls that actually don't call
do_pending_stack_adjust (but having the stack adjustment across branches is
generally undesirable), or we can call it in expand_SPACESHIP for all
targets (note, just i386 currently implements it).
I chose the generic code because e.g. expand_{addsub,neg,mul}_overflow
in the same file also call do_pending_stack_adjust in internal-fn.cc for the
same reasons, that it is expected that most if not all targets will expand
those through jumps and we don't want all of the targets to need to deal
with that.

2022-02-25  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/104679
	* internal-fn.cc (expand_SPACESHIP): Call do_pending_stack_adjust.

	* g++.dg/torture/pr104679.C: New test.
2022-02-25 10:56:46 +01:00
c++tools
config
contrib
fixincludes
gcc internal-fn: Call do_pending_stack_adjust in expand_SPACESHIP [PR104679] 2022-02-25 10:56:46 +01:00
gnattools
gotools Daily bump. 2022-02-14 00:16:23 +00:00
include
INSTALL
intl
libada
libatomic
libbacktrace Daily bump. 2022-02-18 00:16:39 +00:00
libcc1
libcody
libcpp Daily bump. 2022-02-12 00:16:23 +00:00
libdecnumber
libffi
libgcc Daily bump. 2022-02-25 00:16:20 +00:00
libgfortran
libgo libgo: update README.gcc 2022-02-22 15:34:46 -08:00
libgomp Daily bump. 2022-02-25 00:16:20 +00:00
libiberty Daily bump. 2022-02-23 00:16:24 +00:00
libitm
libobjc
liboffloadmic
libphobos Daily bump. 2022-02-21 00:16:24 +00:00
libquadmath
libsanitizer Daily bump. 2022-02-16 00:16:26 +00:00
libssp
libstdc++-v3 Daily bump. 2022-02-25 00:16:20 +00:00
libvtv
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2022-02-23 00:16:24 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Update my email address. 2022-02-22 15:55:05 +00:00
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.