GCC modified for the FreeChainXenon project
![]() v8 changes: 1. Use hotter_than_inner_loop instead of colder to store a hotter loop nearest to loop. 2. Update the logic in fill_coldest_and_hotter_out_loop and get_coldest_out_loop to make common case O(1). 3. Update function argument bb_colder_than_loop_preheader. 4. Make cached array to vec<class *loop> for index checking. v7 changes: 1. Refine get_coldest_out_loop to replace loop with checking pre-computed coldest_outermost_loop and colder_than_inner_loop. 2. Add function fill_cold_out_loop, compute coldest_outermost_loop and colder_than_inner_loop recursively without loop. v6 changes: 1. Add function fill_coldest_out_loop to pre compute the coldest outermost loop for each loop. 2. Rename find_coldest_out_loop to get_coldest_out_loop. 3. Add testcase ssa-lim-22.c to differentiate with ssa-lim-19.c. v5 changes: 1. Refine comments for new functions. 2. Use basic_block instead of count in bb_colder_than_loop_preheader to align with function name. 3. Refine with simpler implementation for get_coldest_out_loop and ref_in_loop_hot_body::operator for better understanding. v4 changes: 1. Sort out profile_count comparision to function bb_cold_than_loop_preheader. 2. Update ref_in_loop_hot_body::operator () to find cold_loop before compare. 3. Split RTL invariant motion part out. 4. Remove aux changes. v3 changes: 1. Handle max_loop in determine_max_movement instead of outermost_invariant_loop. 2. Remove unnecessary changes. 3. Add for_all_locs_in_loop (loop, ref, ref_in_loop_hot_body) in can_sm_ref_p. 4. "gsi_next (&bsi);" in move_computations_worker is kept since it caused infinite loop when implementing v1 and the iteration is missed to be updated actually. v1: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576488.html v2: https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579086.html v3: https://gcc.gnu.org/pipermail/gcc-patches/2021-September/580211.html v4: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581231.html v5: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581961.html ... v8: https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586209.html There was a patch trying to avoid move cold block out of loop: https://gcc.gnu.org/pipermail/gcc/2014-November/215551.html Richard suggested to "never hoist anything from a bb with lower execution frequency to a bb with higher one in LIM invariantness_dom_walker before_dom_children". In gimple LIM analysis, add get_coldest_out_loop to move invariants to expected target loop, if profile count of the loop bb is colder than target loop preheader, it won't be hoisted out of loop. Likely for store motion, if all locations of the REF in loop is cold, don't do store motion of it. SPEC2017 performance evaluation shows 1% performance improvement for intrate GEOMEAN and no obvious regression for others. Especially, 500.perlbench_r +7.52% (Perf shows function S_regtry of perlbench is largely improved.), and 548.exchange2_r+1.98%, 526.blender_r +1.00% on P8LE. gcc/ChangeLog: 2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com> * tree-ssa-loop-im.c (bb_colder_than_loop_preheader): New function. (get_coldest_out_loop): New function. (determine_max_movement): Use get_coldest_out_loop. (move_computations_worker): Adjust and fix iteration udpate. (class ref_in_loop_hot_body): New functor. (ref_in_loop_hot_body::operator): New. (can_sm_ref_p): Use for_all_locs_in_loop. (fill_coldest_and_hotter_out_loop): New. (tree_ssa_lim_finalize): Free coldest_outermost_loop and hotter_than_inner_loop. (loop_invariant_motion_in_fun): Call fill_coldest_and_hotter_out_loop. gcc/testsuite/ChangeLog: 2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com> * gcc.dg/tree-ssa/recip-3.c: Adjust. * gcc.dg/tree-ssa/ssa-lim-19.c: New test. * gcc.dg/tree-ssa/ssa-lim-20.c: New test. * gcc.dg/tree-ssa/ssa-lim-21.c: New test. * gcc.dg/tree-ssa/ssa-lim-22.c: New test. * gcc.dg/tree-ssa/ssa-lim-23.c: New test. |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.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 | ||
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.