![]() The following patch is miscompiled, because during the limited SSA name coalescing the bitintlower pass does we incorrectly don't register a conflict. This is on <bb 4> [local count: 1073741824]: # b_17 = PHI <b_19(3), 8(2)> g.4_13 = g; _14 = g.4_13 >> 50; _15 = (unsigned int) _14; _21 = b_17; _16 = (unsigned int) _21; s_22 = _15 + _16; return s_22; basic block where in the map->bitint bitmap we track 14, 17 and 19. The build_bitint_stmt_ssa_conflicts "hook" has special code where it tracks uses at the final statements of mergeable operations, so e.g. the _16 = (unsigned int) _21; statement is considered to be use of b_17 because _21 is not in map->bitmap (or large_huge.m_names), i.e. is mergeable. The problem is that build_ssa_conflict_graph has special code to handle SSA_NAME copies and _21 = b_17; is gimple_assign_copy_p. In such cases it calls live_track_clear_var on the rhs1. The problem is that on the above bb, after we note in the _16 = (unsigned int) _21; stmt we need b_17 the generic code makes us forget that because of the copy statement, and then build_bitint_stmt_ssa_conflicts ignores it completely (because _21 is large/huge bitint and is not in map->bitint, so assumed to be handled by a later stmt in the bb, for backwards walk like this before this one). As the b_17 use is ignored, the coalescing thinks it can put all of b_17, b_19 and _14 into the same partition, which is wrong, while we can and should coalesce b_17 and b_19, _14 needs to be a different temporary because b_17 is set before and used after _14 has been written. The following patch fixes it by handling gimple_assign_copy_p in two separate spots, move the generic coalesce handling of it after build_ssa_conflict_graph (where build_ssa_conflict_graph handling doesn't fall through to that, it does continue after the call) and inside of build_ssa_conflict_graph it performs it too, but only if the lhs is not mergeable large/huge bitint. 2025-04-12 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/119722 * gimple-lower-bitint.h (build_bitint_stmt_ssa_conflicts): Add CLEAR argument. * gimple-lower-bitint.cc (build_bitint_stmt_ssa_conflicts): Add CLEAR argument. Call clear on gimple_assign_copy_p rhs1 if lhs is large/huge bitint unless lhs is not in names. * tree-ssa-coalesce.cc (build_ssa_conflict_graph): Adjust build_bitint_stmt_ssa_conflicts caller. Move gimple_assign_copy_p handling to after the build_bitint_stmt_ssa_conflicts call. * gcc.dg/torture/bitint-77.c: New test. |
||
---|---|---|
.forgejo | ||
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgcobol | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.b4-config | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
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.