https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120892
Josef Melcr <jmelcr at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jmelcr at gcc dot gnu.org
--- Comment #6 from Josef Melcr <jmelcr at gcc dot gnu.org> ---
(In reply to GCC Commits from comment #5)
> The master branch has been updated by Kyrylo Tkachov <[email protected]>:
>
> https://gcc.gnu.org/g:5c23bb074af23f00dd3fe1745b9dd99245fa4bba
>
> commit r17-2164-g5c23bb074af23f00dd3fe1745b9dd99245fa4bba
> Author: Kyrylo Tkachov <[email protected]>
> Date: Tue Jun 30 14:04:02 2026 +0200
>
> Remove the path-splitting pass and deprecate -fsplit-paths [PR120892]
>
> pass_split_paths duplicates the join block of an IF-THEN-ELSE that feeds
> a
> loop latch, splitting the two paths to the backedge. It runs only at
> -O3.
> In practice it interacts badly with later optimizations: it duplicates
> the
> loop body before loads have been commoned and before if-conversion runs,
> so
> it can block both loop unrolling (PR120892) and if-conversion of the
> duplicated diamond, while its own heuristic already declines about half
> of
> all candidate blocks, most often to avoid spoiling if-conversion.
>
> Remove the pass and deprecate the -fsplit-paths option. The option is
> kept
> accepted for backward compatibility via the Ignore flag and now does
> nothing,
> matching how other optimization options have been retired (for example
> -ftree-lrs). param_max_jump_thread_duplication_stmts is retained as it
> is
> shared with the jump-threading passes.
>
> Statistics from the pass on SPEC CPU 2026 (intrate + fprate, counted
> from the
> split-paths dump):
>
> candidates splits declined to protect
> if-conversion
> -O3 122894 62050 60844 37166
> -O3 -flto=auto 52423 21257 31166 21822
>
> The pass splits about half of the blocks it considers and declines the
> rest,
> most often to avoid spoiling if-conversion. The duplication grows .text
> by
> 0.32% at -O3 and 0.24% at -O3 -flto=auto.
>
> Andrea and Jeff indicated in PR120892 that removing -fsplit-paths may be
> the way to go there.
>
> -fsplit-paths also complicates the control-flow and defeats the
> load-commoning necessary to get good if-conversion of the hot loop from
> Snappy from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125557#c13 .
>
> Bootstrapped and tested on aarch64-none-linux-gnu and x86_64-linux.
>
> gcc/ChangeLog:
>
> PR tree-optimization/120892
> * gimple-ssa-split-paths.cc: Remove.
> * passes.def (pass_split_paths): Remove.
> * tree-pass.h (make_pass_split_paths): Remove.
> * Makefile.in (OBJS): Remove gimple-ssa-split-paths.o.
> * timevar.def (TV_SPLIT_PATHS): Remove.
> * opts.cc (default_options_table): Remove the OPT_LEVELS_3_PLUS
> entry
> for OPT_fsplit_paths.
> * common.opt (fsplit-paths): Make it a deprecated no-op using
> Ignore.
> * doc/invoke.texi (-fsplit-paths): Document as deprecated and
> remove it
> from the option summary and the -O3 list.
>
> gcc/testsuite/ChangeLog:
>
> PR tree-optimization/120892
> * gcc.dg/tree-ssa/split-path-1.c: Move to...
> * gcc.c-torture/execute/split-path-1.c: ...here. Adjust to a
> plain
> compile and run test without the split-paths dump scan.
> * gcc.dg/tree-ssa/split-path-2.c: Move to...
> * gcc.c-torture/compile/split-path-2.c: ...here. Adjust to a
> compile-only test without the split-paths dump scan.
> * gcc.dg/tree-ssa/split-path-3.c: Move to...
> * gcc.c-torture/compile/split-path-3.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-4.c: Move to...
> * gcc.c-torture/compile/split-path-4.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-5.c: Move to...
> * gcc.c-torture/compile/split-path-5.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-6.c: Move to...
> * gcc.c-torture/compile/split-path-6.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-7.c: Move to...
> * gcc.c-torture/compile/split-path-7.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-8.c: Move to...
> * gcc.c-torture/compile/split-path-8.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-9.c: Move to...
> * gcc.c-torture/compile/split-path-9.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-10.c: Move to...
> * gcc.c-torture/compile/split-path-10.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-11.c: Move to...
> * gcc.c-torture/compile/split-path-11.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-12.c: Move to...
> * gcc.c-torture/compile/split-path-12.c: ...here. Likewise.
> * gcc.dg/tree-ssa/split-path-13.c: Move to...
> * gcc.c-torture/compile/split-path-13.c: ...here. Likewise.
> * gcc.dg/tree-ssa/pr69270.c: Move to...
> * gcc.c-torture/compile/pr69270.c: ...here. Likewise.
> * g++.dg/tree-ssa/pr88797.C: Move to...
> * g++.dg/torture/pr88797.C: ...here. Adjust to a compile-only
> test.
> * gcc.target/i386/pr106450.c: Remove -fsplit-paths from
> dg-options.
>
> Signed-off-by: Kyrylo Tkachov <[email protected]>
Should we report the regressions caused by this patch? I am not sure if there
is any point in it if the pass is getting removed. Found one regression so far.