aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-split.cc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-01-14 16:56:44 +0100
committerMartin Liska <mliska@suse.cz>2022-01-17 22:12:04 +0100
commit5c69acb32329d49e58c26fa41ae74229a52b9106 (patch)
treeddb05f9d73afb6f998457d2ac4b720e3b3b60483 /gcc/tree-ssa-loop-split.cc
parent490e23032baaece71f2ec09fa1805064b150fbc2 (diff)
downloadgcc-5c69acb32329d49e58c26fa41ae74229a52b9106.zip
gcc-5c69acb32329d49e58c26fa41ae74229a52b9106.tar.gz
gcc-5c69acb32329d49e58c26fa41ae74229a52b9106.tar.bz2
Rename .c files to .cc files.
gcc/ada/ChangeLog: * adadecode.c: Moved to... * adadecode.cc: ...here. * affinity.c: Moved to... * affinity.cc: ...here. * argv-lynxos178-raven-cert.c: Moved to... * argv-lynxos178-raven-cert.cc: ...here. * argv.c: Moved to... * argv.cc: ...here. * aux-io.c: Moved to... * aux-io.cc: ...here. * cio.c: Moved to... * cio.cc: ...here. * cstreams.c: Moved to... * cstreams.cc: ...here. * env.c: Moved to... * env.cc: ...here. * exit.c: Moved to... * exit.cc: ...here. * expect.c: Moved to... * expect.cc: ...here. * final.c: Moved to... * final.cc: ...here. * gcc-interface/cuintp.c: Moved to... * gcc-interface/cuintp.cc: ...here. * gcc-interface/decl.c: Moved to... * gcc-interface/decl.cc: ...here. * gcc-interface/misc.c: Moved to... * gcc-interface/misc.cc: ...here. * gcc-interface/targtyps.c: Moved to... * gcc-interface/targtyps.cc: ...here. * gcc-interface/trans.c: Moved to... * gcc-interface/trans.cc: ...here. * gcc-interface/utils.c: Moved to... * gcc-interface/utils.cc: ...here. * gcc-interface/utils2.c: Moved to... * gcc-interface/utils2.cc: ...here. * init.c: Moved to... * init.cc: ...here. * initialize.c: Moved to... * initialize.cc: ...here. * libgnarl/thread.c: Moved to... * libgnarl/thread.cc: ...here. * link.c: Moved to... * link.cc: ...here. * locales.c: Moved to... * locales.cc: ...here. * mkdir.c: Moved to... * mkdir.cc: ...here. * raise.c: Moved to... * raise.cc: ...here. * rtfinal.c: Moved to... * rtfinal.cc: ...here. * rtinit.c: Moved to... * rtinit.cc: ...here. * seh_init.c: Moved to... * seh_init.cc: ...here. * sigtramp-armdroid.c: Moved to... * sigtramp-armdroid.cc: ...here. * sigtramp-ios.c: Moved to... * sigtramp-ios.cc: ...here. * sigtramp-qnx.c: Moved to... * sigtramp-qnx.cc: ...here. * sigtramp-vxworks.c: Moved to... * sigtramp-vxworks.cc: ...here. * socket.c: Moved to... * socket.cc: ...here. * tracebak.c: Moved to... * tracebak.cc: ...here. * version.c: Moved to... * version.cc: ...here. * vx_stack_info.c: Moved to... * vx_stack_info.cc: ...here. gcc/ChangeLog: * adjust-alignment.c: Moved to... * adjust-alignment.cc: ...here. * alias.c: Moved to... * alias.cc: ...here. * alloc-pool.c: Moved to... * alloc-pool.cc: ...here. * asan.c: Moved to... * asan.cc: ...here. * attribs.c: Moved to... * attribs.cc: ...here. * auto-inc-dec.c: Moved to... * auto-inc-dec.cc: ...here. * auto-profile.c: Moved to... * auto-profile.cc: ...here. * bb-reorder.c: Moved to... * bb-reorder.cc: ...here. * bitmap.c: Moved to... * bitmap.cc: ...here. * btfout.c: Moved to... * btfout.cc: ...here. * builtins.c: Moved to... * builtins.cc: ...here. * caller-save.c: Moved to... * caller-save.cc: ...here. * calls.c: Moved to... * calls.cc: ...here. * ccmp.c: Moved to... * ccmp.cc: ...here. * cfg.c: Moved to... * cfg.cc: ...here. * cfganal.c: Moved to... * cfganal.cc: ...here. * cfgbuild.c: Moved to... * cfgbuild.cc: ...here. * cfgcleanup.c: Moved to... * cfgcleanup.cc: ...here. * cfgexpand.c: Moved to... * cfgexpand.cc: ...here. * cfghooks.c: Moved to... * cfghooks.cc: ...here. * cfgloop.c: Moved to... * cfgloop.cc: ...here. * cfgloopanal.c: Moved to... * cfgloopanal.cc: ...here. * cfgloopmanip.c: Moved to... * cfgloopmanip.cc: ...here. * cfgrtl.c: Moved to... * cfgrtl.cc: ...here. * cgraph.c: Moved to... * cgraph.cc: ...here. * cgraphbuild.c: Moved to... * cgraphbuild.cc: ...here. * cgraphclones.c: Moved to... * cgraphclones.cc: ...here. * cgraphunit.c: Moved to... * cgraphunit.cc: ...here. * collect-utils.c: Moved to... * collect-utils.cc: ...here. * collect2-aix.c: Moved to... * collect2-aix.cc: ...here. * collect2.c: Moved to... * collect2.cc: ...here. * combine-stack-adj.c: Moved to... * combine-stack-adj.cc: ...here. * combine.c: Moved to... * combine.cc: ...here. * common/common-targhooks.c: Moved to... * common/common-targhooks.cc: ...here. * common/config/aarch64/aarch64-common.c: Moved to... * common/config/aarch64/aarch64-common.cc: ...here. * common/config/alpha/alpha-common.c: Moved to... * common/config/alpha/alpha-common.cc: ...here. * common/config/arc/arc-common.c: Moved to... * common/config/arc/arc-common.cc: ...here. * common/config/arm/arm-common.c: Moved to... * common/config/arm/arm-common.cc: ...here. * common/config/avr/avr-common.c: Moved to... * common/config/avr/avr-common.cc: ...here. * common/config/bfin/bfin-common.c: Moved to... * common/config/bfin/bfin-common.cc: ...here. * common/config/bpf/bpf-common.c: Moved to... * common/config/bpf/bpf-common.cc: ...here. * common/config/c6x/c6x-common.c: Moved to... * common/config/c6x/c6x-common.cc: ...here. * common/config/cr16/cr16-common.c: Moved to... * common/config/cr16/cr16-common.cc: ...here. * common/config/cris/cris-common.c: Moved to... * common/config/cris/cris-common.cc: ...here. * common/config/csky/csky-common.c: Moved to... * common/config/csky/csky-common.cc: ...here. * common/config/default-common.c: Moved to... * common/config/default-common.cc: ...here. * common/config/epiphany/epiphany-common.c: Moved to... * common/config/epiphany/epiphany-common.cc: ...here. * common/config/fr30/fr30-common.c: Moved to... * common/config/fr30/fr30-common.cc: ...here. * common/config/frv/frv-common.c: Moved to... * common/config/frv/frv-common.cc: ...here. * common/config/gcn/gcn-common.c: Moved to... * common/config/gcn/gcn-common.cc: ...here. * common/config/h8300/h8300-common.c: Moved to... * common/config/h8300/h8300-common.cc: ...here. * common/config/i386/i386-common.c: Moved to... * common/config/i386/i386-common.cc: ...here. * common/config/ia64/ia64-common.c: Moved to... * common/config/ia64/ia64-common.cc: ...here. * common/config/iq2000/iq2000-common.c: Moved to... * common/config/iq2000/iq2000-common.cc: ...here. * common/config/lm32/lm32-common.c: Moved to... * common/config/lm32/lm32-common.cc: ...here. * common/config/m32r/m32r-common.c: Moved to... * common/config/m32r/m32r-common.cc: ...here. * common/config/m68k/m68k-common.c: Moved to... * common/config/m68k/m68k-common.cc: ...here. * common/config/mcore/mcore-common.c: Moved to... * common/config/mcore/mcore-common.cc: ...here. * common/config/microblaze/microblaze-common.c: Moved to... * common/config/microblaze/microblaze-common.cc: ...here. * common/config/mips/mips-common.c: Moved to... * common/config/mips/mips-common.cc: ...here. * common/config/mmix/mmix-common.c: Moved to... * common/config/mmix/mmix-common.cc: ...here. * common/config/mn10300/mn10300-common.c: Moved to... * common/config/mn10300/mn10300-common.cc: ...here. * common/config/msp430/msp430-common.c: Moved to... * common/config/msp430/msp430-common.cc: ...here. * common/config/nds32/nds32-common.c: Moved to... * common/config/nds32/nds32-common.cc: ...here. * common/config/nios2/nios2-common.c: Moved to... * common/config/nios2/nios2-common.cc: ...here. * common/config/nvptx/nvptx-common.c: Moved to... * common/config/nvptx/nvptx-common.cc: ...here. * common/config/or1k/or1k-common.c: Moved to... * common/config/or1k/or1k-common.cc: ...here. * common/config/pa/pa-common.c: Moved to... * common/config/pa/pa-common.cc: ...here. * common/config/pdp11/pdp11-common.c: Moved to... * common/config/pdp11/pdp11-common.cc: ...here. * common/config/pru/pru-common.c: Moved to... * common/config/pru/pru-common.cc: ...here. * common/config/riscv/riscv-common.c: Moved to... * common/config/riscv/riscv-common.cc: ...here. * common/config/rs6000/rs6000-common.c: Moved to... * common/config/rs6000/rs6000-common.cc: ...here. * common/config/rx/rx-common.c: Moved to... * common/config/rx/rx-common.cc: ...here. * common/config/s390/s390-common.c: Moved to... * common/config/s390/s390-common.cc: ...here. * common/config/sh/sh-common.c: Moved to... * common/config/sh/sh-common.cc: ...here. * common/config/sparc/sparc-common.c: Moved to... * common/config/sparc/sparc-common.cc: ...here. * common/config/tilegx/tilegx-common.c: Moved to... * common/config/tilegx/tilegx-common.cc: ...here. * common/config/tilepro/tilepro-common.c: Moved to... * common/config/tilepro/tilepro-common.cc: ...here. * common/config/v850/v850-common.c: Moved to... * common/config/v850/v850-common.cc: ...here. * common/config/vax/vax-common.c: Moved to... * common/config/vax/vax-common.cc: ...here. * common/config/visium/visium-common.c: Moved to... * common/config/visium/visium-common.cc: ...here. * common/config/xstormy16/xstormy16-common.c: Moved to... * common/config/xstormy16/xstormy16-common.cc: ...here. * common/config/xtensa/xtensa-common.c: Moved to... * common/config/xtensa/xtensa-common.cc: ...here. * compare-elim.c: Moved to... * compare-elim.cc: ...here. * config/aarch64/aarch64-bti-insert.c: Moved to... * config/aarch64/aarch64-bti-insert.cc: ...here. * config/aarch64/aarch64-builtins.c: Moved to... * config/aarch64/aarch64-builtins.cc: ...here. * config/aarch64/aarch64-c.c: Moved to... * config/aarch64/aarch64-c.cc: ...here. * config/aarch64/aarch64-d.c: Moved to... * config/aarch64/aarch64-d.cc: ...here. * config/aarch64/aarch64.c: Moved to... * config/aarch64/aarch64.cc: ...here. * config/aarch64/cortex-a57-fma-steering.c: Moved to... * config/aarch64/cortex-a57-fma-steering.cc: ...here. * config/aarch64/driver-aarch64.c: Moved to... * config/aarch64/driver-aarch64.cc: ...here. * config/aarch64/falkor-tag-collision-avoidance.c: Moved to... * config/aarch64/falkor-tag-collision-avoidance.cc: ...here. * config/aarch64/host-aarch64-darwin.c: Moved to... * config/aarch64/host-aarch64-darwin.cc: ...here. * config/alpha/alpha.c: Moved to... * config/alpha/alpha.cc: ...here. * config/alpha/driver-alpha.c: Moved to... * config/alpha/driver-alpha.cc: ...here. * config/arc/arc-c.c: Moved to... * config/arc/arc-c.cc: ...here. * config/arc/arc.c: Moved to... * config/arc/arc.cc: ...here. * config/arc/driver-arc.c: Moved to... * config/arc/driver-arc.cc: ...here. * config/arm/aarch-common.c: Moved to... * config/arm/aarch-common.cc: ...here. * config/arm/arm-builtins.c: Moved to... * config/arm/arm-builtins.cc: ...here. * config/arm/arm-c.c: Moved to... * config/arm/arm-c.cc: ...here. * config/arm/arm-d.c: Moved to... * config/arm/arm-d.cc: ...here. * config/arm/arm.c: Moved to... * config/arm/arm.cc: ...here. * config/arm/driver-arm.c: Moved to... * config/arm/driver-arm.cc: ...here. * config/avr/avr-c.c: Moved to... * config/avr/avr-c.cc: ...here. * config/avr/avr-devices.c: Moved to... * config/avr/avr-devices.cc: ...here. * config/avr/avr-log.c: Moved to... * config/avr/avr-log.cc: ...here. * config/avr/avr.c: Moved to... * config/avr/avr.cc: ...here. * config/avr/driver-avr.c: Moved to... * config/avr/driver-avr.cc: ...here. * config/avr/gen-avr-mmcu-specs.c: Moved to... * config/avr/gen-avr-mmcu-specs.cc: ...here. * config/avr/gen-avr-mmcu-texi.c: Moved to... * config/avr/gen-avr-mmcu-texi.cc: ...here. * config/bfin/bfin.c: Moved to... * config/bfin/bfin.cc: ...here. * config/bpf/bpf.c: Moved to... * config/bpf/bpf.cc: ...here. * config/bpf/coreout.c: Moved to... * config/bpf/coreout.cc: ...here. * config/c6x/c6x.c: Moved to... * config/c6x/c6x.cc: ...here. * config/cr16/cr16.c: Moved to... * config/cr16/cr16.cc: ...here. * config/cris/cris.c: Moved to... * config/cris/cris.cc: ...here. * config/csky/csky.c: Moved to... * config/csky/csky.cc: ...here. * config/darwin-c.c: Moved to... * config/darwin-c.cc: ...here. * config/darwin-d.c: Moved to... * config/darwin-d.cc: ...here. * config/darwin-driver.c: Moved to... * config/darwin-driver.cc: ...here. * config/darwin-f.c: Moved to... * config/darwin-f.cc: ...here. * config/darwin.c: Moved to... * config/darwin.cc: ...here. * config/default-c.c: Moved to... * config/default-c.cc: ...here. * config/default-d.c: Moved to... * config/default-d.cc: ...here. * config/dragonfly-d.c: Moved to... * config/dragonfly-d.cc: ...here. * config/epiphany/epiphany.c: Moved to... * config/epiphany/epiphany.cc: ...here. * config/epiphany/mode-switch-use.c: Moved to... * config/epiphany/mode-switch-use.cc: ...here. * config/epiphany/resolve-sw-modes.c: Moved to... * config/epiphany/resolve-sw-modes.cc: ...here. * config/fr30/fr30.c: Moved to... * config/fr30/fr30.cc: ...here. * config/freebsd-d.c: Moved to... * config/freebsd-d.cc: ...here. * config/frv/frv.c: Moved to... * config/frv/frv.cc: ...here. * config/ft32/ft32.c: Moved to... * config/ft32/ft32.cc: ...here. * config/gcn/driver-gcn.c: Moved to... * config/gcn/driver-gcn.cc: ...here. * config/gcn/gcn-run.c: Moved to... * config/gcn/gcn-run.cc: ...here. * config/gcn/gcn-tree.c: Moved to... * config/gcn/gcn-tree.cc: ...here. * config/gcn/gcn.c: Moved to... * config/gcn/gcn.cc: ...here. * config/gcn/mkoffload.c: Moved to... * config/gcn/mkoffload.cc: ...here. * config/glibc-c.c: Moved to... * config/glibc-c.cc: ...here. * config/glibc-d.c: Moved to... * config/glibc-d.cc: ...here. * config/h8300/h8300.c: Moved to... * config/h8300/h8300.cc: ...here. * config/host-darwin.c: Moved to... * config/host-darwin.cc: ...here. * config/host-hpux.c: Moved to... * config/host-hpux.cc: ...here. * config/host-linux.c: Moved to... * config/host-linux.cc: ...here. * config/host-netbsd.c: Moved to... * config/host-netbsd.cc: ...here. * config/host-openbsd.c: Moved to... * config/host-openbsd.cc: ...here. * config/host-solaris.c: Moved to... * config/host-solaris.cc: ...here. * config/i386/djgpp.c: Moved to... * config/i386/djgpp.cc: ...here. * config/i386/driver-i386.c: Moved to... * config/i386/driver-i386.cc: ...here. * config/i386/driver-mingw32.c: Moved to... * config/i386/driver-mingw32.cc: ...here. * config/i386/gnu-property.c: Moved to... * config/i386/gnu-property.cc: ...here. * config/i386/host-cygwin.c: Moved to... * config/i386/host-cygwin.cc: ...here. * config/i386/host-i386-darwin.c: Moved to... * config/i386/host-i386-darwin.cc: ...here. * config/i386/host-mingw32.c: Moved to... * config/i386/host-mingw32.cc: ...here. * config/i386/i386-builtins.c: Moved to... * config/i386/i386-builtins.cc: ...here. * config/i386/i386-c.c: Moved to... * config/i386/i386-c.cc: ...here. * config/i386/i386-d.c: Moved to... * config/i386/i386-d.cc: ...here. * config/i386/i386-expand.c: Moved to... * config/i386/i386-expand.cc: ...here. * config/i386/i386-features.c: Moved to... * config/i386/i386-features.cc: ...here. * config/i386/i386-options.c: Moved to... * config/i386/i386-options.cc: ...here. * config/i386/i386.c: Moved to... * config/i386/i386.cc: ...here. * config/i386/intelmic-mkoffload.c: Moved to... * config/i386/intelmic-mkoffload.cc: ...here. * config/i386/msformat-c.c: Moved to... * config/i386/msformat-c.cc: ...here. * config/i386/winnt-cxx.c: Moved to... * config/i386/winnt-cxx.cc: ...here. * config/i386/winnt-d.c: Moved to... * config/i386/winnt-d.cc: ...here. * config/i386/winnt-stubs.c: Moved to... * config/i386/winnt-stubs.cc: ...here. * config/i386/winnt.c: Moved to... * config/i386/winnt.cc: ...here. * config/i386/x86-tune-sched-atom.c: Moved to... * config/i386/x86-tune-sched-atom.cc: ...here. * config/i386/x86-tune-sched-bd.c: Moved to... * config/i386/x86-tune-sched-bd.cc: ...here. * config/i386/x86-tune-sched-core.c: Moved to... * config/i386/x86-tune-sched-core.cc: ...here. * config/i386/x86-tune-sched.c: Moved to... * config/i386/x86-tune-sched.cc: ...here. * config/ia64/ia64-c.c: Moved to... * config/ia64/ia64-c.cc: ...here. * config/ia64/ia64.c: Moved to... * config/ia64/ia64.cc: ...here. * config/iq2000/iq2000.c: Moved to... * config/iq2000/iq2000.cc: ...here. * config/linux.c: Moved to... * config/linux.cc: ...here. * config/lm32/lm32.c: Moved to... * config/lm32/lm32.cc: ...here. * config/m32c/m32c-pragma.c: Moved to... * config/m32c/m32c-pragma.cc: ...here. * config/m32c/m32c.c: Moved to... * config/m32c/m32c.cc: ...here. * config/m32r/m32r.c: Moved to... * config/m32r/m32r.cc: ...here. * config/m68k/m68k.c: Moved to... * config/m68k/m68k.cc: ...here. * config/mcore/mcore.c: Moved to... * config/mcore/mcore.cc: ...here. * config/microblaze/microblaze-c.c: Moved to... * config/microblaze/microblaze-c.cc: ...here. * config/microblaze/microblaze.c: Moved to... * config/microblaze/microblaze.cc: ...here. * config/mips/driver-native.c: Moved to... * config/mips/driver-native.cc: ...here. * config/mips/frame-header-opt.c: Moved to... * config/mips/frame-header-opt.cc: ...here. * config/mips/mips-d.c: Moved to... * config/mips/mips-d.cc: ...here. * config/mips/mips.c: Moved to... * config/mips/mips.cc: ...here. * config/mmix/mmix.c: Moved to... * config/mmix/mmix.cc: ...here. * config/mn10300/mn10300.c: Moved to... * config/mn10300/mn10300.cc: ...here. * config/moxie/moxie.c: Moved to... * config/moxie/moxie.cc: ...here. * config/msp430/driver-msp430.c: Moved to... * config/msp430/driver-msp430.cc: ...here. * config/msp430/msp430-c.c: Moved to... * config/msp430/msp430-c.cc: ...here. * config/msp430/msp430-devices.c: Moved to... * config/msp430/msp430-devices.cc: ...here. * config/msp430/msp430.c: Moved to... * config/msp430/msp430.cc: ...here. * config/nds32/nds32-cost.c: Moved to... * config/nds32/nds32-cost.cc: ...here. * config/nds32/nds32-fp-as-gp.c: Moved to... * config/nds32/nds32-fp-as-gp.cc: ...here. * config/nds32/nds32-intrinsic.c: Moved to... * config/nds32/nds32-intrinsic.cc: ...here. * config/nds32/nds32-isr.c: Moved to... * config/nds32/nds32-isr.cc: ...here. * config/nds32/nds32-md-auxiliary.c: Moved to... * config/nds32/nds32-md-auxiliary.cc: ...here. * config/nds32/nds32-memory-manipulation.c: Moved to... * config/nds32/nds32-memory-manipulation.cc: ...here. * config/nds32/nds32-pipelines-auxiliary.c: Moved to... * config/nds32/nds32-pipelines-auxiliary.cc: ...here. * config/nds32/nds32-predicates.c: Moved to... * config/nds32/nds32-predicates.cc: ...here. * config/nds32/nds32-relax-opt.c: Moved to... * config/nds32/nds32-relax-opt.cc: ...here. * config/nds32/nds32-utils.c: Moved to... * config/nds32/nds32-utils.cc: ...here. * config/nds32/nds32.c: Moved to... * config/nds32/nds32.cc: ...here. * config/netbsd-d.c: Moved to... * config/netbsd-d.cc: ...here. * config/netbsd.c: Moved to... * config/netbsd.cc: ...here. * config/nios2/nios2.c: Moved to... * config/nios2/nios2.cc: ...here. * config/nvptx/mkoffload.c: Moved to... * config/nvptx/mkoffload.cc: ...here. * config/nvptx/nvptx-c.c: Moved to... * config/nvptx/nvptx-c.cc: ...here. * config/nvptx/nvptx.c: Moved to... * config/nvptx/nvptx.cc: ...here. * config/openbsd-d.c: Moved to... * config/openbsd-d.cc: ...here. * config/or1k/or1k.c: Moved to... * config/or1k/or1k.cc: ...here. * config/pa/pa-d.c: Moved to... * config/pa/pa-d.cc: ...here. * config/pa/pa.c: Moved to... * config/pa/pa.cc: ...here. * config/pdp11/pdp11.c: Moved to... * config/pdp11/pdp11.cc: ...here. * config/pru/pru-passes.c: Moved to... * config/pru/pru-passes.cc: ...here. * config/pru/pru-pragma.c: Moved to... * config/pru/pru-pragma.cc: ...here. * config/pru/pru.c: Moved to... * config/pru/pru.cc: ...here. * config/riscv/riscv-builtins.c: Moved to... * config/riscv/riscv-builtins.cc: ...here. * config/riscv/riscv-c.c: Moved to... * config/riscv/riscv-c.cc: ...here. * config/riscv/riscv-d.c: Moved to... * config/riscv/riscv-d.cc: ...here. * config/riscv/riscv-shorten-memrefs.c: Moved to... * config/riscv/riscv-shorten-memrefs.cc: ...here. * config/riscv/riscv-sr.c: Moved to... * config/riscv/riscv-sr.cc: ...here. * config/riscv/riscv.c: Moved to... * config/riscv/riscv.cc: ...here. * config/rl78/rl78-c.c: Moved to... * config/rl78/rl78-c.cc: ...here. * config/rl78/rl78.c: Moved to... * config/rl78/rl78.cc: ...here. * config/rs6000/driver-rs6000.c: Moved to... * config/rs6000/driver-rs6000.cc: ...here. * config/rs6000/host-darwin.c: Moved to... * config/rs6000/host-darwin.cc: ...here. * config/rs6000/host-ppc64-darwin.c: Moved to... * config/rs6000/host-ppc64-darwin.cc: ...here. * config/rs6000/rbtree.c: Moved to... * config/rs6000/rbtree.cc: ...here. * config/rs6000/rs6000-c.c: Moved to... * config/rs6000/rs6000-c.cc: ...here. * config/rs6000/rs6000-call.c: Moved to... * config/rs6000/rs6000-call.cc: ...here. * config/rs6000/rs6000-d.c: Moved to... * config/rs6000/rs6000-d.cc: ...here. * config/rs6000/rs6000-gen-builtins.c: Moved to... * config/rs6000/rs6000-gen-builtins.cc: ...here. * config/rs6000/rs6000-linux.c: Moved to... * config/rs6000/rs6000-linux.cc: ...here. * config/rs6000/rs6000-logue.c: Moved to... * config/rs6000/rs6000-logue.cc: ...here. * config/rs6000/rs6000-p8swap.c: Moved to... * config/rs6000/rs6000-p8swap.cc: ...here. * config/rs6000/rs6000-pcrel-opt.c: Moved to... * config/rs6000/rs6000-pcrel-opt.cc: ...here. * config/rs6000/rs6000-string.c: Moved to... * config/rs6000/rs6000-string.cc: ...here. * config/rs6000/rs6000.c: Moved to... * config/rs6000/rs6000.cc: ...here. * config/rx/rx.c: Moved to... * config/rx/rx.cc: ...here. * config/s390/driver-native.c: Moved to... * config/s390/driver-native.cc: ...here. * config/s390/s390-c.c: Moved to... * config/s390/s390-c.cc: ...here. * config/s390/s390-d.c: Moved to... * config/s390/s390-d.cc: ...here. * config/s390/s390.c: Moved to... * config/s390/s390.cc: ...here. * config/sh/divtab-sh4-300.c: Moved to... * config/sh/divtab-sh4-300.cc: ...here. * config/sh/divtab-sh4.c: Moved to... * config/sh/divtab-sh4.cc: ...here. * config/sh/divtab.c: Moved to... * config/sh/divtab.cc: ...here. * config/sh/sh-c.c: Moved to... * config/sh/sh-c.cc: ...here. * config/sh/sh.c: Moved to... * config/sh/sh.cc: ...here. * config/sol2-c.c: Moved to... * config/sol2-c.cc: ...here. * config/sol2-cxx.c: Moved to... * config/sol2-cxx.cc: ...here. * config/sol2-d.c: Moved to... * config/sol2-d.cc: ...here. * config/sol2-stubs.c: Moved to... * config/sol2-stubs.cc: ...here. * config/sol2.c: Moved to... * config/sol2.cc: ...here. * config/sparc/driver-sparc.c: Moved to... * config/sparc/driver-sparc.cc: ...here. * config/sparc/sparc-c.c: Moved to... * config/sparc/sparc-c.cc: ...here. * config/sparc/sparc-d.c: Moved to... * config/sparc/sparc-d.cc: ...here. * config/sparc/sparc.c: Moved to... * config/sparc/sparc.cc: ...here. * config/stormy16/stormy16.c: Moved to... * config/stormy16/stormy16.cc: ...here. * config/tilegx/mul-tables.c: Moved to... * config/tilegx/mul-tables.cc: ...here. * config/tilegx/tilegx-c.c: Moved to... * config/tilegx/tilegx-c.cc: ...here. * config/tilegx/tilegx.c: Moved to... * config/tilegx/tilegx.cc: ...here. * config/tilepro/mul-tables.c: Moved to... * config/tilepro/mul-tables.cc: ...here. * config/tilepro/tilepro-c.c: Moved to... * config/tilepro/tilepro-c.cc: ...here. * config/tilepro/tilepro.c: Moved to... * config/tilepro/tilepro.cc: ...here. * config/v850/v850-c.c: Moved to... * config/v850/v850-c.cc: ...here. * config/v850/v850.c: Moved to... * config/v850/v850.cc: ...here. * config/vax/vax.c: Moved to... * config/vax/vax.cc: ...here. * config/visium/visium.c: Moved to... * config/visium/visium.cc: ...here. * config/vms/vms-c.c: Moved to... * config/vms/vms-c.cc: ...here. * config/vms/vms-f.c: Moved to... * config/vms/vms-f.cc: ...here. * config/vms/vms.c: Moved to... * config/vms/vms.cc: ...here. * config/vxworks-c.c: Moved to... * config/vxworks-c.cc: ...here. * config/vxworks.c: Moved to... * config/vxworks.cc: ...here. * config/winnt-c.c: Moved to... * config/winnt-c.cc: ...here. * config/xtensa/xtensa.c: Moved to... * config/xtensa/xtensa.cc: ...here. * context.c: Moved to... * context.cc: ...here. * convert.c: Moved to... * convert.cc: ...here. * coverage.c: Moved to... * coverage.cc: ...here. * cppbuiltin.c: Moved to... * cppbuiltin.cc: ...here. * cppdefault.c: Moved to... * cppdefault.cc: ...here. * cprop.c: Moved to... * cprop.cc: ...here. * cse.c: Moved to... * cse.cc: ...here. * cselib.c: Moved to... * cselib.cc: ...here. * ctfc.c: Moved to... * ctfc.cc: ...here. * ctfout.c: Moved to... * ctfout.cc: ...here. * data-streamer-in.c: Moved to... * data-streamer-in.cc: ...here. * data-streamer-out.c: Moved to... * data-streamer-out.cc: ...here. * data-streamer.c: Moved to... * data-streamer.cc: ...here. * dbgcnt.c: Moved to... * dbgcnt.cc: ...here. * dbxout.c: Moved to... * dbxout.cc: ...here. * dce.c: Moved to... * dce.cc: ...here. * ddg.c: Moved to... * ddg.cc: ...here. * debug.c: Moved to... * debug.cc: ...here. * df-core.c: Moved to... * df-core.cc: ...here. * df-problems.c: Moved to... * df-problems.cc: ...here. * df-scan.c: Moved to... * df-scan.cc: ...here. * dfp.c: Moved to... * dfp.cc: ...here. * diagnostic-color.c: Moved to... * diagnostic-color.cc: ...here. * diagnostic-show-locus.c: Moved to... * diagnostic-show-locus.cc: ...here. * diagnostic-spec.c: Moved to... * diagnostic-spec.cc: ...here. * diagnostic.c: Moved to... * diagnostic.cc: ...here. * dojump.c: Moved to... * dojump.cc: ...here. * dominance.c: Moved to... * dominance.cc: ...here. * domwalk.c: Moved to... * domwalk.cc: ...here. * double-int.c: Moved to... * double-int.cc: ...here. * dse.c: Moved to... * dse.cc: ...here. * dumpfile.c: Moved to... * dumpfile.cc: ...here. * dwarf2asm.c: Moved to... * dwarf2asm.cc: ...here. * dwarf2cfi.c: Moved to... * dwarf2cfi.cc: ...here. * dwarf2ctf.c: Moved to... * dwarf2ctf.cc: ...here. * dwarf2out.c: Moved to... * dwarf2out.cc: ...here. * early-remat.c: Moved to... * early-remat.cc: ...here. * edit-context.c: Moved to... * edit-context.cc: ...here. * emit-rtl.c: Moved to... * emit-rtl.cc: ...here. * errors.c: Moved to... * errors.cc: ...here. * et-forest.c: Moved to... * et-forest.cc: ...here. * except.c: Moved to... * except.cc: ...here. * explow.c: Moved to... * explow.cc: ...here. * expmed.c: Moved to... * expmed.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * fibonacci_heap.c: Moved to... * fibonacci_heap.cc: ...here. * file-find.c: Moved to... * file-find.cc: ...here. * file-prefix-map.c: Moved to... * file-prefix-map.cc: ...here. * final.c: Moved to... * final.cc: ...here. * fixed-value.c: Moved to... * fixed-value.cc: ...here. * fold-const-call.c: Moved to... * fold-const-call.cc: ...here. * fold-const.c: Moved to... * fold-const.cc: ...here. * fp-test.c: Moved to... * fp-test.cc: ...here. * function-tests.c: Moved to... * function-tests.cc: ...here. * function.c: Moved to... * function.cc: ...here. * fwprop.c: Moved to... * fwprop.cc: ...here. * gcc-ar.c: Moved to... * gcc-ar.cc: ...here. * gcc-main.c: Moved to... * gcc-main.cc: ...here. * gcc-rich-location.c: Moved to... * gcc-rich-location.cc: ...here. * gcc.c: Moved to... * gcc.cc: ...here. * gcov-dump.c: Moved to... * gcov-dump.cc: ...here. * gcov-io.c: Moved to... * gcov-io.cc: ...here. * gcov-tool.c: Moved to... * gcov-tool.cc: ...here. * gcov.c: Moved to... * gcov.cc: ...here. * gcse-common.c: Moved to... * gcse-common.cc: ...here. * gcse.c: Moved to... * gcse.cc: ...here. * genattr-common.c: Moved to... * genattr-common.cc: ...here. * genattr.c: Moved to... * genattr.cc: ...here. * genattrtab.c: Moved to... * genattrtab.cc: ...here. * genautomata.c: Moved to... * genautomata.cc: ...here. * gencfn-macros.c: Moved to... * gencfn-macros.cc: ...here. * gencheck.c: Moved to... * gencheck.cc: ...here. * genchecksum.c: Moved to... * genchecksum.cc: ...here. * gencodes.c: Moved to... * gencodes.cc: ...here. * genconditions.c: Moved to... * genconditions.cc: ...here. * genconfig.c: Moved to... * genconfig.cc: ...here. * genconstants.c: Moved to... * genconstants.cc: ...here. * genemit.c: Moved to... * genemit.cc: ...here. * genenums.c: Moved to... * genenums.cc: ...here. * generic-match-head.c: Moved to... * generic-match-head.cc: ...here. * genextract.c: Moved to... * genextract.cc: ...here. * genflags.c: Moved to... * genflags.cc: ...here. * gengenrtl.c: Moved to... * gengenrtl.cc: ...here. * gengtype-parse.c: Moved to... * gengtype-parse.cc: ...here. * gengtype-state.c: Moved to... * gengtype-state.cc: ...here. * gengtype.c: Moved to... * gengtype.cc: ...here. * genhooks.c: Moved to... * genhooks.cc: ...here. * genmatch.c: Moved to... * genmatch.cc: ...here. * genmddeps.c: Moved to... * genmddeps.cc: ...here. * genmddump.c: Moved to... * genmddump.cc: ...here. * genmodes.c: Moved to... * genmodes.cc: ...here. * genopinit.c: Moved to... * genopinit.cc: ...here. * genoutput.c: Moved to... * genoutput.cc: ...here. * genpeep.c: Moved to... * genpeep.cc: ...here. * genpreds.c: Moved to... * genpreds.cc: ...here. * genrecog.c: Moved to... * genrecog.cc: ...here. * gensupport.c: Moved to... * gensupport.cc: ...here. * gentarget-def.c: Moved to... * gentarget-def.cc: ...here. * genversion.c: Moved to... * genversion.cc: ...here. * ggc-common.c: Moved to... * ggc-common.cc: ...here. * ggc-none.c: Moved to... * ggc-none.cc: ...here. * ggc-page.c: Moved to... * ggc-page.cc: ...here. * ggc-tests.c: Moved to... * ggc-tests.cc: ...here. * gimple-builder.c: Moved to... * gimple-builder.cc: ...here. * gimple-expr.c: Moved to... * gimple-expr.cc: ...here. * gimple-fold.c: Moved to... * gimple-fold.cc: ...here. * gimple-iterator.c: Moved to... * gimple-iterator.cc: ...here. * gimple-laddress.c: Moved to... * gimple-laddress.cc: ...here. * gimple-loop-jam.c: Moved to... * gimple-loop-jam.cc: ...here. * gimple-low.c: Moved to... * gimple-low.cc: ...here. * gimple-match-head.c: Moved to... * gimple-match-head.cc: ...here. * gimple-pretty-print.c: Moved to... * gimple-pretty-print.cc: ...here. * gimple-ssa-backprop.c: Moved to... * gimple-ssa-backprop.cc: ...here. * gimple-ssa-evrp-analyze.c: Moved to... * gimple-ssa-evrp-analyze.cc: ...here. * gimple-ssa-evrp.c: Moved to... * gimple-ssa-evrp.cc: ...here. * gimple-ssa-isolate-paths.c: Moved to... * gimple-ssa-isolate-paths.cc: ...here. * gimple-ssa-nonnull-compare.c: Moved to... * gimple-ssa-nonnull-compare.cc: ...here. * gimple-ssa-split-paths.c: Moved to... * gimple-ssa-split-paths.cc: ...here. * gimple-ssa-sprintf.c: Moved to... * gimple-ssa-sprintf.cc: ...here. * gimple-ssa-store-merging.c: Moved to... * gimple-ssa-store-merging.cc: ...here. * gimple-ssa-strength-reduction.c: Moved to... * gimple-ssa-strength-reduction.cc: ...here. * gimple-ssa-warn-alloca.c: Moved to... * gimple-ssa-warn-alloca.cc: ...here. * gimple-ssa-warn-restrict.c: Moved to... * gimple-ssa-warn-restrict.cc: ...here. * gimple-streamer-in.c: Moved to... * gimple-streamer-in.cc: ...here. * gimple-streamer-out.c: Moved to... * gimple-streamer-out.cc: ...here. * gimple-walk.c: Moved to... * gimple-walk.cc: ...here. * gimple-warn-recursion.c: Moved to... * gimple-warn-recursion.cc: ...here. * gimple.c: Moved to... * gimple.cc: ...here. * gimplify-me.c: Moved to... * gimplify-me.cc: ...here. * gimplify.c: Moved to... * gimplify.cc: ...here. * godump.c: Moved to... * godump.cc: ...here. * graph.c: Moved to... * graph.cc: ...here. * graphds.c: Moved to... * graphds.cc: ...here. * graphite-dependences.c: Moved to... * graphite-dependences.cc: ...here. * graphite-isl-ast-to-gimple.c: Moved to... * graphite-isl-ast-to-gimple.cc: ...here. * graphite-optimize-isl.c: Moved to... * graphite-optimize-isl.cc: ...here. * graphite-poly.c: Moved to... * graphite-poly.cc: ...here. * graphite-scop-detection.c: Moved to... * graphite-scop-detection.cc: ...here. * graphite-sese-to-poly.c: Moved to... * graphite-sese-to-poly.cc: ...here. * graphite.c: Moved to... * graphite.cc: ...here. * haifa-sched.c: Moved to... * haifa-sched.cc: ...here. * hash-map-tests.c: Moved to... * hash-map-tests.cc: ...here. * hash-set-tests.c: Moved to... * hash-set-tests.cc: ...here. * hash-table.c: Moved to... * hash-table.cc: ...here. * hooks.c: Moved to... * hooks.cc: ...here. * host-default.c: Moved to... * host-default.cc: ...here. * hw-doloop.c: Moved to... * hw-doloop.cc: ...here. * hwint.c: Moved to... * hwint.cc: ...here. * ifcvt.c: Moved to... * ifcvt.cc: ...here. * inchash.c: Moved to... * inchash.cc: ...here. * incpath.c: Moved to... * incpath.cc: ...here. * init-regs.c: Moved to... * init-regs.cc: ...here. * input.c: Moved to... * input.cc: ...here. * internal-fn.c: Moved to... * internal-fn.cc: ...here. * intl.c: Moved to... * intl.cc: ...here. * ipa-comdats.c: Moved to... * ipa-comdats.cc: ...here. * ipa-cp.c: Moved to... * ipa-cp.cc: ...here. * ipa-devirt.c: Moved to... * ipa-devirt.cc: ...here. * ipa-fnsummary.c: Moved to... * ipa-fnsummary.cc: ...here. * ipa-icf-gimple.c: Moved to... * ipa-icf-gimple.cc: ...here. * ipa-icf.c: Moved to... * ipa-icf.cc: ...here. * ipa-inline-analysis.c: Moved to... * ipa-inline-analysis.cc: ...here. * ipa-inline-transform.c: Moved to... * ipa-inline-transform.cc: ...here. * ipa-inline.c: Moved to... * ipa-inline.cc: ...here. * ipa-modref-tree.c: Moved to... * ipa-modref-tree.cc: ...here. * ipa-modref.c: Moved to... * ipa-modref.cc: ...here. * ipa-param-manipulation.c: Moved to... * ipa-param-manipulation.cc: ...here. * ipa-polymorphic-call.c: Moved to... * ipa-polymorphic-call.cc: ...here. * ipa-predicate.c: Moved to... * ipa-predicate.cc: ...here. * ipa-profile.c: Moved to... * ipa-profile.cc: ...here. * ipa-prop.c: Moved to... * ipa-prop.cc: ...here. * ipa-pure-const.c: Moved to... * ipa-pure-const.cc: ...here. * ipa-ref.c: Moved to... * ipa-ref.cc: ...here. * ipa-reference.c: Moved to... * ipa-reference.cc: ...here. * ipa-split.c: Moved to... * ipa-split.cc: ...here. * ipa-sra.c: Moved to... * ipa-sra.cc: ...here. * ipa-utils.c: Moved to... * ipa-utils.cc: ...here. * ipa-visibility.c: Moved to... * ipa-visibility.cc: ...here. * ipa.c: Moved to... * ipa.cc: ...here. * ira-build.c: Moved to... * ira-build.cc: ...here. * ira-color.c: Moved to... * ira-color.cc: ...here. * ira-conflicts.c: Moved to... * ira-conflicts.cc: ...here. * ira-costs.c: Moved to... * ira-costs.cc: ...here. * ira-emit.c: Moved to... * ira-emit.cc: ...here. * ira-lives.c: Moved to... * ira-lives.cc: ...here. * ira.c: Moved to... * ira.cc: ...here. * jump.c: Moved to... * jump.cc: ...here. * langhooks.c: Moved to... * langhooks.cc: ...here. * lcm.c: Moved to... * lcm.cc: ...here. * lists.c: Moved to... * lists.cc: ...here. * loop-doloop.c: Moved to... * loop-doloop.cc: ...here. * loop-init.c: Moved to... * loop-init.cc: ...here. * loop-invariant.c: Moved to... * loop-invariant.cc: ...here. * loop-iv.c: Moved to... * loop-iv.cc: ...here. * loop-unroll.c: Moved to... * loop-unroll.cc: ...here. * lower-subreg.c: Moved to... * lower-subreg.cc: ...here. * lra-assigns.c: Moved to... * lra-assigns.cc: ...here. * lra-coalesce.c: Moved to... * lra-coalesce.cc: ...here. * lra-constraints.c: Moved to... * lra-constraints.cc: ...here. * lra-eliminations.c: Moved to... * lra-eliminations.cc: ...here. * lra-lives.c: Moved to... * lra-lives.cc: ...here. * lra-remat.c: Moved to... * lra-remat.cc: ...here. * lra-spills.c: Moved to... * lra-spills.cc: ...here. * lra.c: Moved to... * lra.cc: ...here. * lto-cgraph.c: Moved to... * lto-cgraph.cc: ...here. * lto-compress.c: Moved to... * lto-compress.cc: ...here. * lto-opts.c: Moved to... * lto-opts.cc: ...here. * lto-section-in.c: Moved to... * lto-section-in.cc: ...here. * lto-section-out.c: Moved to... * lto-section-out.cc: ...here. * lto-streamer-in.c: Moved to... * lto-streamer-in.cc: ...here. * lto-streamer-out.c: Moved to... * lto-streamer-out.cc: ...here. * lto-streamer.c: Moved to... * lto-streamer.cc: ...here. * lto-wrapper.c: Moved to... * lto-wrapper.cc: ...here. * main.c: Moved to... * main.cc: ...here. * mcf.c: Moved to... * mcf.cc: ...here. * mode-switching.c: Moved to... * mode-switching.cc: ...here. * modulo-sched.c: Moved to... * modulo-sched.cc: ...here. * multiple_target.c: Moved to... * multiple_target.cc: ...here. * omp-expand.c: Moved to... * omp-expand.cc: ...here. * omp-general.c: Moved to... * omp-general.cc: ...here. * omp-low.c: Moved to... * omp-low.cc: ...here. * omp-offload.c: Moved to... * omp-offload.cc: ...here. * omp-simd-clone.c: Moved to... * omp-simd-clone.cc: ...here. * opt-suggestions.c: Moved to... * opt-suggestions.cc: ...here. * optabs-libfuncs.c: Moved to... * optabs-libfuncs.cc: ...here. * optabs-query.c: Moved to... * optabs-query.cc: ...here. * optabs-tree.c: Moved to... * optabs-tree.cc: ...here. * optabs.c: Moved to... * optabs.cc: ...here. * opts-common.c: Moved to... * opts-common.cc: ...here. * opts-global.c: Moved to... * opts-global.cc: ...here. * opts.c: Moved to... * opts.cc: ...here. * passes.c: Moved to... * passes.cc: ...here. * plugin.c: Moved to... * plugin.cc: ...here. * postreload-gcse.c: Moved to... * postreload-gcse.cc: ...here. * postreload.c: Moved to... * postreload.cc: ...here. * predict.c: Moved to... * predict.cc: ...here. * prefix.c: Moved to... * prefix.cc: ...here. * pretty-print.c: Moved to... * pretty-print.cc: ...here. * print-rtl-function.c: Moved to... * print-rtl-function.cc: ...here. * print-rtl.c: Moved to... * print-rtl.cc: ...here. * print-tree.c: Moved to... * print-tree.cc: ...here. * profile-count.c: Moved to... * profile-count.cc: ...here. * profile.c: Moved to... * profile.cc: ...here. * read-md.c: Moved to... * read-md.cc: ...here. * read-rtl-function.c: Moved to... * read-rtl-function.cc: ...here. * read-rtl.c: Moved to... * read-rtl.cc: ...here. * real.c: Moved to... * real.cc: ...here. * realmpfr.c: Moved to... * realmpfr.cc: ...here. * recog.c: Moved to... * recog.cc: ...here. * ree.c: Moved to... * ree.cc: ...here. * reg-stack.c: Moved to... * reg-stack.cc: ...here. * regcprop.c: Moved to... * regcprop.cc: ...here. * reginfo.c: Moved to... * reginfo.cc: ...here. * regrename.c: Moved to... * regrename.cc: ...here. * regstat.c: Moved to... * regstat.cc: ...here. * reload.c: Moved to... * reload.cc: ...here. * reload1.c: Moved to... * reload1.cc: ...here. * reorg.c: Moved to... * reorg.cc: ...here. * resource.c: Moved to... * resource.cc: ...here. * rtl-error.c: Moved to... * rtl-error.cc: ...here. * rtl-tests.c: Moved to... * rtl-tests.cc: ...here. * rtl.c: Moved to... * rtl.cc: ...here. * rtlanal.c: Moved to... * rtlanal.cc: ...here. * rtlhash.c: Moved to... * rtlhash.cc: ...here. * rtlhooks.c: Moved to... * rtlhooks.cc: ...here. * rtx-vector-builder.c: Moved to... * rtx-vector-builder.cc: ...here. * run-rtl-passes.c: Moved to... * run-rtl-passes.cc: ...here. * sancov.c: Moved to... * sancov.cc: ...here. * sanopt.c: Moved to... * sanopt.cc: ...here. * sbitmap.c: Moved to... * sbitmap.cc: ...here. * sched-deps.c: Moved to... * sched-deps.cc: ...here. * sched-ebb.c: Moved to... * sched-ebb.cc: ...here. * sched-rgn.c: Moved to... * sched-rgn.cc: ...here. * sel-sched-dump.c: Moved to... * sel-sched-dump.cc: ...here. * sel-sched-ir.c: Moved to... * sel-sched-ir.cc: ...here. * sel-sched.c: Moved to... * sel-sched.cc: ...here. * selftest-diagnostic.c: Moved to... * selftest-diagnostic.cc: ...here. * selftest-rtl.c: Moved to... * selftest-rtl.cc: ...here. * selftest-run-tests.c: Moved to... * selftest-run-tests.cc: ...here. * selftest.c: Moved to... * selftest.cc: ...here. * sese.c: Moved to... * sese.cc: ...here. * shrink-wrap.c: Moved to... * shrink-wrap.cc: ...here. * simplify-rtx.c: Moved to... * simplify-rtx.cc: ...here. * sparseset.c: Moved to... * sparseset.cc: ...here. * spellcheck-tree.c: Moved to... * spellcheck-tree.cc: ...here. * spellcheck.c: Moved to... * spellcheck.cc: ...here. * sreal.c: Moved to... * sreal.cc: ...here. * stack-ptr-mod.c: Moved to... * stack-ptr-mod.cc: ...here. * statistics.c: Moved to... * statistics.cc: ...here. * stmt.c: Moved to... * stmt.cc: ...here. * stor-layout.c: Moved to... * stor-layout.cc: ...here. * store-motion.c: Moved to... * store-motion.cc: ...here. * streamer-hooks.c: Moved to... * streamer-hooks.cc: ...here. * stringpool.c: Moved to... * stringpool.cc: ...here. * substring-locations.c: Moved to... * substring-locations.cc: ...here. * symtab.c: Moved to... * symtab.cc: ...here. * target-globals.c: Moved to... * target-globals.cc: ...here. * targhooks.c: Moved to... * targhooks.cc: ...here. * timevar.c: Moved to... * timevar.cc: ...here. * toplev.c: Moved to... * toplev.cc: ...here. * tracer.c: Moved to... * tracer.cc: ...here. * trans-mem.c: Moved to... * trans-mem.cc: ...here. * tree-affine.c: Moved to... * tree-affine.cc: ...here. * tree-call-cdce.c: Moved to... * tree-call-cdce.cc: ...here. * tree-cfg.c: Moved to... * tree-cfg.cc: ...here. * tree-cfgcleanup.c: Moved to... * tree-cfgcleanup.cc: ...here. * tree-chrec.c: Moved to... * tree-chrec.cc: ...here. * tree-complex.c: Moved to... * tree-complex.cc: ...here. * tree-data-ref.c: Moved to... * tree-data-ref.cc: ...here. * tree-dfa.c: Moved to... * tree-dfa.cc: ...here. * tree-diagnostic.c: Moved to... * tree-diagnostic.cc: ...here. * tree-dump.c: Moved to... * tree-dump.cc: ...here. * tree-eh.c: Moved to... * tree-eh.cc: ...here. * tree-emutls.c: Moved to... * tree-emutls.cc: ...here. * tree-if-conv.c: Moved to... * tree-if-conv.cc: ...here. * tree-inline.c: Moved to... * tree-inline.cc: ...here. * tree-into-ssa.c: Moved to... * tree-into-ssa.cc: ...here. * tree-iterator.c: Moved to... * tree-iterator.cc: ...here. * tree-loop-distribution.c: Moved to... * tree-loop-distribution.cc: ...here. * tree-nested.c: Moved to... * tree-nested.cc: ...here. * tree-nrv.c: Moved to... * tree-nrv.cc: ...here. * tree-object-size.c: Moved to... * tree-object-size.cc: ...here. * tree-outof-ssa.c: Moved to... * tree-outof-ssa.cc: ...here. * tree-parloops.c: Moved to... * tree-parloops.cc: ...here. * tree-phinodes.c: Moved to... * tree-phinodes.cc: ...here. * tree-predcom.c: Moved to... * tree-predcom.cc: ...here. * tree-pretty-print.c: Moved to... * tree-pretty-print.cc: ...here. * tree-profile.c: Moved to... * tree-profile.cc: ...here. * tree-scalar-evolution.c: Moved to... * tree-scalar-evolution.cc: ...here. * tree-sra.c: Moved to... * tree-sra.cc: ...here. * tree-ssa-address.c: Moved to... * tree-ssa-address.cc: ...here. * tree-ssa-alias.c: Moved to... * tree-ssa-alias.cc: ...here. * tree-ssa-ccp.c: Moved to... * tree-ssa-ccp.cc: ...here. * tree-ssa-coalesce.c: Moved to... * tree-ssa-coalesce.cc: ...here. * tree-ssa-copy.c: Moved to... * tree-ssa-copy.cc: ...here. * tree-ssa-dce.c: Moved to... * tree-ssa-dce.cc: ...here. * tree-ssa-dom.c: Moved to... * tree-ssa-dom.cc: ...here. * tree-ssa-dse.c: Moved to... * tree-ssa-dse.cc: ...here. * tree-ssa-forwprop.c: Moved to... * tree-ssa-forwprop.cc: ...here. * tree-ssa-ifcombine.c: Moved to... * tree-ssa-ifcombine.cc: ...here. * tree-ssa-live.c: Moved to... * tree-ssa-live.cc: ...here. * tree-ssa-loop-ch.c: Moved to... * tree-ssa-loop-ch.cc: ...here. * tree-ssa-loop-im.c: Moved to... * tree-ssa-loop-im.cc: ...here. * tree-ssa-loop-ivcanon.c: Moved to... * tree-ssa-loop-ivcanon.cc: ...here. * tree-ssa-loop-ivopts.c: Moved to... * tree-ssa-loop-ivopts.cc: ...here. * tree-ssa-loop-manip.c: Moved to... * tree-ssa-loop-manip.cc: ...here. * tree-ssa-loop-niter.c: Moved to... * tree-ssa-loop-niter.cc: ...here. * tree-ssa-loop-prefetch.c: Moved to... * tree-ssa-loop-prefetch.cc: ...here. * tree-ssa-loop-split.c: Moved to... * tree-ssa-loop-split.cc: ...here. * tree-ssa-loop-unswitch.c: Moved to... * tree-ssa-loop-unswitch.cc: ...here. * tree-ssa-loop.c: Moved to... * tree-ssa-loop.cc: ...here. * tree-ssa-math-opts.c: Moved to... * tree-ssa-math-opts.cc: ...here. * tree-ssa-operands.c: Moved to... * tree-ssa-operands.cc: ...here. * tree-ssa-phiopt.c: Moved to... * tree-ssa-phiopt.cc: ...here. * tree-ssa-phiprop.c: Moved to... * tree-ssa-phiprop.cc: ...here. * tree-ssa-pre.c: Moved to... * tree-ssa-pre.cc: ...here. * tree-ssa-propagate.c: Moved to... * tree-ssa-propagate.cc: ...here. * tree-ssa-reassoc.c: Moved to... * tree-ssa-reassoc.cc: ...here. * tree-ssa-sccvn.c: Moved to... * tree-ssa-sccvn.cc: ...here. * tree-ssa-scopedtables.c: Moved to... * tree-ssa-scopedtables.cc: ...here. * tree-ssa-sink.c: Moved to... * tree-ssa-sink.cc: ...here. * tree-ssa-strlen.c: Moved to... * tree-ssa-strlen.cc: ...here. * tree-ssa-structalias.c: Moved to... * tree-ssa-structalias.cc: ...here. * tree-ssa-tail-merge.c: Moved to... * tree-ssa-tail-merge.cc: ...here. * tree-ssa-ter.c: Moved to... * tree-ssa-ter.cc: ...here. * tree-ssa-threadbackward.c: Moved to... * tree-ssa-threadbackward.cc: ...here. * tree-ssa-threadedge.c: Moved to... * tree-ssa-threadedge.cc: ...here. * tree-ssa-threadupdate.c: Moved to... * tree-ssa-threadupdate.cc: ...here. * tree-ssa-uncprop.c: Moved to... * tree-ssa-uncprop.cc: ...here. * tree-ssa-uninit.c: Moved to... * tree-ssa-uninit.cc: ...here. * tree-ssa.c: Moved to... * tree-ssa.cc: ...here. * tree-ssanames.c: Moved to... * tree-ssanames.cc: ...here. * tree-stdarg.c: Moved to... * tree-stdarg.cc: ...here. * tree-streamer-in.c: Moved to... * tree-streamer-in.cc: ...here. * tree-streamer-out.c: Moved to... * tree-streamer-out.cc: ...here. * tree-streamer.c: Moved to... * tree-streamer.cc: ...here. * tree-switch-conversion.c: Moved to... * tree-switch-conversion.cc: ...here. * tree-tailcall.c: Moved to... * tree-tailcall.cc: ...here. * tree-vect-data-refs.c: Moved to... * tree-vect-data-refs.cc: ...here. * tree-vect-generic.c: Moved to... * tree-vect-generic.cc: ...here. * tree-vect-loop-manip.c: Moved to... * tree-vect-loop-manip.cc: ...here. * tree-vect-loop.c: Moved to... * tree-vect-loop.cc: ...here. * tree-vect-patterns.c: Moved to... * tree-vect-patterns.cc: ...here. * tree-vect-slp-patterns.c: Moved to... * tree-vect-slp-patterns.cc: ...here. * tree-vect-slp.c: Moved to... * tree-vect-slp.cc: ...here. * tree-vect-stmts.c: Moved to... * tree-vect-stmts.cc: ...here. * tree-vector-builder.c: Moved to... * tree-vector-builder.cc: ...here. * tree-vectorizer.c: Moved to... * tree-vectorizer.cc: ...here. * tree-vrp.c: Moved to... * tree-vrp.cc: ...here. * tree.c: Moved to... * tree.cc: ...here. * tsan.c: Moved to... * tsan.cc: ...here. * typed-splay-tree.c: Moved to... * typed-splay-tree.cc: ...here. * ubsan.c: Moved to... * ubsan.cc: ...here. * valtrack.c: Moved to... * valtrack.cc: ...here. * value-prof.c: Moved to... * value-prof.cc: ...here. * var-tracking.c: Moved to... * var-tracking.cc: ...here. * varasm.c: Moved to... * varasm.cc: ...here. * varpool.c: Moved to... * varpool.cc: ...here. * vec-perm-indices.c: Moved to... * vec-perm-indices.cc: ...here. * vec.c: Moved to... * vec.cc: ...here. * vmsdbgout.c: Moved to... * vmsdbgout.cc: ...here. * vr-values.c: Moved to... * vr-values.cc: ...here. * vtable-verify.c: Moved to... * vtable-verify.cc: ...here. * web.c: Moved to... * web.cc: ...here. * xcoffout.c: Moved to... * xcoffout.cc: ...here. gcc/c-family/ChangeLog: * c-ada-spec.c: Moved to... * c-ada-spec.cc: ...here. * c-attribs.c: Moved to... * c-attribs.cc: ...here. * c-common.c: Moved to... * c-common.cc: ...here. * c-cppbuiltin.c: Moved to... * c-cppbuiltin.cc: ...here. * c-dump.c: Moved to... * c-dump.cc: ...here. * c-format.c: Moved to... * c-format.cc: ...here. * c-gimplify.c: Moved to... * c-gimplify.cc: ...here. * c-indentation.c: Moved to... * c-indentation.cc: ...here. * c-lex.c: Moved to... * c-lex.cc: ...here. * c-omp.c: Moved to... * c-omp.cc: ...here. * c-opts.c: Moved to... * c-opts.cc: ...here. * c-pch.c: Moved to... * c-pch.cc: ...here. * c-ppoutput.c: Moved to... * c-ppoutput.cc: ...here. * c-pragma.c: Moved to... * c-pragma.cc: ...here. * c-pretty-print.c: Moved to... * c-pretty-print.cc: ...here. * c-semantics.c: Moved to... * c-semantics.cc: ...here. * c-ubsan.c: Moved to... * c-ubsan.cc: ...here. * c-warn.c: Moved to... * c-warn.cc: ...here. * cppspec.c: Moved to... * cppspec.cc: ...here. * stub-objc.c: Moved to... * stub-objc.cc: ...here. gcc/c/ChangeLog: * c-aux-info.c: Moved to... * c-aux-info.cc: ...here. * c-convert.c: Moved to... * c-convert.cc: ...here. * c-decl.c: Moved to... * c-decl.cc: ...here. * c-errors.c: Moved to... * c-errors.cc: ...here. * c-fold.c: Moved to... * c-fold.cc: ...here. * c-lang.c: Moved to... * c-lang.cc: ...here. * c-objc-common.c: Moved to... * c-objc-common.cc: ...here. * c-parser.c: Moved to... * c-parser.cc: ...here. * c-typeck.c: Moved to... * c-typeck.cc: ...here. * gccspec.c: Moved to... * gccspec.cc: ...here. * gimple-parser.c: Moved to... * gimple-parser.cc: ...here. gcc/cp/ChangeLog: * call.c: Moved to... * call.cc: ...here. * class.c: Moved to... * class.cc: ...here. * constexpr.c: Moved to... * constexpr.cc: ...here. * cp-gimplify.c: Moved to... * cp-gimplify.cc: ...here. * cp-lang.c: Moved to... * cp-lang.cc: ...here. * cp-objcp-common.c: Moved to... * cp-objcp-common.cc: ...here. * cp-ubsan.c: Moved to... * cp-ubsan.cc: ...here. * cvt.c: Moved to... * cvt.cc: ...here. * cxx-pretty-print.c: Moved to... * cxx-pretty-print.cc: ...here. * decl.c: Moved to... * decl.cc: ...here. * decl2.c: Moved to... * decl2.cc: ...here. * dump.c: Moved to... * dump.cc: ...here. * error.c: Moved to... * error.cc: ...here. * except.c: Moved to... * except.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * friend.c: Moved to... * friend.cc: ...here. * g++spec.c: Moved to... * g++spec.cc: ...here. * init.c: Moved to... * init.cc: ...here. * lambda.c: Moved to... * lambda.cc: ...here. * lex.c: Moved to... * lex.cc: ...here. * mangle.c: Moved to... * mangle.cc: ...here. * method.c: Moved to... * method.cc: ...here. * name-lookup.c: Moved to... * name-lookup.cc: ...here. * optimize.c: Moved to... * optimize.cc: ...here. * parser.c: Moved to... * parser.cc: ...here. * pt.c: Moved to... * pt.cc: ...here. * ptree.c: Moved to... * ptree.cc: ...here. * rtti.c: Moved to... * rtti.cc: ...here. * search.c: Moved to... * search.cc: ...here. * semantics.c: Moved to... * semantics.cc: ...here. * tree.c: Moved to... * tree.cc: ...here. * typeck.c: Moved to... * typeck.cc: ...here. * typeck2.c: Moved to... * typeck2.cc: ...here. * vtable-class-hierarchy.c: Moved to... * vtable-class-hierarchy.cc: ...here. gcc/fortran/ChangeLog: * arith.c: Moved to... * arith.cc: ...here. * array.c: Moved to... * array.cc: ...here. * bbt.c: Moved to... * bbt.cc: ...here. * check.c: Moved to... * check.cc: ...here. * class.c: Moved to... * class.cc: ...here. * constructor.c: Moved to... * constructor.cc: ...here. * convert.c: Moved to... * convert.cc: ...here. * cpp.c: Moved to... * cpp.cc: ...here. * data.c: Moved to... * data.cc: ...here. * decl.c: Moved to... * decl.cc: ...here. * dependency.c: Moved to... * dependency.cc: ...here. * dump-parse-tree.c: Moved to... * dump-parse-tree.cc: ...here. * error.c: Moved to... * error.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * f95-lang.c: Moved to... * f95-lang.cc: ...here. * frontend-passes.c: Moved to... * frontend-passes.cc: ...here. * gfortranspec.c: Moved to... * gfortranspec.cc: ...here. * interface.c: Moved to... * interface.cc: ...here. * intrinsic.c: Moved to... * intrinsic.cc: ...here. * io.c: Moved to... * io.cc: ...here. * iresolve.c: Moved to... * iresolve.cc: ...here. * match.c: Moved to... * match.cc: ...here. * matchexp.c: Moved to... * matchexp.cc: ...here. * misc.c: Moved to... * misc.cc: ...here. * module.c: Moved to... * module.cc: ...here. * openmp.c: Moved to... * openmp.cc: ...here. * options.c: Moved to... * options.cc: ...here. * parse.c: Moved to... * parse.cc: ...here. * primary.c: Moved to... * primary.cc: ...here. * resolve.c: Moved to... * resolve.cc: ...here. * scanner.c: Moved to... * scanner.cc: ...here. * simplify.c: Moved to... * simplify.cc: ...here. * st.c: Moved to... * st.cc: ...here. * symbol.c: Moved to... * symbol.cc: ...here. * target-memory.c: Moved to... * target-memory.cc: ...here. * trans-array.c: Moved to... * trans-array.cc: ...here. * trans-common.c: Moved to... * trans-common.cc: ...here. * trans-const.c: Moved to... * trans-const.cc: ...here. * trans-decl.c: Moved to... * trans-decl.cc: ...here. * trans-expr.c: Moved to... * trans-expr.cc: ...here. * trans-intrinsic.c: Moved to... * trans-intrinsic.cc: ...here. * trans-io.c: Moved to... * trans-io.cc: ...here. * trans-openmp.c: Moved to... * trans-openmp.cc: ...here. * trans-stmt.c: Moved to... * trans-stmt.cc: ...here. * trans-types.c: Moved to... * trans-types.cc: ...here. * trans.c: Moved to... * trans.cc: ...here. gcc/go/ChangeLog: * go-backend.c: Moved to... * go-backend.cc: ...here. * go-lang.c: Moved to... * go-lang.cc: ...here. * gospec.c: Moved to... * gospec.cc: ...here. gcc/jit/ChangeLog: * dummy-frontend.c: Moved to... * dummy-frontend.cc: ...here. * jit-builtins.c: Moved to... * jit-builtins.cc: ...here. * jit-logging.c: Moved to... * jit-logging.cc: ...here. * jit-playback.c: Moved to... * jit-playback.cc: ...here. * jit-recording.c: Moved to... * jit-recording.cc: ...here. * jit-result.c: Moved to... * jit-result.cc: ...here. * jit-spec.c: Moved to... * jit-spec.cc: ...here. * jit-tempdir.c: Moved to... * jit-tempdir.cc: ...here. * jit-w32.c: Moved to... * jit-w32.cc: ...here. * libgccjit.c: Moved to... * libgccjit.cc: ...here. gcc/lto/ChangeLog: * common.c: Moved to... * common.cc: ...here. * lto-common.c: Moved to... * lto-common.cc: ...here. * lto-dump.c: Moved to... * lto-dump.cc: ...here. * lto-lang.c: Moved to... * lto-lang.cc: ...here. * lto-object.c: Moved to... * lto-object.cc: ...here. * lto-partition.c: Moved to... * lto-partition.cc: ...here. * lto-symtab.c: Moved to... * lto-symtab.cc: ...here. * lto.c: Moved to... * lto.cc: ...here. gcc/objc/ChangeLog: * objc-act.c: Moved to... * objc-act.cc: ...here. * objc-encoding.c: Moved to... * objc-encoding.cc: ...here. * objc-gnu-runtime-abi-01.c: Moved to... * objc-gnu-runtime-abi-01.cc: ...here. * objc-lang.c: Moved to... * objc-lang.cc: ...here. * objc-map.c: Moved to... * objc-map.cc: ...here. * objc-next-runtime-abi-01.c: Moved to... * objc-next-runtime-abi-01.cc: ...here. * objc-next-runtime-abi-02.c: Moved to... * objc-next-runtime-abi-02.cc: ...here. * objc-runtime-shared-support.c: Moved to... * objc-runtime-shared-support.cc: ...here. gcc/objcp/ChangeLog: * objcp-decl.c: Moved to... * objcp-decl.cc: ...here. * objcp-lang.c: Moved to... * objcp-lang.cc: ...here. libcpp/ChangeLog: * charset.c: Moved to... * charset.cc: ...here. * directives.c: Moved to... * directives.cc: ...here. * errors.c: Moved to... * errors.cc: ...here. * expr.c: Moved to... * expr.cc: ...here. * files.c: Moved to... * files.cc: ...here. * identifiers.c: Moved to... * identifiers.cc: ...here. * init.c: Moved to... * init.cc: ...here. * lex.c: Moved to... * lex.cc: ...here. * line-map.c: Moved to... * line-map.cc: ...here. * macro.c: Moved to... * macro.cc: ...here. * makeucnid.c: Moved to... * makeucnid.cc: ...here. * mkdeps.c: Moved to... * mkdeps.cc: ...here. * pch.c: Moved to... * pch.cc: ...here. * symtab.c: Moved to... * symtab.cc: ...here. * traditional.c: Moved to... * traditional.cc: ...here.
Diffstat (limited to 'gcc/tree-ssa-loop-split.cc')
-rw-r--r--gcc/tree-ssa-loop-split.cc1747
1 files changed, 1747 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-split.cc b/gcc/tree-ssa-loop-split.cc
new file mode 100644
index 0000000..b93ee4c
--- /dev/null
+++ b/gcc/tree-ssa-loop-split.cc
@@ -0,0 +1,1747 @@
+/* Loop splitting.
+ Copyright (C) 2015-2022 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "tree.h"
+#include "gimple.h"
+#include "tree-pass.h"
+#include "ssa.h"
+#include "fold-const.h"
+#include "tree-cfg.h"
+#include "tree-ssa.h"
+#include "tree-ssa-loop-niter.h"
+#include "tree-ssa-loop.h"
+#include "tree-ssa-loop-manip.h"
+#include "tree-into-ssa.h"
+#include "tree-inline.h"
+#include "tree-cfgcleanup.h"
+#include "cfgloop.h"
+#include "tree-scalar-evolution.h"
+#include "gimple-iterator.h"
+#include "gimple-pretty-print.h"
+#include "cfghooks.h"
+#include "gimple-fold.h"
+#include "gimplify-me.h"
+
+/* This file implements two kinds of loop splitting.
+
+ One transformation of loops like:
+
+ for (i = 0; i < 100; i++)
+ {
+ if (i < 50)
+ A;
+ else
+ B;
+ }
+
+ into:
+
+ for (i = 0; i < 50; i++)
+ {
+ A;
+ }
+ for (; i < 100; i++)
+ {
+ B;
+ }
+
+ */
+
+/* Return true when BB inside LOOP is a potential iteration space
+ split point, i.e. ends with a condition like "IV < comp", which
+ is true on one side of the iteration space and false on the other,
+ and the split point can be computed. If so, also return the border
+ point in *BORDER and the comparison induction variable in IV. */
+
+static tree
+split_at_bb_p (class loop *loop, basic_block bb, tree *border, affine_iv *iv)
+{
+ gimple *last;
+ gcond *stmt;
+ affine_iv iv2;
+
+ /* BB must end in a simple conditional jump. */
+ last = last_stmt (bb);
+ if (!last || gimple_code (last) != GIMPLE_COND)
+ return NULL_TREE;
+ stmt = as_a <gcond *> (last);
+
+ enum tree_code code = gimple_cond_code (stmt);
+
+ /* Only handle relational comparisons, for equality and non-equality
+ we'd have to split the loop into two loops and a middle statement. */
+ switch (code)
+ {
+ case LT_EXPR:
+ case LE_EXPR:
+ case GT_EXPR:
+ case GE_EXPR:
+ break;
+ default:
+ return NULL_TREE;
+ }
+
+ if (loop_exits_from_bb_p (loop, bb))
+ return NULL_TREE;
+
+ tree op0 = gimple_cond_lhs (stmt);
+ tree op1 = gimple_cond_rhs (stmt);
+ class loop *useloop = loop_containing_stmt (stmt);
+
+ if (!simple_iv (loop, useloop, op0, iv, false))
+ return NULL_TREE;
+ if (!simple_iv (loop, useloop, op1, &iv2, false))
+ return NULL_TREE;
+
+ /* Make it so that the first argument of the condition is
+ the looping one. */
+ if (!integer_zerop (iv2.step))
+ {
+ std::swap (op0, op1);
+ std::swap (*iv, iv2);
+ code = swap_tree_comparison (code);
+ gimple_cond_set_condition (stmt, code, op0, op1);
+ update_stmt (stmt);
+ }
+ else if (integer_zerop (iv->step))
+ return NULL_TREE;
+ if (!integer_zerop (iv2.step))
+ return NULL_TREE;
+ if (!iv->no_overflow)
+ return NULL_TREE;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Found potential split point: ");
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+ fprintf (dump_file, " { ");
+ print_generic_expr (dump_file, iv->base, TDF_SLIM);
+ fprintf (dump_file, " + I*");
+ print_generic_expr (dump_file, iv->step, TDF_SLIM);
+ fprintf (dump_file, " } %s ", get_tree_code_name (code));
+ print_generic_expr (dump_file, iv2.base, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
+ *border = iv2.base;
+ return op0;
+}
+
+/* Given a GUARD conditional stmt inside LOOP, which we want to make always
+ true or false depending on INITIAL_TRUE, and adjusted values NEXTVAL
+ (a post-increment IV) and NEWBOUND (the comparator) adjust the loop
+ exit test statement to loop back only if the GUARD statement will
+ also be true/false in the next iteration. */
+
+static void
+patch_loop_exit (class loop *loop, gcond *guard, tree nextval, tree newbound,
+ bool initial_true)
+{
+ edge exit = single_exit (loop);
+ gcond *stmt = as_a <gcond *> (last_stmt (exit->src));
+ gimple_cond_set_condition (stmt, gimple_cond_code (guard),
+ nextval, newbound);
+ update_stmt (stmt);
+
+ edge stay = EDGE_SUCC (exit->src, EDGE_SUCC (exit->src, 0) == exit);
+
+ exit->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
+ stay->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
+
+ if (initial_true)
+ {
+ exit->flags |= EDGE_FALSE_VALUE;
+ stay->flags |= EDGE_TRUE_VALUE;
+ }
+ else
+ {
+ exit->flags |= EDGE_TRUE_VALUE;
+ stay->flags |= EDGE_FALSE_VALUE;
+ }
+}
+
+/* Give an induction variable GUARD_IV, and its affine descriptor IV,
+ find the loop phi node in LOOP defining it directly, or create
+ such phi node. Return that phi node. */
+
+static gphi *
+find_or_create_guard_phi (class loop *loop, tree guard_iv, affine_iv * /*iv*/)
+{
+ gimple *def = SSA_NAME_DEF_STMT (guard_iv);
+ gphi *phi;
+ if ((phi = dyn_cast <gphi *> (def))
+ && gimple_bb (phi) == loop->header)
+ return phi;
+
+ /* XXX Create the PHI instead. */
+ return NULL;
+}
+
+/* Returns true if the exit values of all loop phi nodes can be
+ determined easily (i.e. that connect_loop_phis can determine them). */
+
+static bool
+easy_exit_values (class loop *loop)
+{
+ edge exit = single_exit (loop);
+ edge latch = loop_latch_edge (loop);
+ gphi_iterator psi;
+
+ /* Currently we regard the exit values as easy if they are the same
+ as the value over the backedge. Which is the case if the definition
+ of the backedge value dominates the exit edge. */
+ for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
+ {
+ gphi *phi = psi.phi ();
+ tree next = PHI_ARG_DEF_FROM_EDGE (phi, latch);
+ basic_block bb;
+ if (TREE_CODE (next) == SSA_NAME
+ && (bb = gimple_bb (SSA_NAME_DEF_STMT (next)))
+ && !dominated_by_p (CDI_DOMINATORS, exit->src, bb))
+ return false;
+ }
+
+ return true;
+}
+
+/* This function updates the SSA form after connect_loops made a new
+ edge NEW_E leading from LOOP1 exit to LOOP2 (via in intermediate
+ conditional). I.e. the second loop can now be entered either
+ via the original entry or via NEW_E, so the entry values of LOOP2
+ phi nodes are either the original ones or those at the exit
+ of LOOP1. Insert new phi nodes in LOOP2 pre-header reflecting
+ this. The loops need to fulfill easy_exit_values(). */
+
+static void
+connect_loop_phis (class loop *loop1, class loop *loop2, edge new_e)
+{
+ basic_block rest = loop_preheader_edge (loop2)->src;
+ gcc_assert (new_e->dest == rest);
+ edge skip_first = EDGE_PRED (rest, EDGE_PRED (rest, 0) == new_e);
+
+ edge firste = loop_preheader_edge (loop1);
+ edge seconde = loop_preheader_edge (loop2);
+ edge firstn = loop_latch_edge (loop1);
+ gphi_iterator psi_first, psi_second;
+ for (psi_first = gsi_start_phis (loop1->header),
+ psi_second = gsi_start_phis (loop2->header);
+ !gsi_end_p (psi_first);
+ gsi_next (&psi_first), gsi_next (&psi_second))
+ {
+ tree init, next, new_init;
+ use_operand_p op;
+ gphi *phi_first = psi_first.phi ();
+ gphi *phi_second = psi_second.phi ();
+
+ init = PHI_ARG_DEF_FROM_EDGE (phi_first, firste);
+ next = PHI_ARG_DEF_FROM_EDGE (phi_first, firstn);
+ op = PHI_ARG_DEF_PTR_FROM_EDGE (phi_second, seconde);
+ gcc_assert (operand_equal_for_phi_arg_p (init, USE_FROM_PTR (op)));
+
+ /* Prefer using original variable as a base for the new ssa name.
+ This is necessary for virtual ops, and useful in order to avoid
+ losing debug info for real ops. */
+ if (TREE_CODE (next) == SSA_NAME
+ && useless_type_conversion_p (TREE_TYPE (next),
+ TREE_TYPE (init)))
+ new_init = copy_ssa_name (next);
+ else if (TREE_CODE (init) == SSA_NAME
+ && useless_type_conversion_p (TREE_TYPE (init),
+ TREE_TYPE (next)))
+ new_init = copy_ssa_name (init);
+ else if (useless_type_conversion_p (TREE_TYPE (next),
+ TREE_TYPE (init)))
+ new_init = make_temp_ssa_name (TREE_TYPE (next), NULL,
+ "unrinittmp");
+ else
+ new_init = make_temp_ssa_name (TREE_TYPE (init), NULL,
+ "unrinittmp");
+
+ gphi * newphi = create_phi_node (new_init, rest);
+ add_phi_arg (newphi, init, skip_first, UNKNOWN_LOCATION);
+ add_phi_arg (newphi, next, new_e, UNKNOWN_LOCATION);
+ SET_USE (op, new_init);
+ }
+}
+
+/* The two loops LOOP1 and LOOP2 were just created by loop versioning,
+ they are still equivalent and placed in two arms of a diamond, like so:
+
+ .------if (cond)------.
+ v v
+ pre1 pre2
+ | |
+ .--->h1 h2<----.
+ | | | |
+ | ex1---. .---ex2 |
+ | / | | \ |
+ '---l1 X | l2---'
+ | |
+ | |
+ '--->join<---'
+
+ This function transforms the program such that LOOP1 is conditionally
+ falling through to LOOP2, or skipping it. This is done by splitting
+ the ex1->join edge at X in the diagram above, and inserting a condition
+ whose one arm goes to pre2, resulting in this situation:
+
+ .------if (cond)------.
+ v v
+ pre1 .---------->pre2
+ | | |
+ .--->h1 | h2<----.
+ | | | | |
+ | ex1---. | .---ex2 |
+ | / v | | \ |
+ '---l1 skip---' | l2---'
+ | |
+ | |
+ '--->join<---'
+
+
+ The condition used is the exit condition of LOOP1, which effectively means
+ that when the first loop exits (for whatever reason) but the real original
+ exit expression is still false the second loop will be entered.
+ The function returns the new edge cond->pre2.
+
+ This doesn't update the SSA form, see connect_loop_phis for that. */
+
+static edge
+connect_loops (class loop *loop1, class loop *loop2)
+{
+ edge exit = single_exit (loop1);
+ basic_block skip_bb = split_edge (exit);
+ gcond *skip_stmt;
+ gimple_stmt_iterator gsi;
+ edge new_e, skip_e;
+
+ gimple *stmt = last_stmt (exit->src);
+ skip_stmt = gimple_build_cond (gimple_cond_code (stmt),
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt),
+ NULL_TREE, NULL_TREE);
+ gsi = gsi_last_bb (skip_bb);
+ gsi_insert_after (&gsi, skip_stmt, GSI_NEW_STMT);
+
+ skip_e = EDGE_SUCC (skip_bb, 0);
+ skip_e->flags &= ~EDGE_FALLTHRU;
+ new_e = make_edge (skip_bb, loop_preheader_edge (loop2)->src, 0);
+ if (exit->flags & EDGE_TRUE_VALUE)
+ {
+ skip_e->flags |= EDGE_TRUE_VALUE;
+ new_e->flags |= EDGE_FALSE_VALUE;
+ }
+ else
+ {
+ skip_e->flags |= EDGE_FALSE_VALUE;
+ new_e->flags |= EDGE_TRUE_VALUE;
+ }
+
+ new_e->probability = profile_probability::likely ();
+ skip_e->probability = new_e->probability.invert ();
+
+ return new_e;
+}
+
+/* This returns the new bound for iterations given the original iteration
+ space in NITER, an arbitrary new bound BORDER, assumed to be some
+ comparison value with a different IV, the initial value GUARD_INIT of
+ that other IV, and the comparison code GUARD_CODE that compares
+ that other IV with BORDER. We return an SSA name, and place any
+ necessary statements for that computation into *STMTS.
+
+ For example for such a loop:
+
+ for (i = beg, j = guard_init; i < end; i++, j++)
+ if (j < border) // this is supposed to be true/false
+ ...
+
+ we want to return a new bound (on j) that makes the loop iterate
+ as long as the condition j < border stays true. We also don't want
+ to iterate more often than the original loop, so we have to introduce
+ some cut-off as well (via min/max), effectively resulting in:
+
+ newend = min (end+guard_init-beg, border)
+ for (i = beg; j = guard_init; j < newend; i++, j++)
+ if (j < c)
+ ...
+
+ Depending on the direction of the IVs and if the exit tests
+ are strict or non-strict we need to use MIN or MAX,
+ and add or subtract 1. This routine computes newend above. */
+
+static tree
+compute_new_first_bound (gimple_seq *stmts, class tree_niter_desc *niter,
+ tree border,
+ enum tree_code guard_code, tree guard_init)
+{
+ /* The niter structure contains the after-increment IV, we need
+ the loop-enter base, so subtract STEP once. */
+ tree controlbase = force_gimple_operand (niter->control.base,
+ stmts, true, NULL_TREE);
+ tree controlstep = niter->control.step;
+ tree enddiff;
+ if (POINTER_TYPE_P (TREE_TYPE (controlbase)))
+ {
+ controlstep = gimple_build (stmts, NEGATE_EXPR,
+ TREE_TYPE (controlstep), controlstep);
+ enddiff = gimple_build (stmts, POINTER_PLUS_EXPR,
+ TREE_TYPE (controlbase),
+ controlbase, controlstep);
+ }
+ else
+ enddiff = gimple_build (stmts, MINUS_EXPR,
+ TREE_TYPE (controlbase),
+ controlbase, controlstep);
+
+ /* Compute end-beg. */
+ gimple_seq stmts2;
+ tree end = force_gimple_operand (niter->bound, &stmts2,
+ true, NULL_TREE);
+ gimple_seq_add_seq_without_update (stmts, stmts2);
+ if (POINTER_TYPE_P (TREE_TYPE (enddiff)))
+ {
+ tree tem = gimple_convert (stmts, sizetype, enddiff);
+ tem = gimple_build (stmts, NEGATE_EXPR, sizetype, tem);
+ enddiff = gimple_build (stmts, POINTER_PLUS_EXPR,
+ TREE_TYPE (enddiff),
+ end, tem);
+ }
+ else
+ enddiff = gimple_build (stmts, MINUS_EXPR, TREE_TYPE (enddiff),
+ end, enddiff);
+
+ /* Compute guard_init + (end-beg). */
+ tree newbound;
+ enddiff = gimple_convert (stmts, TREE_TYPE (guard_init), enddiff);
+ if (POINTER_TYPE_P (TREE_TYPE (guard_init)))
+ {
+ enddiff = gimple_convert (stmts, sizetype, enddiff);
+ newbound = gimple_build (stmts, POINTER_PLUS_EXPR,
+ TREE_TYPE (guard_init),
+ guard_init, enddiff);
+ }
+ else
+ newbound = gimple_build (stmts, PLUS_EXPR, TREE_TYPE (guard_init),
+ guard_init, enddiff);
+
+ /* Depending on the direction of the IVs the new bound for the first
+ loop is the minimum or maximum of old bound and border.
+ Also, if the guard condition isn't strictly less or greater,
+ we need to adjust the bound. */
+ int addbound = 0;
+ enum tree_code minmax;
+ if (niter->cmp == LT_EXPR)
+ {
+ /* GT and LE are the same, inverted. */
+ if (guard_code == GT_EXPR || guard_code == LE_EXPR)
+ addbound = -1;
+ minmax = MIN_EXPR;
+ }
+ else
+ {
+ gcc_assert (niter->cmp == GT_EXPR);
+ if (guard_code == GE_EXPR || guard_code == LT_EXPR)
+ addbound = 1;
+ minmax = MAX_EXPR;
+ }
+
+ if (addbound)
+ {
+ tree type2 = TREE_TYPE (newbound);
+ if (POINTER_TYPE_P (type2))
+ type2 = sizetype;
+ newbound = gimple_build (stmts,
+ POINTER_TYPE_P (TREE_TYPE (newbound))
+ ? POINTER_PLUS_EXPR : PLUS_EXPR,
+ TREE_TYPE (newbound),
+ newbound,
+ build_int_cst (type2, addbound));
+ }
+
+ tree newend = gimple_build (stmts, minmax, TREE_TYPE (border),
+ border, newbound);
+ return newend;
+}
+
+/* Fix the two loop's bb count after split based on the split edge probability,
+ don't adjust the bbs dominated by true branches of that loop to avoid
+ dropping 1s down. */
+static void
+fix_loop_bb_probability (class loop *loop1, class loop *loop2, edge true_edge,
+ edge false_edge)
+{
+ update_ssa (TODO_update_ssa);
+
+ /* Proportion first loop's bb counts except those dominated by true
+ branch to avoid drop 1s down. */
+ basic_block *bbs1, *bbs2;
+ bbs1 = get_loop_body (loop1);
+ unsigned j;
+ for (j = 0; j < loop1->num_nodes; j++)
+ if (bbs1[j] == loop1->latch
+ || !dominated_by_p (CDI_DOMINATORS, bbs1[j], true_edge->dest))
+ bbs1[j]->count
+ = bbs1[j]->count.apply_probability (true_edge->probability);
+ free (bbs1);
+
+ /* Proportion second loop's bb counts except those dominated by false
+ branch to avoid drop 1s down. */
+ basic_block bbi_copy = get_bb_copy (false_edge->dest);
+ bbs2 = get_loop_body (loop2);
+ for (j = 0; j < loop2->num_nodes; j++)
+ if (bbs2[j] == loop2->latch
+ || !dominated_by_p (CDI_DOMINATORS, bbs2[j], bbi_copy))
+ bbs2[j]->count
+ = bbs2[j]->count.apply_probability (true_edge->probability.invert ());
+ free (bbs2);
+}
+
+/* Checks if LOOP contains an conditional block whose condition
+ depends on which side in the iteration space it is, and if so
+ splits the iteration space into two loops. Returns true if the
+ loop was split. NITER must contain the iteration descriptor for the
+ single exit of LOOP. */
+
+static bool
+split_loop (class loop *loop1)
+{
+ class tree_niter_desc niter;
+ basic_block *bbs;
+ unsigned i;
+ bool changed = false;
+ tree guard_iv;
+ tree border = NULL_TREE;
+ affine_iv iv;
+
+ if (!single_exit (loop1)
+ /* ??? We could handle non-empty latches when we split the latch edge
+ (not the exit edge), and put the new exit condition in the new block.
+ OTOH this executes some code unconditionally that might have been
+ skipped by the original exit before. */
+ || !empty_block_p (loop1->latch)
+ || !easy_exit_values (loop1)
+ || !number_of_iterations_exit (loop1, single_exit (loop1), &niter,
+ false, true)
+ || niter.cmp == ERROR_MARK
+ /* We can't yet handle loops controlled by a != predicate. */
+ || niter.cmp == NE_EXPR)
+ return false;
+
+ bbs = get_loop_body (loop1);
+
+ if (!can_copy_bbs_p (bbs, loop1->num_nodes))
+ {
+ free (bbs);
+ return false;
+ }
+
+ /* Find a splitting opportunity. */
+ for (i = 0; i < loop1->num_nodes; i++)
+ if ((guard_iv = split_at_bb_p (loop1, bbs[i], &border, &iv)))
+ {
+ /* Handling opposite steps is not implemented yet. Neither
+ is handling different step sizes. */
+ if ((tree_int_cst_sign_bit (iv.step)
+ != tree_int_cst_sign_bit (niter.control.step))
+ || !tree_int_cst_equal (iv.step, niter.control.step))
+ continue;
+
+ /* Find a loop PHI node that defines guard_iv directly,
+ or create one doing that. */
+ gphi *phi = find_or_create_guard_phi (loop1, guard_iv, &iv);
+ if (!phi)
+ continue;
+ gcond *guard_stmt = as_a<gcond *> (last_stmt (bbs[i]));
+ tree guard_init = PHI_ARG_DEF_FROM_EDGE (phi,
+ loop_preheader_edge (loop1));
+ enum tree_code guard_code = gimple_cond_code (guard_stmt);
+
+ /* Loop splitting is implemented by versioning the loop, placing
+ the new loop after the old loop, make the first loop iterate
+ as long as the conditional stays true (or false) and let the
+ second (new) loop handle the rest of the iterations.
+
+ First we need to determine if the condition will start being true
+ or false in the first loop. */
+ bool initial_true;
+ switch (guard_code)
+ {
+ case LT_EXPR:
+ case LE_EXPR:
+ initial_true = !tree_int_cst_sign_bit (iv.step);
+ break;
+ case GT_EXPR:
+ case GE_EXPR:
+ initial_true = tree_int_cst_sign_bit (iv.step);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ /* Build a condition that will skip the first loop when the
+ guard condition won't ever be true (or false). */
+ gimple_seq stmts2;
+ border = force_gimple_operand (border, &stmts2, true, NULL_TREE);
+ if (stmts2)
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop1),
+ stmts2);
+ tree cond = build2 (guard_code, boolean_type_node, guard_init, border);
+ if (!initial_true)
+ cond = fold_build1 (TRUTH_NOT_EXPR, boolean_type_node, cond);
+
+ edge true_edge, false_edge;
+ extract_true_false_edges_from_block (bbs[i], &true_edge, &false_edge);
+
+ /* Now version the loop, placing loop2 after loop1 connecting
+ them, and fix up SSA form for that. */
+ initialize_original_copy_tables ();
+ basic_block cond_bb;
+
+ class loop *loop2 = loop_version (loop1, cond, &cond_bb,
+ true_edge->probability,
+ true_edge->probability.invert (),
+ profile_probability::always (),
+ profile_probability::always (),
+ true);
+ gcc_assert (loop2);
+
+ edge new_e = connect_loops (loop1, loop2);
+ connect_loop_phis (loop1, loop2, new_e);
+
+ /* The iterations of the second loop is now already
+ exactly those that the first loop didn't do, but the
+ iteration space of the first loop is still the original one.
+ Compute the new bound for the guarding IV and patch the
+ loop exit to use it instead of original IV and bound. */
+ gimple_seq stmts = NULL;
+ tree newend = compute_new_first_bound (&stmts, &niter, border,
+ guard_code, guard_init);
+ if (stmts)
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop1),
+ stmts);
+ tree guard_next = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop1));
+ patch_loop_exit (loop1, guard_stmt, guard_next, newend, initial_true);
+
+ fix_loop_bb_probability (loop1, loop2, true_edge, false_edge);
+
+ /* Fix first loop's exit probability after scaling. */
+ edge exit_to_latch1 = single_pred_edge (loop1->latch);
+ exit_to_latch1->probability *= true_edge->probability;
+ single_exit (loop1)->probability
+ = exit_to_latch1->probability.invert ();
+
+ /* Finally patch out the two copies of the condition to be always
+ true/false (or opposite). */
+ gcond *force_true = as_a<gcond *> (last_stmt (bbs[i]));
+ gcond *force_false = as_a<gcond *> (last_stmt (get_bb_copy (bbs[i])));
+ if (!initial_true)
+ std::swap (force_true, force_false);
+ gimple_cond_make_true (force_true);
+ gimple_cond_make_false (force_false);
+ update_stmt (force_true);
+ update_stmt (force_false);
+
+ free_original_copy_tables ();
+
+ changed = true;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, ";; Loop split.\n");
+
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, guard_stmt, "loop split\n");
+
+ /* Only deal with the first opportunity. */
+ break;
+ }
+
+ free (bbs);
+ return changed;
+}
+
+/* Another transformation of loops like:
+
+ for (i = INIT (); CHECK (i); i = NEXT ())
+ {
+ if (expr (a_1, a_2, ..., a_n)) // expr is pure
+ a_j = ...; // change at least one a_j
+ else
+ S; // not change any a_j
+ }
+
+ into:
+
+ for (i = INIT (); CHECK (i); i = NEXT ())
+ {
+ if (expr (a_1, a_2, ..., a_n))
+ a_j = ...;
+ else
+ {
+ S;
+ i = NEXT ();
+ break;
+ }
+ }
+
+ for (; CHECK (i); i = NEXT ())
+ {
+ S;
+ }
+
+ */
+
+/* Data structure to hold temporary information during loop split upon
+ semi-invariant conditional statement. */
+class split_info {
+public:
+ /* Array of all basic blocks in a loop, returned by get_loop_body(). */
+ basic_block *bbs;
+
+ /* All memory store/clobber statements in a loop. */
+ auto_vec<gimple *> memory_stores;
+
+ /* Whether above memory stores vector has been filled. */
+ int need_init;
+
+ /* Control dependencies of basic blocks in a loop. */
+ auto_vec<hash_set<basic_block> *> control_deps;
+
+ split_info () : bbs (NULL), need_init (true) { }
+
+ ~split_info ()
+ {
+ if (bbs)
+ free (bbs);
+
+ for (unsigned i = 0; i < control_deps.length (); i++)
+ delete control_deps[i];
+ }
+};
+
+/* Find all statements with memory-write effect in LOOP, including memory
+ store and non-pure function call, and keep those in a vector. This work
+ is only done one time, for the vector should be constant during analysis
+ stage of semi-invariant condition. */
+
+static void
+find_vdef_in_loop (struct loop *loop)
+{
+ split_info *info = (split_info *) loop->aux;
+ gphi *vphi = get_virtual_phi (loop->header);
+
+ /* Indicate memory store vector has been filled. */
+ info->need_init = false;
+
+ /* If loop contains memory operation, there must be a virtual PHI node in
+ loop header basic block. */
+ if (vphi == NULL)
+ return;
+
+ /* All virtual SSA names inside the loop are connected to be a cyclic
+ graph via virtual PHI nodes. The virtual PHI node in loop header just
+ links the first and the last virtual SSA names, by using the last as
+ PHI operand to define the first. */
+ const edge latch = loop_latch_edge (loop);
+ const tree first = gimple_phi_result (vphi);
+ const tree last = PHI_ARG_DEF_FROM_EDGE (vphi, latch);
+
+ /* The virtual SSA cyclic graph might consist of only one SSA name, who
+ is defined by itself.
+
+ .MEM_1 = PHI <.MEM_2(loop entry edge), .MEM_1(latch edge)>
+
+ This means the loop contains only memory loads, so we can skip it. */
+ if (first == last)
+ return;
+
+ auto_vec<gimple *> other_stores;
+ auto_vec<tree> worklist;
+ auto_bitmap visited;
+
+ bitmap_set_bit (visited, SSA_NAME_VERSION (first));
+ bitmap_set_bit (visited, SSA_NAME_VERSION (last));
+ worklist.safe_push (last);
+
+ do
+ {
+ tree vuse = worklist.pop ();
+ gimple *stmt = SSA_NAME_DEF_STMT (vuse);
+
+ /* We mark the first and last SSA names as visited at the beginning,
+ and reversely start the process from the last SSA name towards the
+ first, which ensures that this do-while will not touch SSA names
+ defined outside the loop. */
+ gcc_assert (gimple_bb (stmt)
+ && flow_bb_inside_loop_p (loop, gimple_bb (stmt)));
+
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ {
+ gphi *phi = as_a <gphi *> (stmt);
+
+ for (unsigned i = 0; i < gimple_phi_num_args (phi); ++i)
+ {
+ tree arg = gimple_phi_arg_def (stmt, i);
+
+ if (bitmap_set_bit (visited, SSA_NAME_VERSION (arg)))
+ worklist.safe_push (arg);
+ }
+ }
+ else
+ {
+ tree prev = gimple_vuse (stmt);
+
+ /* Non-pure call statement is conservatively assumed to impact all
+ memory locations. So place call statements ahead of other memory
+ stores in the vector with an idea of using them as shortcut
+ terminators to memory alias analysis. */
+ if (gimple_code (stmt) == GIMPLE_CALL)
+ info->memory_stores.safe_push (stmt);
+ else
+ other_stores.safe_push (stmt);
+
+ if (bitmap_set_bit (visited, SSA_NAME_VERSION (prev)))
+ worklist.safe_push (prev);
+ }
+ } while (!worklist.is_empty ());
+
+ info->memory_stores.safe_splice (other_stores);
+}
+
+/* Two basic blocks have equivalent control dependency if one dominates to
+ the other, and it is post-dominated by the latter. Given a basic block
+ BB in LOOP, find farest equivalent dominating basic block. For BB, there
+ is a constraint that BB does not post-dominate loop header of LOOP, this
+ means BB is control-dependent on at least one basic block in LOOP. */
+
+static basic_block
+get_control_equiv_head_block (struct loop *loop, basic_block bb)
+{
+ while (!bb->aux)
+ {
+ basic_block dom_bb = get_immediate_dominator (CDI_DOMINATORS, bb);
+
+ gcc_checking_assert (dom_bb && flow_bb_inside_loop_p (loop, dom_bb));
+
+ if (!dominated_by_p (CDI_POST_DOMINATORS, dom_bb, bb))
+ break;
+
+ bb = dom_bb;
+ }
+ return bb;
+}
+
+/* Given a BB in LOOP, find out all basic blocks in LOOP that BB is control-
+ dependent on. */
+
+static hash_set<basic_block> *
+find_control_dep_blocks (struct loop *loop, basic_block bb)
+{
+ /* BB has same control dependency as loop header, then it is not control-
+ dependent on any basic block in LOOP. */
+ if (dominated_by_p (CDI_POST_DOMINATORS, loop->header, bb))
+ return NULL;
+
+ basic_block equiv_head = get_control_equiv_head_block (loop, bb);
+
+ if (equiv_head->aux)
+ {
+ /* There is a basic block containing control dependency equivalent
+ to BB. No need to recompute that, and also set this information
+ to other equivalent basic blocks. */
+ for (; bb != equiv_head;
+ bb = get_immediate_dominator (CDI_DOMINATORS, bb))
+ bb->aux = equiv_head->aux;
+ return (hash_set<basic_block> *) equiv_head->aux;
+ }
+
+ /* A basic block X is control-dependent on another Y iff there exists
+ a path from X to Y, in which every basic block other than X and Y
+ is post-dominated by Y, but X is not post-dominated by Y.
+
+ According to this rule, traverse basic blocks in the loop backwards
+ starting from BB, if a basic block is post-dominated by BB, extend
+ current post-dominating path to this block, otherwise it is another
+ one that BB is control-dependent on. */
+
+ auto_vec<basic_block> pdom_worklist;
+ hash_set<basic_block> pdom_visited;
+ hash_set<basic_block> *dep_bbs = new hash_set<basic_block>;
+
+ pdom_worklist.safe_push (equiv_head);
+
+ do
+ {
+ basic_block pdom_bb = pdom_worklist.pop ();
+ edge_iterator ei;
+ edge e;
+
+ if (pdom_visited.add (pdom_bb))
+ continue;
+
+ FOR_EACH_EDGE (e, ei, pdom_bb->preds)
+ {
+ basic_block pred_bb = e->src;
+
+ if (!dominated_by_p (CDI_POST_DOMINATORS, pred_bb, bb))
+ {
+ dep_bbs->add (pred_bb);
+ continue;
+ }
+
+ pred_bb = get_control_equiv_head_block (loop, pred_bb);
+
+ if (pdom_visited.contains (pred_bb))
+ continue;
+
+ if (!pred_bb->aux)
+ {
+ pdom_worklist.safe_push (pred_bb);
+ continue;
+ }
+
+ /* If control dependency of basic block is available, fast extend
+ post-dominating path using the information instead of advancing
+ forward step-by-step. */
+ hash_set<basic_block> *pred_dep_bbs
+ = (hash_set<basic_block> *) pred_bb->aux;
+
+ for (hash_set<basic_block>::iterator iter = pred_dep_bbs->begin ();
+ iter != pred_dep_bbs->end (); ++iter)
+ {
+ basic_block pred_dep_bb = *iter;
+
+ /* Basic blocks can either be in control dependency of BB, or
+ must be post-dominated by BB, if so, extend the path from
+ these basic blocks. */
+ if (!dominated_by_p (CDI_POST_DOMINATORS, pred_dep_bb, bb))
+ dep_bbs->add (pred_dep_bb);
+ else if (!pdom_visited.contains (pred_dep_bb))
+ pdom_worklist.safe_push (pred_dep_bb);
+ }
+ }
+ } while (!pdom_worklist.is_empty ());
+
+ /* Record computed control dependencies in loop so that we can reach them
+ when reclaiming resources. */
+ ((split_info *) loop->aux)->control_deps.safe_push (dep_bbs);
+
+ /* Associate control dependence with related equivalent basic blocks. */
+ for (equiv_head->aux = dep_bbs; bb != equiv_head;
+ bb = get_immediate_dominator (CDI_DOMINATORS, bb))
+ bb->aux = dep_bbs;
+
+ return dep_bbs;
+}
+
+/* Forward declaration */
+
+static bool
+stmt_semi_invariant_p_1 (struct loop *loop, gimple *stmt,
+ const_basic_block skip_head,
+ hash_map<gimple *, bool> &stmt_stat);
+
+/* Given STMT, memory load or pure call statement, check whether it is impacted
+ by some memory store in LOOP, excluding trace starting from SKIP_HEAD (the
+ trace is composed of SKIP_HEAD and those basic block dominated by it, always
+ corresponds to one branch of a conditional statement). If SKIP_HEAD is
+ NULL, all basic blocks of LOOP are checked. */
+
+static bool
+vuse_semi_invariant_p (struct loop *loop, gimple *stmt,
+ const_basic_block skip_head)
+{
+ split_info *info = (split_info *) loop->aux;
+ tree rhs = NULL_TREE;
+ ao_ref ref;
+ gimple *store;
+ unsigned i;
+
+ /* Collect memory store/clobber statements if haven't done that. */
+ if (info->need_init)
+ find_vdef_in_loop (loop);
+
+ if (is_gimple_assign (stmt))
+ rhs = gimple_assign_rhs1 (stmt);
+
+ ao_ref_init (&ref, rhs);
+
+ FOR_EACH_VEC_ELT (info->memory_stores, i, store)
+ {
+ /* Skip basic blocks dominated by SKIP_HEAD, if non-NULL. */
+ if (skip_head
+ && dominated_by_p (CDI_DOMINATORS, gimple_bb (store), skip_head))
+ continue;
+
+ if (!ref.ref || stmt_may_clobber_ref_p_1 (store, &ref))
+ return false;
+ }
+
+ return true;
+}
+
+/* Suppose one condition branch, led by SKIP_HEAD, is not executed since
+ certain iteration of LOOP, check whether an SSA name (NAME) remains
+ unchanged in next iteration. We call this characteristic semi-
+ invariantness. SKIP_HEAD might be NULL, if so, nothing excluded, all basic
+ blocks and control flows in the loop will be considered. Semi-invariant
+ state of checked statement is cached in hash map STMT_STAT to avoid
+ redundant computation in possible following re-check. */
+
+static inline bool
+ssa_semi_invariant_p (struct loop *loop, tree name,
+ const_basic_block skip_head,
+ hash_map<gimple *, bool> &stmt_stat)
+{
+ gimple *def = SSA_NAME_DEF_STMT (name);
+ const_basic_block def_bb = gimple_bb (def);
+
+ /* An SSA name defined outside loop is definitely semi-invariant. */
+ if (!def_bb || !flow_bb_inside_loop_p (loop, def_bb))
+ return true;
+
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name))
+ return false;
+
+ return stmt_semi_invariant_p_1 (loop, def, skip_head, stmt_stat);
+}
+
+/* Check whether a loop iteration PHI node (LOOP_PHI) defines a value that is
+ semi-invariant in LOOP. Basic blocks dominated by SKIP_HEAD (if non-NULL),
+ are excluded from LOOP. */
+
+static bool
+loop_iter_phi_semi_invariant_p (struct loop *loop, gphi *loop_phi,
+ const_basic_block skip_head)
+{
+ const_edge latch = loop_latch_edge (loop);
+ tree name = gimple_phi_result (loop_phi);
+ tree from = PHI_ARG_DEF_FROM_EDGE (loop_phi, latch);
+
+ gcc_checking_assert (from);
+
+ /* Loop iteration PHI node locates in loop header, and it has two source
+ operands, one is an initial value coming from outside the loop, the other
+ is a value through latch of the loop, which is derived in last iteration,
+ we call the latter latch value. From the PHI node to definition of latch
+ value, if excluding branch trace starting from SKIP_HEAD, except copy-
+ assignment or likewise, there is no other kind of value redefinition, SSA
+ name defined by the PHI node is semi-invariant.
+
+ loop entry
+ | .--- latch ---.
+ | | |
+ v v |
+ x_1 = PHI <x_0, x_3> |
+ | |
+ v |
+ .------- if (cond) -------. |
+ | | |
+ | [ SKIP ] |
+ | | |
+ | x_2 = ... |
+ | | |
+ '---- T ---->.<---- F ----' |
+ | |
+ v |
+ x_3 = PHI <x_1, x_2> |
+ | |
+ '----------------------'
+
+ Suppose in certain iteration, execution flow in above graph goes through
+ true branch, which means that one source value to define x_3 in false
+ branch (x_2) is skipped, x_3 only comes from x_1, and x_1 in next
+ iterations is defined by x_3, we know that x_1 will never changed if COND
+ always chooses true branch from then on. */
+
+ while (from != name)
+ {
+ /* A new value comes from a CONSTANT. */
+ if (TREE_CODE (from) != SSA_NAME)
+ return false;
+
+ gimple *stmt = SSA_NAME_DEF_STMT (from);
+ const_basic_block bb = gimple_bb (stmt);
+
+ /* A new value comes from outside the loop. */
+ if (!bb || !flow_bb_inside_loop_p (loop, bb))
+ return false;
+
+ from = NULL_TREE;
+
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ {
+ gphi *phi = as_a <gphi *> (stmt);
+
+ for (unsigned i = 0; i < gimple_phi_num_args (phi); ++i)
+ {
+ if (skip_head)
+ {
+ const_edge e = gimple_phi_arg_edge (phi, i);
+
+ /* Don't consider redefinitions in excluded basic blocks. */
+ if (dominated_by_p (CDI_DOMINATORS, e->src, skip_head))
+ continue;
+ }
+
+ tree arg = gimple_phi_arg_def (phi, i);
+
+ if (!from)
+ from = arg;
+ else if (!operand_equal_p (from, arg, 0))
+ /* There are more than one source operands that provide
+ different values to the SSA name, it is variant. */
+ return false;
+ }
+ }
+ else if (gimple_code (stmt) == GIMPLE_ASSIGN)
+ {
+ /* For simple value copy, check its rhs instead. */
+ if (gimple_assign_ssa_name_copy_p (stmt))
+ from = gimple_assign_rhs1 (stmt);
+ }
+
+ /* Any other kind of definition is deemed to introduce a new value
+ to the SSA name. */
+ if (!from)
+ return false;
+ }
+ return true;
+}
+
+/* Check whether conditional predicates that BB is control-dependent on, are
+ semi-invariant in LOOP. Basic blocks dominated by SKIP_HEAD (if non-NULL),
+ are excluded from LOOP. Semi-invariant state of checked statement is cached
+ in hash map STMT_STAT. */
+
+static bool
+control_dep_semi_invariant_p (struct loop *loop, basic_block bb,
+ const_basic_block skip_head,
+ hash_map<gimple *, bool> &stmt_stat)
+{
+ hash_set<basic_block> *dep_bbs = find_control_dep_blocks (loop, bb);
+
+ if (!dep_bbs)
+ return true;
+
+ for (hash_set<basic_block>::iterator iter = dep_bbs->begin ();
+ iter != dep_bbs->end (); ++iter)
+ {
+ gimple *last = last_stmt (*iter);
+
+ if (!last)
+ return false;
+
+ /* Only check condition predicates. */
+ if (gimple_code (last) != GIMPLE_COND
+ && gimple_code (last) != GIMPLE_SWITCH)
+ return false;
+
+ if (!stmt_semi_invariant_p_1 (loop, last, skip_head, stmt_stat))
+ return false;
+ }
+
+ return true;
+}
+
+/* Check whether STMT is semi-invariant in LOOP, iff all its operands are
+ semi-invariant, consequently, all its defined values are semi-invariant.
+ Basic blocks dominated by SKIP_HEAD (if non-NULL), are excluded from LOOP.
+ Semi-invariant state of checked statement is cached in hash map
+ STMT_STAT. */
+
+static bool
+stmt_semi_invariant_p_1 (struct loop *loop, gimple *stmt,
+ const_basic_block skip_head,
+ hash_map<gimple *, bool> &stmt_stat)
+{
+ bool existed;
+ bool &invar = stmt_stat.get_or_insert (stmt, &existed);
+
+ if (existed)
+ return invar;
+
+ /* A statement might depend on itself, which is treated as variant. So set
+ state of statement under check to be variant to ensure that. */
+ invar = false;
+
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ {
+ gphi *phi = as_a <gphi *> (stmt);
+
+ if (gimple_bb (stmt) == loop->header)
+ {
+ /* If the entry value is subject to abnormal coalescing
+ avoid the transform since we're going to duplicate the
+ loop header and thus likely introduce overlapping life-ranges
+ between the PHI def and the entry on the path when the
+ first loop is skipped. */
+ tree entry_def
+ = PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop));
+ if (TREE_CODE (entry_def) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (entry_def))
+ return false;
+ invar = loop_iter_phi_semi_invariant_p (loop, phi, skip_head);
+ return invar;
+ }
+
+ /* For a loop PHI node that does not locate in loop header, it is semi-
+ invariant only if two conditions are met. The first is its source
+ values are derived from CONSTANT (including loop-invariant value), or
+ from SSA name defined by semi-invariant loop iteration PHI node. The
+ second is its source incoming edges are control-dependent on semi-
+ invariant conditional predicates. */
+ for (unsigned i = 0; i < gimple_phi_num_args (phi); ++i)
+ {
+ const_edge e = gimple_phi_arg_edge (phi, i);
+ tree arg = gimple_phi_arg_def (phi, i);
+
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ if (!ssa_semi_invariant_p (loop, arg, skip_head, stmt_stat))
+ return false;
+
+ /* If source value is defined in location from where the source
+ edge comes in, no need to check control dependency again
+ since this has been done in above SSA name check stage. */
+ if (e->src == gimple_bb (SSA_NAME_DEF_STMT (arg)))
+ continue;
+ }
+
+ if (!control_dep_semi_invariant_p (loop, e->src, skip_head,
+ stmt_stat))
+ return false;
+ }
+ }
+ else
+ {
+ ssa_op_iter iter;
+ tree use;
+
+ /* Volatile memory load or return of normal (non-const/non-pure) call
+ should not be treated as constant in each iteration of loop. */
+ if (gimple_has_side_effects (stmt))
+ return false;
+
+ /* Check if any memory store may kill memory load at this place. */
+ if (gimple_vuse (stmt) && !vuse_semi_invariant_p (loop, stmt, skip_head))
+ return false;
+
+ /* Although operand of a statement might be SSA name, CONSTANT or
+ VARDECL, here we only need to check SSA name operands. This is
+ because check on VARDECL operands, which involve memory loads,
+ must have been done prior to invocation of this function in
+ vuse_semi_invariant_p. */
+ FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
+ if (!ssa_semi_invariant_p (loop, use, skip_head, stmt_stat))
+ return false;
+ }
+
+ if (!control_dep_semi_invariant_p (loop, gimple_bb (stmt), skip_head,
+ stmt_stat))
+ return false;
+
+ /* Here we SHOULD NOT use invar = true, since hash map might be changed due
+ to new insertion, and thus invar may point to invalid memory. */
+ stmt_stat.put (stmt, true);
+ return true;
+}
+
+/* A helper function to check whether STMT is semi-invariant in LOOP. Basic
+ blocks dominated by SKIP_HEAD (if non-NULL), are excluded from LOOP. */
+
+static bool
+stmt_semi_invariant_p (struct loop *loop, gimple *stmt,
+ const_basic_block skip_head)
+{
+ hash_map<gimple *, bool> stmt_stat;
+ return stmt_semi_invariant_p_1 (loop, stmt, skip_head, stmt_stat);
+}
+
+/* Determine when conditional statement never transfers execution to one of its
+ branch, whether we can remove the branch's leading basic block (BRANCH_BB)
+ and those basic blocks dominated by BRANCH_BB. */
+
+static bool
+branch_removable_p (basic_block branch_bb)
+{
+ edge_iterator ei;
+ edge e;
+
+ if (single_pred_p (branch_bb))
+ return true;
+
+ FOR_EACH_EDGE (e, ei, branch_bb->preds)
+ {
+ if (dominated_by_p (CDI_DOMINATORS, e->src, branch_bb))
+ continue;
+
+ if (dominated_by_p (CDI_DOMINATORS, branch_bb, e->src))
+ continue;
+
+ /* The branch can be reached from opposite branch, or from some
+ statement not dominated by the conditional statement. */
+ return false;
+ }
+
+ return true;
+}
+
+/* Find out which branch of a conditional statement (COND) is invariant in the
+ execution context of LOOP. That is: once the branch is selected in certain
+ iteration of the loop, any operand that contributes to computation of the
+ conditional statement remains unchanged in all following iterations. */
+
+static edge
+get_cond_invariant_branch (struct loop *loop, gcond *cond)
+{
+ basic_block cond_bb = gimple_bb (cond);
+ basic_block targ_bb[2];
+ bool invar[2];
+ unsigned invar_checks = 0;
+
+ for (unsigned i = 0; i < 2; i++)
+ {
+ targ_bb[i] = EDGE_SUCC (cond_bb, i)->dest;
+
+ /* One branch directs to loop exit, no need to perform loop split upon
+ this conditional statement. Firstly, it is trivial if the exit branch
+ is semi-invariant, for the statement is just to break loop. Secondly,
+ if the opposite branch is semi-invariant, it means that the statement
+ is real loop-invariant, which is covered by loop unswitch. */
+ if (!flow_bb_inside_loop_p (loop, targ_bb[i]))
+ return NULL;
+ }
+
+ for (unsigned i = 0; i < 2; i++)
+ {
+ invar[!i] = false;
+
+ if (!branch_removable_p (targ_bb[i]))
+ continue;
+
+ /* Given a semi-invariant branch, if its opposite branch dominates
+ loop latch, it and its following trace will only be executed in
+ final iteration of loop, namely it is not part of repeated body
+ of the loop. Similar to the above case that the branch is loop
+ exit, no need to split loop. */
+ if (dominated_by_p (CDI_DOMINATORS, loop->latch, targ_bb[i]))
+ continue;
+
+ invar[!i] = stmt_semi_invariant_p (loop, cond, targ_bb[i]);
+ invar_checks++;
+ }
+
+ /* With both branches being invariant (handled by loop unswitch) or
+ variant is not what we want. */
+ if (invar[0] ^ !invar[1])
+ return NULL;
+
+ /* Found a real loop-invariant condition, do nothing. */
+ if (invar_checks < 2 && stmt_semi_invariant_p (loop, cond, NULL))
+ return NULL;
+
+ return EDGE_SUCC (cond_bb, invar[0] ? 0 : 1);
+}
+
+/* Calculate increased code size measured by estimated insn number if applying
+ loop split upon certain branch (BRANCH_EDGE) of a conditional statement. */
+
+static int
+compute_added_num_insns (struct loop *loop, const_edge branch_edge)
+{
+ basic_block cond_bb = branch_edge->src;
+ unsigned branch = EDGE_SUCC (cond_bb, 1) == branch_edge;
+ basic_block opposite_bb = EDGE_SUCC (cond_bb, !branch)->dest;
+ basic_block *bbs = ((split_info *) loop->aux)->bbs;
+ int num = 0;
+
+ for (unsigned i = 0; i < loop->num_nodes; i++)
+ {
+ /* Do no count basic blocks only in opposite branch. */
+ if (dominated_by_p (CDI_DOMINATORS, bbs[i], opposite_bb))
+ continue;
+
+ num += estimate_num_insns_seq (bb_seq (bbs[i]), &eni_size_weights);
+ }
+
+ /* It is unnecessary to evaluate expression of the conditional statement
+ in new loop that contains only invariant branch. This expression should
+ be constant value (either true or false). Exclude code size of insns
+ that contribute to computation of the expression. */
+
+ auto_vec<gimple *> worklist;
+ hash_set<gimple *> removed;
+ gimple *stmt = last_stmt (cond_bb);
+
+ worklist.safe_push (stmt);
+ removed.add (stmt);
+ num -= estimate_num_insns (stmt, &eni_size_weights);
+
+ do
+ {
+ ssa_op_iter opnd_iter;
+ use_operand_p opnd_p;
+
+ stmt = worklist.pop ();
+ FOR_EACH_PHI_OR_STMT_USE (opnd_p, stmt, opnd_iter, SSA_OP_USE)
+ {
+ tree opnd = USE_FROM_PTR (opnd_p);
+
+ if (TREE_CODE (opnd) != SSA_NAME || SSA_NAME_IS_DEFAULT_DEF (opnd))
+ continue;
+
+ gimple *opnd_stmt = SSA_NAME_DEF_STMT (opnd);
+ use_operand_p use_p;
+ imm_use_iterator use_iter;
+
+ if (removed.contains (opnd_stmt)
+ || !flow_bb_inside_loop_p (loop, gimple_bb (opnd_stmt)))
+ continue;
+
+ FOR_EACH_IMM_USE_FAST (use_p, use_iter, opnd)
+ {
+ gimple *use_stmt = USE_STMT (use_p);
+
+ if (!is_gimple_debug (use_stmt) && !removed.contains (use_stmt))
+ {
+ opnd_stmt = NULL;
+ break;
+ }
+ }
+
+ if (opnd_stmt)
+ {
+ worklist.safe_push (opnd_stmt);
+ removed.add (opnd_stmt);
+ num -= estimate_num_insns (opnd_stmt, &eni_size_weights);
+ }
+ }
+ } while (!worklist.is_empty ());
+
+ gcc_assert (num >= 0);
+ return num;
+}
+
+/* Find out loop-invariant branch of a conditional statement (COND) if it has,
+ and check whether it is eligible and profitable to perform loop split upon
+ this branch in LOOP. */
+
+static edge
+get_cond_branch_to_split_loop (struct loop *loop, gcond *cond)
+{
+ edge invar_branch = get_cond_invariant_branch (loop, cond);
+ if (!invar_branch)
+ return NULL;
+
+ /* When accurate profile information is available, and execution
+ frequency of the branch is too low, just let it go. */
+ profile_probability prob = invar_branch->probability;
+ if (prob.reliable_p ())
+ {
+ int thres = param_min_loop_cond_split_prob;
+
+ if (prob < profile_probability::always ().apply_scale (thres, 100))
+ return NULL;
+ }
+
+ /* Add a threshold for increased code size to disable loop split. */
+ if (compute_added_num_insns (loop, invar_branch) > param_max_peeled_insns)
+ return NULL;
+
+ return invar_branch;
+}
+
+/* Given a loop (LOOP1) with a loop-invariant branch (INVAR_BRANCH) of some
+ conditional statement, perform loop split transformation illustrated
+ as the following graph.
+
+ .-------T------ if (true) ------F------.
+ | .---------------. |
+ | | | |
+ v | v v
+ pre-header | pre-header
+ | .------------. | | .------------.
+ | | | | | | |
+ | v | | | v |
+ header | | header |
+ | | | | |
+ .--- if (cond) ---. | | .--- if (true) ---. |
+ | | | | | | |
+ invariant | | | invariant | |
+ | | | | | | |
+ '---T--->.<---F---' | | '---T--->.<---F---' |
+ | | / | |
+ stmts | / stmts |
+ | F T | |
+ / \ | / / \ |
+ .-------* * [ if (cond) ] .-------* * |
+ | | | | | |
+ | latch | | latch |
+ | | | | | |
+ | '------------' | '------------'
+ '------------------------. .-----------'
+ loop1 | | loop2
+ v v
+ exits
+
+ In the graph, loop1 represents the part derived from original one, and
+ loop2 is duplicated using loop_version (), which corresponds to the part
+ of original one being splitted out. In original latch edge of loop1, we
+ insert a new conditional statement duplicated from the semi-invariant cond,
+ and one of its branch goes back to loop1 header as a latch edge, and the
+ other branch goes to loop2 pre-header as an entry edge. And also in loop2,
+ we abandon the variant branch of the conditional statement by setting a
+ constant bool condition, based on which branch is semi-invariant. */
+
+static bool
+do_split_loop_on_cond (struct loop *loop1, edge invar_branch)
+{
+ basic_block cond_bb = invar_branch->src;
+ bool true_invar = !!(invar_branch->flags & EDGE_TRUE_VALUE);
+ gcond *cond = as_a <gcond *> (last_stmt (cond_bb));
+
+ gcc_assert (cond_bb->loop_father == loop1);
+
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, cond,
+ "loop split on semi-invariant condition at %s branch\n",
+ true_invar ? "true" : "false");
+
+ initialize_original_copy_tables ();
+
+ struct loop *loop2 = loop_version (loop1, boolean_true_node, NULL,
+ invar_branch->probability.invert (),
+ invar_branch->probability,
+ profile_probability::always (),
+ profile_probability::always (),
+ true);
+ if (!loop2)
+ {
+ free_original_copy_tables ();
+ return false;
+ }
+
+ basic_block cond_bb_copy = get_bb_copy (cond_bb);
+ gcond *cond_copy = as_a<gcond *> (last_stmt (cond_bb_copy));
+
+ /* Replace the condition in loop2 with a bool constant to let PassManager
+ remove the variant branch after current pass completes. */
+ if (true_invar)
+ gimple_cond_make_true (cond_copy);
+ else
+ gimple_cond_make_false (cond_copy);
+
+ update_stmt (cond_copy);
+
+ /* Insert a new conditional statement on latch edge of loop1, its condition
+ is duplicated from the semi-invariant. This statement acts as a switch
+ to transfer execution from loop1 to loop2, when loop1 enters into
+ invariant state. */
+ basic_block latch_bb = split_edge (loop_latch_edge (loop1));
+ basic_block break_bb = split_edge (single_pred_edge (latch_bb));
+ gimple *break_cond = gimple_build_cond (gimple_cond_code(cond),
+ gimple_cond_lhs (cond),
+ gimple_cond_rhs (cond),
+ NULL_TREE, NULL_TREE);
+
+ gimple_stmt_iterator gsi = gsi_last_bb (break_bb);
+ gsi_insert_after (&gsi, break_cond, GSI_NEW_STMT);
+
+ edge to_loop1 = single_succ_edge (break_bb);
+ edge to_loop2 = make_edge (break_bb, loop_preheader_edge (loop2)->src, 0);
+
+ to_loop1->flags &= ~EDGE_FALLTHRU;
+ to_loop1->flags |= true_invar ? EDGE_FALSE_VALUE : EDGE_TRUE_VALUE;
+ to_loop2->flags |= true_invar ? EDGE_TRUE_VALUE : EDGE_FALSE_VALUE;
+
+ /* Due to introduction of a control flow edge from loop1 latch to loop2
+ pre-header, we should update PHIs in loop2 to reflect this connection
+ between loop1 and loop2. */
+ connect_loop_phis (loop1, loop2, to_loop2);
+
+ edge true_edge, false_edge, skip_edge1, skip_edge2;
+ extract_true_false_edges_from_block (cond_bb, &true_edge, &false_edge);
+
+ skip_edge1 = true_invar ? false_edge : true_edge;
+ skip_edge2 = true_invar ? true_edge : false_edge;
+ fix_loop_bb_probability (loop1, loop2, skip_edge1, skip_edge2);
+
+ /* Fix first loop's exit probability after scaling. */
+ to_loop1->probability = invar_branch->probability.invert ();
+ to_loop2->probability = invar_branch->probability;
+
+ free_original_copy_tables ();
+
+ return true;
+}
+
+/* Traverse all conditional statements in LOOP, to find out a good candidate
+ upon which we can do loop split. */
+
+static bool
+split_loop_on_cond (struct loop *loop)
+{
+ split_info *info = new split_info ();
+ basic_block *bbs = info->bbs = get_loop_body (loop);
+ bool do_split = false;
+
+ /* Allocate an area to keep temporary info, and associate its address
+ with loop aux field. */
+ loop->aux = info;
+
+ for (unsigned i = 0; i < loop->num_nodes; i++)
+ bbs[i]->aux = NULL;
+
+ for (unsigned i = 0; i < loop->num_nodes; i++)
+ {
+ basic_block bb = bbs[i];
+
+ /* We only consider conditional statement, which be executed at most once
+ in each iteration of the loop. So skip statements in inner loops. */
+ if ((bb->loop_father != loop) || (bb->flags & BB_IRREDUCIBLE_LOOP))
+ continue;
+
+ /* Actually this check is not a must constraint. With it, we can ensure
+ conditional statement will always be executed in each iteration. */
+ if (!dominated_by_p (CDI_DOMINATORS, loop->latch, bb))
+ continue;
+
+ gimple *last = last_stmt (bb);
+
+ if (!last || gimple_code (last) != GIMPLE_COND)
+ continue;
+
+ gcond *cond = as_a <gcond *> (last);
+ edge branch_edge = get_cond_branch_to_split_loop (loop, cond);
+
+ if (branch_edge)
+ {
+ do_split_loop_on_cond (loop, branch_edge);
+ do_split = true;
+ break;
+ }
+ }
+
+ delete info;
+ loop->aux = NULL;
+
+ return do_split;
+}
+
+/* Main entry point. Perform loop splitting on all suitable loops. */
+
+static unsigned int
+tree_ssa_split_loops (void)
+{
+ bool changed = false;
+
+ gcc_assert (scev_initialized_p ());
+
+ calculate_dominance_info (CDI_POST_DOMINATORS);
+
+ for (auto loop : loops_list (cfun, LI_INCLUDE_ROOT))
+ loop->aux = NULL;
+
+ /* Go through all loops starting from innermost. */
+ for (auto loop : loops_list (cfun, LI_FROM_INNERMOST))
+ {
+ if (loop->aux)
+ {
+ /* If any of our inner loops was split, don't split us,
+ and mark our containing loop as having had splits as well. */
+ loop_outer (loop)->aux = loop;
+ continue;
+ }
+
+ if (optimize_loop_for_size_p (loop))
+ continue;
+
+ if (split_loop (loop) || split_loop_on_cond (loop))
+ {
+ /* Mark our containing loop as having had some split inner loops. */
+ loop_outer (loop)->aux = loop;
+ changed = true;
+ }
+ }
+
+ for (auto loop : loops_list (cfun, LI_INCLUDE_ROOT))
+ loop->aux = NULL;
+
+ clear_aux_for_blocks ();
+
+ free_dominance_info (CDI_POST_DOMINATORS);
+
+ if (changed)
+ {
+ rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
+ return TODO_cleanup_cfg;
+ }
+ return 0;
+}
+
+/* Loop splitting pass. */
+
+namespace {
+
+const pass_data pass_data_loop_split =
+{
+ GIMPLE_PASS, /* type */
+ "lsplit", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ TV_LOOP_SPLIT, /* tv_id */
+ PROP_cfg, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+};
+
+class pass_loop_split : public gimple_opt_pass
+{
+public:
+ pass_loop_split (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_loop_split, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ virtual bool gate (function *) { return flag_split_loops != 0; }
+ virtual unsigned int execute (function *);
+
+}; // class pass_loop_split
+
+unsigned int
+pass_loop_split::execute (function *fun)
+{
+ if (number_of_loops (fun) <= 1)
+ return 0;
+
+ return tree_ssa_split_loops ();
+}
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_loop_split (gcc::context *ctxt)
+{
+ return new pass_loop_split (ctxt);
+}