Commit Graph

59 Commits

Author SHA1 Message Date
Jakub Jelinek
254a858ae7 Update copyright years. 2026-01-02 09:56:11 +01:00
Andrew MacLeod
71f41d9b3a Force recalculation when relations are registered.
Whena relation is registered between 2 ssa-names, update their timestamps.
Any calculations using those names will be stale and forced to recalculate.

	* gimple-range-cache.cc (ranger_cache::update_consumers): New.
	* gimple-range-cache.h (update_consumers): New prototype.
	* gimple-range-fold.cc (fur_depend::fur_depend): Add cache ptr.
	(fur_depend::register_relation): call update_consumers.
	* gimple-range-fold.h (fur_depend): Add a cache pointer.
	* gimple-range.cc (gimple_ranger::fold_range_internal): Add cache ptr.
2025-11-16 17:20:41 -05:00
Jakub Jelinek
6441eb6dc0 Update copyright years. 2025-01-02 11:59:57 +01:00
Jakub Jelinek
50332a4fdd gcc: Remove trailing whitespace
I've tried to build stage3 with
-Wleading-whitespace=blanks -Wtrailing-whitespace=blank -Wno-error=leading-whitespace=blanks -Wno-error=trailing-whitespace=blank
added to STRICT_WARN and that expectably resulted in about
2744 unique trailing whitespace warnings and 124837 leading whitespace
warnings when excluding *.md files (which obviously is in big part a
generator issue).  Others from that are generator related, I think those
need to be solved later.

The following patch just fixes up the easy case (trailing whitespace),
which could be easily automated:
for i in `find . -name \*.h -o -name \*.cc -o -name \*.c | xargs grep -l '[ 	]$' | grep -v testsuite/`; do sed -i -e 's/[ 	]*$//' $i; done
I've excluded files which I knew are obviously generated or go FE.

Is there anything else we'd want to avoid the changes?

Due to patch size, I've split it between gcc/ part (this patch)
and rest (include/, libiberty/, libgcc/, libcpp/, libstdc++-v3/).

2024-10-24  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* lra-assigns.cc: Remove trailing whitespace.
	* symtab.cc: Likewise.
	* stmt.cc: Likewise.
	* cgraphbuild.cc: Likewise.
	* cfgcleanup.cc: Likewise.
	* loop-init.cc: Likewise.
	* df-problems.cc: Likewise.
	* diagnostic-macro-unwinding.cc: Likewise.
	* langhooks.h: Likewise.
	* except.cc: Likewise.
	* tree-vect-loop.cc: Likewise.
	* coverage.cc: Likewise.
	* hash-table.cc: Likewise.
	* ggc-page.cc: Likewise.
	* gimple-ssa-strength-reduction.cc: Likewise.
	* tree-parloops.cc: Likewise.
	* internal-fn.cc: Likewise.
	* ipa-split.cc: Likewise.
	* calls.cc: Likewise.
	* reorg.cc: Likewise.
	* sbitmap.h: Likewise.
	* omp-offload.cc: Likewise.
	* cfgrtl.cc: Likewise.
	* reginfo.cc: Likewise.
	* gengtype.h: Likewise.
	* omp-general.h: Likewise.
	* ipa-comdats.cc: Likewise.
	* gimple-range-edge.h: Likewise.
	* tree-ssa-structalias.cc: Likewise.
	* target.def: Likewise.
	* basic-block.h: Likewise.
	* graphite-isl-ast-to-gimple.cc: Likewise.
	* auto-profile.cc: Likewise.
	* optabs.cc: Likewise.
	* gengtype-lex.l: Likewise.
	* optabs.def: Likewise.
	* ira-build.cc: Likewise.
	* ira.cc: Likewise.
	* function.h: Likewise.
	* tree-ssa-propagate.cc: Likewise.
	* gcov-io.cc: Likewise.
	* builtin-types.def: Likewise.
	* ddg.cc: Likewise.
	* lra-spills.cc: Likewise.
	* cfg.cc: Likewise.
	* bitmap.cc: Likewise.
	* gimple-range-gori.h: Likewise.
	* tree-ssa-loop-im.cc: Likewise.
	* cfghooks.h: Likewise.
	* genmatch.cc: Likewise.
	* explow.cc: Likewise.
	* lto-streamer-in.cc: Likewise.
	* graphite-scop-detection.cc: Likewise.
	* ipa-prop.cc: Likewise.
	* gcc.cc: Likewise.
	* vec.h: Likewise.
	* cfgexpand.cc: Likewise.
	* config/alpha/vms.h: Likewise.
	* config/alpha/alpha.cc: Likewise.
	* config/alpha/driver-alpha.cc: Likewise.
	* config/alpha/elf.h: Likewise.
	* config/iq2000/iq2000.h: Likewise.
	* config/iq2000/iq2000.cc: Likewise.
	* config/pa/pa-64.h: Likewise.
	* config/pa/som.h: Likewise.
	* config/pa/pa.cc: Likewise.
	* config/pa/pa.h: Likewise.
	* config/pa/pa32-regs.h: Likewise.
	* config/c6x/c6x.cc: Likewise.
	* config/openbsd-stdint.h: Likewise.
	* config/elfos.h: Likewise.
	* config/lm32/lm32.cc: Likewise.
	* config/lm32/lm32.h: Likewise.
	* config/lm32/lm32-protos.h: Likewise.
	* config/darwin-c.cc: Likewise.
	* config/rx/rx.cc: Likewise.
	* config/host-darwin.h: Likewise.
	* config/netbsd.h: Likewise.
	* config/ia64/ia64.cc: Likewise.
	* config/ia64/freebsd.h: Likewise.
	* config/avr/avr-c.cc: Likewise.
	* config/avr/avr.cc: Likewise.
	* config/avr/avr-arch.h: Likewise.
	* config/avr/avr.h: Likewise.
	* config/avr/stdfix.h: Likewise.
	* config/avr/gen-avr-mmcu-specs.cc: Likewise.
	* config/avr/avr-log.cc: Likewise.
	* config/avr/elf.h: Likewise.
	* config/avr/gen-avr-mmcu-texi.cc: Likewise.
	* config/avr/avr-devices.cc: Likewise.
	* config/nvptx/nvptx.cc: Likewise.
	* config/vx-common.h: Likewise.
	* config/sol2.cc: Likewise.
	* config/rl78/rl78.cc: Likewise.
	* config/cris/cris.cc: Likewise.
	* config/arm/symbian.h: Likewise.
	* config/arm/unknown-elf.h: Likewise.
	* config/arm/linux-eabi.h: Likewise.
	* config/arm/arm.cc: Likewise.
	* config/arm/arm-mve-builtins.h: Likewise.
	* config/arm/bpabi.h: Likewise.
	* config/arm/vxworks.h: Likewise.
	* config/arm/arm.h: Likewise.
	* config/arm/aout.h: Likewise.
	* config/arm/elf.h: Likewise.
	* config/host-linux.cc: Likewise.
	* config/sh/sh_treg_combine.cc: Likewise.
	* config/sh/vxworks.h: Likewise.
	* config/sh/elf.h: Likewise.
	* config/sh/netbsd-elf.h: Likewise.
	* config/sh/sh.cc: Likewise.
	* config/sh/embed-elf.h: Likewise.
	* config/sh/sh.h: Likewise.
	* config/darwin-driver.cc: Likewise.
	* config/m32c/m32c.cc: Likewise.
	* config/frv/frv.cc: Likewise.
	* config/openbsd.h: Likewise.
	* config/aarch64/aarch64-protos.h: Likewise.
	* config/aarch64/aarch64-builtins.cc: Likewise.
	* config/aarch64/aarch64-cost-tables.h: Likewise.
	* config/aarch64/aarch64.cc: Likewise.
	* config/bfin/bfin.cc: Likewise.
	* config/bfin/bfin.h: Likewise.
	* config/bfin/bfin-protos.h: Likewise.
	* config/i386/gmm_malloc.h: Likewise.
	* config/i386/djgpp.h: Likewise.
	* config/i386/sol2.h: Likewise.
	* config/i386/stringop.def: Likewise.
	* config/i386/i386-features.cc: Likewise.
	* config/i386/openbsdelf.h: Likewise.
	* config/i386/cpuid.h: Likewise.
	* config/i386/i386.h: Likewise.
	* config/i386/smmintrin.h: Likewise.
	* config/i386/avx10_2-512convertintrin.h: Likewise.
	* config/i386/i386-options.cc: Likewise.
	* config/i386/i386-opts.h: Likewise.
	* config/i386/i386-expand.cc: Likewise.
	* config/i386/avx512dqintrin.h: Likewise.
	* config/i386/wmmintrin.h: Likewise.
	* config/i386/gnu-user.h: Likewise.
	* config/i386/host-mingw32.cc: Likewise.
	* config/i386/avx10_2bf16intrin.h: Likewise.
	* config/i386/cygwin.h: Likewise.
	* config/i386/driver-i386.cc: Likewise.
	* config/i386/biarch64.h: Likewise.
	* config/i386/host-cygwin.cc: Likewise.
	* config/i386/cygming.h: Likewise.
	* config/i386/i386-builtins.cc: Likewise.
	* config/i386/avx10_2convertintrin.h: Likewise.
	* config/i386/i386.cc: Likewise.
	* config/i386/gas.h: Likewise.
	* config/i386/freebsd.h: Likewise.
	* config/mingw/winnt-cxx.cc: Likewise.
	* config/mingw/winnt.cc: Likewise.
	* config/h8300/h8300.cc: Likewise.
	* config/host-solaris.cc: Likewise.
	* config/m32r/m32r.h: Likewise.
	* config/m32r/m32r.cc: Likewise.
	* config/darwin.h: Likewise.
	* config/sparc/linux64.h: Likewise.
	* config/sparc/sparc-protos.h: Likewise.
	* config/sparc/sysv4.h: Likewise.
	* config/sparc/sparc.h: Likewise.
	* config/sparc/linux.h: Likewise.
	* config/sparc/freebsd.h: Likewise.
	* config/sparc/sparc.cc: Likewise.
	* config/gcn/gcn-run.cc: Likewise.
	* config/gcn/gcn.cc: Likewise.
	* config/gcn/gcn-tree.cc: Likewise.
	* config/kopensolaris-gnu.h: Likewise.
	* config/nios2/nios2.h: Likewise.
	* config/nios2/elf.h: Likewise.
	* config/nios2/nios2.cc: Likewise.
	* config/host-netbsd.cc: Likewise.
	* config/rtems.h: Likewise.
	* config/pdp11/pdp11.cc: Likewise.
	* config/pdp11/pdp11.h: Likewise.
	* config/mn10300/mn10300.cc: Likewise.
	* config/mn10300/linux.h: Likewise.
	* config/moxie/moxie.h: Likewise.
	* config/moxie/moxie.cc: Likewise.
	* config/rs6000/aix71.h: Likewise.
	* config/rs6000/vec_types.h: Likewise.
	* config/rs6000/xcoff.h: Likewise.
	* config/rs6000/rs6000.cc: Likewise.
	* config/rs6000/rs6000-internal.h: Likewise.
	* config/rs6000/rs6000-p8swap.cc: Likewise.
	* config/rs6000/rs6000-c.cc: Likewise.
	* config/rs6000/aix.h: Likewise.
	* config/rs6000/rs6000-logue.cc: Likewise.
	* config/rs6000/rs6000-string.cc: Likewise.
	* config/rs6000/rs6000-call.cc: Likewise.
	* config/rs6000/ppu_intrinsics.h: Likewise.
	* config/rs6000/altivec.h: Likewise.
	* config/rs6000/darwin.h: Likewise.
	* config/rs6000/host-darwin.cc: Likewise.
	* config/rs6000/freebsd64.h: Likewise.
	* config/rs6000/spu2vmx.h: Likewise.
	* config/rs6000/linux.h: Likewise.
	* config/rs6000/si2vmx.h: Likewise.
	* config/rs6000/driver-rs6000.cc: Likewise.
	* config/rs6000/freebsd.h: Likewise.
	* config/vxworksae.h: Likewise.
	* config/mips/frame-header-opt.cc: Likewise.
	* config/mips/mips.h: Likewise.
	* config/mips/mips.cc: Likewise.
	* config/mips/sde.h: Likewise.
	* config/darwin-protos.h: Likewise.
	* config/mcore/mcore-elf.h: Likewise.
	* config/mcore/mcore.h: Likewise.
	* config/mcore/mcore.cc: Likewise.
	* config/epiphany/epiphany.cc: Likewise.
	* config/fr30/fr30.h: Likewise.
	* config/fr30/fr30.cc: Likewise.
	* config/riscv/riscv-vector-builtins-shapes.cc: Likewise.
	* config/riscv/riscv-vector-builtins-bases.cc: Likewise.
	* config/visium/visium.h: Likewise.
	* config/mmix/mmix.cc: Likewise.
	* config/v850/v850.cc: Likewise.
	* config/v850/v850-c.cc: Likewise.
	* config/v850/v850.h: Likewise.
	* config/stormy16/stormy16.cc: Likewise.
	* config/stormy16/stormy16-protos.h: Likewise.
	* config/stormy16/stormy16.h: Likewise.
	* config/arc/arc.cc: Likewise.
	* config/vxworks.cc: Likewise.
	* config/microblaze/microblaze-c.cc: Likewise.
	* config/microblaze/microblaze-protos.h: Likewise.
	* config/microblaze/microblaze.h: Likewise.
	* config/microblaze/microblaze.cc: Likewise.
	* config/freebsd-spec.h: Likewise.
	* config/m68k/m68kelf.h: Likewise.
	* config/m68k/m68k.cc: Likewise.
	* config/m68k/netbsd-elf.h: Likewise.
	* config/m68k/linux.h: Likewise.
	* config/freebsd.h: Likewise.
	* config/host-openbsd.cc: Likewise.
	* regcprop.cc: Likewise.
	* dumpfile.cc: Likewise.
	* combine.cc: Likewise.
	* tree-ssa-forwprop.cc: Likewise.
	* ipa-profile.cc: Likewise.
	* hw-doloop.cc: Likewise.
	* opts.cc: Likewise.
	* gcc-ar.cc: Likewise.
	* tree-cfg.cc: Likewise.
	* incpath.cc: Likewise.
	* tree-ssa-sccvn.cc: Likewise.
	* function.cc: Likewise.
	* genattrtab.cc: Likewise.
	* rtl.def: Likewise.
	* genchecksum.cc: Likewise.
	* profile.cc: Likewise.
	* df-core.cc: Likewise.
	* tree-pretty-print.cc: Likewise.
	* tree.h: Likewise.
	* plugin.cc: Likewise.
	* tree-ssa-loop-ch.cc: Likewise.
	* emit-rtl.cc: Likewise.
	* haifa-sched.cc: Likewise.
	* gimple-range-edge.cc: Likewise.
	* range-op.cc: Likewise.
	* tree-ssa-ccp.cc: Likewise.
	* dwarf2cfi.cc: Likewise.
	* recog.cc: Likewise.
	* vtable-verify.cc: Likewise.
	* system.h: Likewise.
	* regrename.cc: Likewise.
	* tree-ssa-dom.cc: Likewise.
	* loop-unroll.cc: Likewise.
	* lra-constraints.cc: Likewise.
	* pretty-print.cc: Likewise.
	* ifcvt.cc: Likewise.
	* ipa.cc: Likewise.
	* alloc-pool.h: Likewise.
	* collect2.cc: Likewise.
	* pointer-query.cc: Likewise.
	* cfgloop.cc: Likewise.
	* toplev.cc: Likewise.
	* sese.cc: Likewise.
	* gengtype.cc: Likewise.
	* gimplify-me.cc: Likewise.
	* double-int.cc: Likewise.
	* bb-reorder.cc: Likewise.
	* dwarf2out.cc: Likewise.
	* tree-ssa-loop-ivcanon.cc: Likewise.
	* tree-ssa-reassoc.cc: Likewise.
	* cgraph.cc: Likewise.
	* sel-sched.cc: Likewise.
	* attribs.cc: Likewise.
	* expr.cc: Likewise.
	* tree-ssa-scopedtables.h: Likewise.
	* gimple-range-cache.cc: Likewise.
	* ipa-pure-const.cc: Likewise.
	* tree-inline.cc: Likewise.
	* genhooks.cc: Likewise.
	* gimple-range-phi.h: Likewise.
	* shrink-wrap.cc: Likewise.
	* tree.cc: Likewise.
	* gimple.cc: Likewise.
	* backend.h: Likewise.
	* opts-common.cc: Likewise.
	* cfg-flags.def: Likewise.
	* gcse-common.cc: Likewise.
	* tree-ssa-scopedtables.cc: Likewise.
	* ccmp.cc: Likewise.
	* builtins.def: Likewise.
	* builtin-attrs.def: Likewise.
	* postreload.cc: Likewise.
	* sched-deps.cc: Likewise.
	* ipa-inline-transform.cc: Likewise.
	* tree-vect-generic.cc: Likewise.
	* ipa-polymorphic-call.cc: Likewise.
	* builtins.cc: Likewise.
	* sel-sched-ir.cc: Likewise.
	* trans-mem.cc: Likewise.
	* ipa-visibility.cc: Likewise.
	* cgraph.h: Likewise.
	* tree-ssa-phiopt.cc: Likewise.
	* genopinit.cc: Likewise.
	* ipa-inline.cc: Likewise.
	* omp-low.cc: Likewise.
	* ipa-utils.cc: Likewise.
	* tree-ssa-math-opts.cc: Likewise.
	* tree-ssa-ifcombine.cc: Likewise.
	* gimple-range.cc: Likewise.
	* ipa-fnsummary.cc: Likewise.
	* ira-color.cc: Likewise.
	* value-prof.cc: Likewise.
	* varasm.cc: Likewise.
	* ipa-icf.cc: Likewise.
	* ira-emit.cc: Likewise.
	* lto-streamer.h: Likewise.
	* lto-wrapper.cc: Likewise.
	* regs.h: Likewise.
	* gengtype-parse.cc: Likewise.
	* alias.cc: Likewise.
	* lto-streamer.cc: Likewise.
	* real.h: Likewise.
	* wide-int.h: Likewise.
	* targhooks.cc: Likewise.
	* gimple-ssa-warn-access.cc: Likewise.
	* real.cc: Likewise.
	* ipa-reference.cc: Likewise.
	* bitmap.h: Likewise.
	* ginclude/float.h: Likewise.
	* ginclude/stddef.h: Likewise.
	* ginclude/stdarg.h: Likewise.
	* ginclude/stdatomic.h: Likewise.
	* optabs.h: Likewise.
	* sel-sched-ir.h: Likewise.
	* convert.cc: Likewise.
	* cgraphunit.cc: Likewise.
	* lra-remat.cc: Likewise.
	* tree-if-conv.cc: Likewise.
	* gcov-dump.cc: Likewise.
	* tree-predcom.cc: Likewise.
	* dominance.cc: Likewise.
	* gimple-range-cache.h: Likewise.
	* ipa-devirt.cc: Likewise.
	* rtl.h: Likewise.
	* ubsan.cc: Likewise.
	* tree-ssa.cc: Likewise.
	* ssa.h: Likewise.
	* cse.cc: Likewise.
	* jump.cc: Likewise.
	* hwint.h: Likewise.
	* caller-save.cc: Likewise.
	* coretypes.h: Likewise.
	* ipa-fnsummary.h: Likewise.
	* tree-ssa-strlen.cc: Likewise.
	* modulo-sched.cc: Likewise.
	* cgraphclones.cc: Likewise.
	* lto-cgraph.cc: Likewise.
	* hw-doloop.h: Likewise.
	* data-streamer.h: Likewise.
	* compare-elim.cc: Likewise.
	* profile-count.h: Likewise.
	* tree-vect-loop-manip.cc: Likewise.
	* ree.cc: Likewise.
	* reload.cc: Likewise.
	* tree-ssa-loop-split.cc: Likewise.
	* tree-into-ssa.cc: Likewise.
	* gcse.cc: Likewise.
	* cfgloopmanip.cc: Likewise.
	* df.h: Likewise.
	* fold-const.cc: Likewise.
	* wide-int.cc: Likewise.
	* gengtype-state.cc: Likewise.
	* sanitizer.def: Likewise.
	* tree-ssa-sink.cc: Likewise.
	* target-hooks-macros.h: Likewise.
	* tree-ssa-pre.cc: Likewise.
	* gimple-pretty-print.cc: Likewise.
	* ipa-utils.h: Likewise.
	* tree-outof-ssa.cc: Likewise.
	* tree-ssa-coalesce.cc: Likewise.
	* gimple-match.h: Likewise.
	* tree-ssa-loop-niter.cc: Likewise.
	* tree-loop-distribution.cc: Likewise.
	* tree-emutls.cc: Likewise.
	* tree-eh.cc: Likewise.
	* varpool.cc: Likewise.
	* ssa-iterators.h: Likewise.
	* asan.cc: Likewise.
	* reload1.cc: Likewise.
	* cfgloopanal.cc: Likewise.
	* tree-vectorizer.cc: Likewise.
	* simplify-rtx.cc: Likewise.
	* opts-global.cc: Likewise.
	* gimple-ssa-store-merging.cc: Likewise.
	* expmed.cc: Likewise.
	* tree-ssa-loop-prefetch.cc: Likewise.
	* tree-ssa-dse.h: Likewise.
	* tree-vect-stmts.cc: Likewise.
	* gimple-fold.cc: Likewise.
	* lra-coalesce.cc: Likewise.
	* data-streamer-out.cc: Likewise.
	* diagnostic.cc: Likewise.
	* tree-ssa-alias.cc: Likewise.
	* tree-vect-patterns.cc: Likewise.
	* common/common-target.def: Likewise.
	* common/config/rx/rx-common.cc: Likewise.
	* common/config/msp430/msp430-common.cc: Likewise.
	* common/config/avr/avr-common.cc: Likewise.
	* common/config/i386/i386-common.cc: Likewise.
	* common/config/pdp11/pdp11-common.cc: Likewise.
	* common/config/rs6000/rs6000-common.cc: Likewise.
	* common/config/mcore/mcore-common.cc: Likewise.
	* graphite.cc: Likewise.
	* gimple-low.cc: Likewise.
	* genmodes.cc: Likewise.
	* gimple-loop-jam.cc: Likewise.
	* lto-streamer-out.cc: Likewise.
	* predict.cc: Likewise.
	* omp-expand.cc: Likewise.
	* gimple-array-bounds.cc: Likewise.
	* predict.def: Likewise.
	* opts.h: Likewise.
	* tree-stdarg.cc: Likewise.
	* gimplify.cc: Likewise.
	* ira-lives.cc: Likewise.
	* loop-doloop.cc: Likewise.
	* lra.cc: Likewise.
	* gimple-iterator.h: Likewise.
	* tree-sra.cc: Likewise.
gcc/fortran/
	* trans-openmp.cc: Remove trailing whitespace.
	* trans-common.cc: Likewise.
	* match.h: Likewise.
	* scanner.cc: Likewise.
	* gfortranspec.cc: Likewise.
	* io.cc: Likewise.
	* iso-c-binding.def: Likewise.
	* iso-fortran-env.def: Likewise.
	* types.def: Likewise.
	* openmp.cc: Likewise.
	* f95-lang.cc: Likewise.
gcc/analyzer/
	* state-purge.cc: Remove trailing whitespace.
	* region-model.h: Likewise.
	* region-model.cc: Likewise.
	* program-point.cc: Likewise.
	* exploded-graph.h: Likewise.
	* program-state.cc: Likewise.
	* supergraph.cc: Likewise.
gcc/c-family/
	* c-ubsan.cc: Remove trailing whitespace.
	* stub-objc.cc: Likewise.
	* c-pragma.cc: Likewise.
	* c-ppoutput.cc: Likewise.
	* c-indentation.cc: Likewise.
	* c-ada-spec.cc: Likewise.
	* c-opts.cc: Likewise.
	* c-common.cc: Likewise.
	* c-format.cc: Likewise.
	* c-omp.cc: Likewise.
	* c-objc.h: Likewise.
	* c-cppbuiltin.cc: Likewise.
	* c-attribs.cc: Likewise.
	* c-target.def: Likewise.
	* c-common.h: Likewise.
gcc/c/
	* c-typeck.cc: Remove trailing whitespace.
	* gimple-parser.cc: Likewise.
	* c-parser.cc: Likewise.
	* c-decl.cc: Likewise.
gcc/cp/
	* vtable-class-hierarchy.cc: Remove trailing whitespace.
	* typeck2.cc: Likewise.
	* decl.cc: Likewise.
	* init.cc: Likewise.
	* semantics.cc: Likewise.
	* module.cc: Likewise.
	* rtti.cc: Likewise.
	* cxx-pretty-print.cc: Likewise.
	* cvt.cc: Likewise.
	* mangle.cc: Likewise.
	* name-lookup.h: Likewise.
	* coroutines.cc: Likewise.
	* error.cc: Likewise.
	* lambda.cc: Likewise.
	* tree.cc: Likewise.
	* g++spec.cc: Likewise.
	* decl2.cc: Likewise.
	* cp-tree.h: Likewise.
	* parser.cc: Likewise.
	* pt.cc: Likewise.
	* call.cc: Likewise.
	* lex.cc: Likewise.
	* cp-lang.cc: Likewise.
	* cp-tree.def: Likewise.
	* constexpr.cc: Likewise.
	* typeck.cc: Likewise.
	* name-lookup.cc: Likewise.
	* optimize.cc: Likewise.
	* search.cc: Likewise.
	* mapper-client.cc: Likewise.
	* ptree.cc: Likewise.
	* class.cc: Likewise.
gcc/jit/
	* docs/examples/tut04-toyvm/toyvm.cc: Remove trailing whitespace.
gcc/lto/
	* lto-object.cc: Remove trailing whitespace.
	* lto-symtab.cc: Likewise.
	* lto-partition.cc: Likewise.
	* lang-specs.h: Likewise.
	* lto-lang.cc: Likewise.
gcc/objc/
	* objc-encoding.cc: Remove trailing whitespace.
	* objc-map.h: Likewise.
	* objc-next-runtime-abi-01.cc: Likewise.
	* objc-act.cc: Likewise.
	* objc-map.cc: Likewise.
gcc/objcp/
	* objcp-decl.cc: Remove trailing whitespace.
	* objcp-lang.cc: Likewise.
	* objcp-decl.h: Likewise.
gcc/rust/
	* util/optional.h: Remove trailing whitespace.
	* util/expected.h: Likewise.
	* util/rust-unicode-data.h: Likewise.
gcc/m2/
	* mc-boot/GFpuIO.cc: Remove trailing whitespace.
	* mc-boot/GFIO.cc: Likewise.
	* mc-boot/GFormatStrings.cc: Likewise.
	* mc-boot/GCmdArgs.cc: Likewise.
	* mc-boot/GDebug.h: Likewise.
	* mc-boot/GM2Dependent.cc: Likewise.
	* mc-boot/GRTint.cc: Likewise.
	* mc-boot/GDebug.cc: Likewise.
	* mc-boot/GmcError.cc: Likewise.
	* mc-boot/Gmcp4.cc: Likewise.
	* mc-boot/GM2RTS.cc: Likewise.
	* mc-boot/GIO.cc: Likewise.
	* mc-boot/Gmcp5.cc: Likewise.
	* mc-boot/GDynamicStrings.cc: Likewise.
	* mc-boot/Gmcp1.cc: Likewise.
	* mc-boot/GFormatStrings.h: Likewise.
	* mc-boot/Gmcp2.cc: Likewise.
	* mc-boot/Gmcp3.cc: Likewise.
	* pge-boot/GFIO.cc: Likewise.
	* pge-boot/GDebug.h: Likewise.
	* pge-boot/GM2Dependent.cc: Likewise.
	* pge-boot/GDebug.cc: Likewise.
	* pge-boot/GM2RTS.cc: Likewise.
	* pge-boot/GSymbolKey.cc: Likewise.
	* pge-boot/GIO.cc: Likewise.
	* pge-boot/GIndexing.cc: Likewise.
	* pge-boot/GDynamicStrings.cc: Likewise.
	* pge-boot/GFormatStrings.h: Likewise.
gcc/go/
	* go-gcc.cc: Remove trailing whitespace.
	* gospec.cc: Likewise.
2024-10-25 10:00:29 +02:00
Andrew MacLeod
5612541834 ssa_lazy_cache takes an optional bitmap_obstack pointer.
Allow ssa_lazy cache to allocate bitmaps from a client provided obstack
if so desired.

	* gimple-range-cache.cc (ssa_lazy_cache::ssa_lazy_cache): Relocate here.
	Check for provided obstack.
	(ssa_lazy_cache::~ssa_lazy_cache): Relocate here.  Free bitmap or obstack.
	* gimple-range-cache.h (ssa_lazy_cache::ssa_lazy_cache): Move.
	(ssa_lazy_cache::~ssa_lazy_cache): Move.
	(ssa_lazy_cache::m_ob): New.
	* gimple-range.cc (dom_ranger::dom_ranger): Iniitialize obstack.
	(dom_ranger::~dom_ranger): Release obstack.
	(dom_ranger::pre_bb): Create ssa_lazy_cache using obstack.
	* gimple-range.h (m_bitmaps): New.
2024-06-28 13:49:25 -04:00
Aldy Hernandez
bcdbb85f26 Avoid global bitmap space in ranger.
gcc/ChangeLog:

	* gimple-range-cache.cc (update_list::update_list): Add m_bitmaps.
	(update_list::~update_list): Initialize m_bitmaps.
	* gimple-range-cache.h (ssa_lazy_cache): Add m_bitmaps.
	* gimple-range.cc (enable_ranger): Remove global bitmap
	initialization.
	(disable_ranger): Remove global bitmap release.
2024-06-27 11:09:20 +02:00
Andrew MacLeod
d40034c489 Add merge facility to ssa_lazy_cache.
The ssa_lazy_cache has a routine to merge a range for an ssa-name with
an existing range in the cache.  This adds a method which will merge all
elements of another ssa_lazy_cache.

	* gimple-range-cache.cc (ssa_lazy_cache::merge): New.
	* gimple-range-cache.h (ssa_lazy_cache::merge): New prototype.
2024-06-14 15:16:38 -04:00
Andrew MacLeod
ac0bc89aea Make GORI a range_query component.
This patch moves the GORI component into the range_query object, and
makes it generally available.  This makes it much easier to share
between ranger and the passes.

	* gimple-range-cache.cc (ranger_cache::ranger_cache): Create
	GORi via the range_query instead of a local member.
	(ranger_cache::dump_bb): Use gori via from the range_query parent.
	(ranger_cache::get_global_range): Likewise.
	(ranger_cache::set_global_range): Likewise.
	(ranger_cache::edge_range): Likewise.
	(anger_cache::block_range): Likewise.
	(ranger_cache::fill_block_cache): Likewise.
	(ranger_cache::range_from_dom): Likewise.
	(ranger_cache::register_inferred_value): Likewise.
	* gimple-range-cache.h (ranger_cache::m_gori): Delete.
	* gimple-range-fold.cc (fur_source::fur_source): Set m_depend_p.
	(fur_depend::fur_depend): Remove gori parameter.
	* gimple-range-fold.h (fur_source::gori): Adjust.
	(fur_source::m_gori): Delete.
	(fur_source::m_depend): New.
	(fur_depend::fur_depend): Adjust prototype.
	* gimple-range-path.cc (path_range_query::path_range_query): Share
	ranger oracles.
	(path_range_query::range_defined_in_block): Use oracle directly.
	(path_range_query::compute_ranges_in_block): Use new gori() method.
	(path_range_query::adjust_for_non_null_uses): Use oracle directly.
	(path_range_query::compute_exit_dependencies): Likewise.
	(jt_fur_source::jt_fur_source): No gori in the parameters.
	(path_range_query::range_of_stmt): Likewise.
	(path_range_query::compute_outgoing_relations): Likewise.
	* gimple-range.cc (gimple_ranger::fold_range_internal): Likewise.
	(gimple_ranger::range_of_stmt): Access gori via gori () method.
	(assume_query::range_of_expr): Create a gori object.
	(assume_query::~assume_query): Destroy a gori object.
	(assume_query::calculate_op): Remove old gori() accessor.
	* gimple-range.h (gimple_ranger::gori): Delete.
	(assume_query::~assume_query): New.
	(assume_query::m_gori): Delete.
	* tree-ssa-dom.cc (set_global_ranges_from_unreachable_edges): use
	gori () method.
	* tree-ssa-threadedge.cc (compute_exit_dependencies): Likewise.
	* value-query.cc (default_gori): New.
	(range_query::create_gori): New.
	(range_query::destroy_gori): New.
	(range_query::share_oracles): Set m_gori.
	(range_query::range_query): Set m_gori to default.
	(range_query::~range_query): call destroy gori.
	* value-query.h (range_query): Adjust prototypes
	(range_query::m_gori): New.
2024-05-23 16:50:00 -04:00
Andrew MacLeod
07441e41f5 Move infer_manager to a range_query oracle.
Turn the infer_manager class into an always available oracle accessible via a
range_query object.  Also assocaite each inferrred range with it's
originating stmt.

	* gimple-range-cache.cc (ranger_cache::ranger_cache): Create an infer
	oracle instead of a local member.
	(ranger_cache::~ranger_cache): Destroy the oracle.
	(ranger_cache::edge_range): Use oracle.
	(ranger_cache::fill_block_cache): Likewise.
	(ranger_cache::range_from_dom): Likewise.
	(ranger_cache::apply_inferred_ranges): Likewise.
	* gimple-range-cache.h (ranger_cache::m_exit): Delete.
	* gimple-range-infer.cc (infer_oracle): New static object;
	(class infer_oracle): New.
	(non_null_wrapper::non_null_wrapper): New.
	(non_null_wrapper::add_nonzero): New.
	(non_null_wrapper::add_range): New.
	(non_null_loadstore): Use nonnull_wrapper.
	(gimple_infer_range::gimple_infer_range): New alternate constructor.
	(exit_range::stmt): New.
	(infer_range_manager::has_range_p): Combine seperate methods.
	(infer_range_manager::maybe_adjust_range): Adjust has_range_p call.
	(infer_range_manager::add_ranges): New.
	(infer_range_manager::add_range): Take stmt rather than BB.
	(infer_range_manager::add_nonzero): Adjust from BB to stmt.
	* gimple-range-infer.h (class gimple_infer_range): Adjust methods.
	(infer_range_oracle): New.
	(class infer_range_manager): Inherit from infer_range_oracle.
	Adjust methods.
	* gimple-range-path.cc (path_range_query::range_defined_in_block): Use
	oracle.
	(path_range_query::adjust_for_non_null_uses): Likewise.
	* gimple-range.cc (gimple_ranger::range_on_edge): Likewise
	(gimple_ranger::register_transitive_inferred_ranges): Likewise.
	* value-query.cc (default_infer_oracle): New.
	(range_query::create_infer_oracle): New.
	(range_query::destroy_infer_oracle): New.
	(range_query::share_query): Copy infer pointer.
	(range_query::range_query): Initialize infer pointer.
	(range_query::~range_query): destroy infer object.
	* value-query.h (range_query::infer_oracle): New.
	(range_query::create_infer_oracle): New prototype.
	(range_query::destroy_infer_oracle): New prototype.
	(range_query::m_infer): New.
2024-05-23 16:48:44 -04:00
Jakub Jelinek
a945c346f5 Update copyright years. 2024-01-03 12:19:35 +01:00
Andrew MacLeod
72fb44ca53 Add a merge_range to ssa_cache and use it. add empty_p and param tweaks.
* gimple-range-cache.cc (ssa_cache::merge_range): New.
	(ssa_lazy_cache::merge_range): New.
	* gimple-range-cache.h (class ssa_cache): Adjust protoypes.
	(class ssa_lazy_cache): Ditto.
	* gimple-range.cc (assume_query::calculate_op): Use merge_range.
2023-07-28 16:32:12 -04:00
Andrew MacLeod
7905c071c3 Fix some warnings
PR tree-optimization/110205
	* gimple-range-cache.h (ranger_cache::m_estimate): Delete.
	* range-op-mixed.h (operator_bitwise_xor::op1_op2_relation_effect):
	Add final override.
	* range-op.cc (operator_lshift): Add missing final overrides.
	(operator_rshift): Ditto.
2023-07-28 16:23:07 -04:00
Andrew MacLeod
1cd5bc387c Gimple range PHI analyzer and testcases
Provide a PHI analyzer framework to provive better initial values for
PHI nodes which formk groups with initial values and single statements
which modify the PHI values in some predicatable way.

	PR tree-optimization/107822
	PR tree-optimization/107986
	gcc/
	* Makefile.in (OBJS): Add gimple-range-phi.o.
	* gimple-range-cache.h (ranger_cache::m_estimate): New
	phi_analyzer pointer member.
	* gimple-range-fold.cc (fold_using_range::range_of_phi): Use
	phi_analyzer if no loop info is available.
	* gimple-range-phi.cc: New file.
	* gimple-range-phi.h: New file.
	* tree-vrp.cc (execute_ranger_vrp): Utililze a phi_analyzer.

	gcc/testsuite/
	* gcc.dg/pr107822.c: New.
	* gcc.dg/pr107986-1.c: New.
2023-05-24 16:40:11 -04:00
Andrew MacLeod
71baa00949 Make ssa_cache a range_query.
By providing range_of_expr as a range_query, we can fold and do other
interesting things using values from the global table.  Make ranger's
knonw globals available via const_query.

	* gimple-range-cache.cc (ssa_cache::range_of_expr): New.
	* gimple-range-cache.h (class ssa_cache): Inherit from range_query.
	(ranger_cache::const_query): New.
	* gimple-range.cc (gimple_ranger::const_query): New.
	* gimple-range.h (gimple_ranger::const_query): New prototype.
2023-05-24 16:40:11 -04:00
Andrew MacLeod
46a594b949 Make ssa_cache and ssa_lazy_cache virtual.
Making them virtual allows us to interchangebly use the caches.

	* gimple-range-cache.cc (ssa_cache::dump): Use get_range.
	(ssa_cache::dump_range_query): Delete.
	(ssa_lazy_cache::dump_range_query): Delete.
	(ssa_lazy_cache::get_range): Move from header file.
	(ssa_lazy_cache::clear_range): ditto.
	(ssa_lazy_cache::clear): Ditto.
	* gimple-range-cache.h (class ssa_cache): Virtualize.
	(class ssa_lazy_cache): Inherit and virtualize.
2023-05-24 16:40:11 -04:00
Andrew MacLeod
257c2be7ff Only update global value if it changes.
Do not update and propagate a global value if it hasn't changed.

	PR tree-optimization/109695
	* gimple-range-cache.cc (ranger_cache::get_global_range): Add
	changed param.
	* gimple-range-cache.h (ranger_cache::get_global_range): Ditto.
	* gimple-range.cc (gimple_ranger::range_of_stmt): Pass changed
	flag to set_global_range.
	(gimple_ranger::prefill_stmt_dependencies): Ditto.
2023-05-24 08:39:58 -04:00
Aldy Hernandez
e1366a7e4c vrange_storage overhaul
[tl;dr: This is a rewrite of value-range-storage.* such that global
ranges and the internal ranger cache can use the same efficient
storage mechanism.  It is optimized such that when wide_ints are
dropped into irange, the copying back and forth from storage will be
very fast, while being able to hold any number of sub-ranges
dynamically allocated at run-time.  This replaces the global storage
mechanism which was limited to 6-subranges.]

Previously we had a vrange allocator for use in the ranger cache.  It
worked with trees and could be used in place (fast), but it was not
memory efficient.  With the upcoming switch to wide_ints for irange,
we can't afford to allocate ranges that can be used in place, because
an irange will be significantly larger, as it will hold full
wide_ints.  We need a trailing_wide_int mechanism similar to what we
use for global ranges, but fast enough to use in the ranger's cache.

The global ranges had another allocation mechanism that was
trailing_wide_int based.  It was memory efficient but slow given the
constant conversions from trees to wide_ints.

This patch gets us the best of both worlds by providing a storage
mechanism with a custom trailing wide int interface, while at the same
time being fast enough to use in the ranger cache.

We use a custom trailing wide_int mechanism but more flexible than
trailing_wide_int, since the latter has compile-time fixed-sized
wide_ints.  The original TWI structure has the current length of each
wide_int in a static portion preceeding the variable length:

template <int N>
struct GTY((user)) trailing_wide_ints
{
...
...
  /* The current length of each number.
     that will, in turn, turn off TBAA on gimple, trees and RTL.  */
  struct {unsigned char len;} m_len[N];

  /* The variable-length part of the structure, which always contains
     at least one HWI.  Element I starts at index I * M_MAX_LEN.  */
  HOST_WIDE_INT m_val[1];
};

We need both m_len[] and m_val[] to be variable-length at run-time.
In the previous incarnation of the storage mechanism the limitation of
m_len[] being static meant that we were limited to whatever [N] could
use up the unused bits in the TWI control world.  In practice this
meant we were limited to 6 sub-ranges.  This worked fine for global
ranges, but is a no go for our internal cache, where we must represent
things exactly (ranges for switches, etc).

The new implementation removes this restriction by making both m_len[]
and m_val[] variable length.  Also, rolling our own allows future
optimization be using some of the leftover bits in the control world.

Also, in preparation for the wide_int conversion, vrange_storage is
now optimized to blast the bits directly into the ultimate irange
instead of going through the irange API.  So ultimately copying back
and forth between the ranger cache and the storage mechanism is just a
matter of copying a few bits for the control word, and copying an
array of HOST_WIDE_INTs.  These changes were heavily profiled, and
yielded a good chunk of the overall speedup for the wide_int
conversion.

Finally, vrange_storage is now a first class structure with GTY
markers and all, thus alleviating the void * hack in struct
tree_ssa_name and friends.  This removes a few warts in the API and
looks cleaner overall.

gcc/ChangeLog:

	* gimple-fold.cc (maybe_fold_comparisons_from_match_pd): Adjust
	for vrange_storage.
	* gimple-range-cache.cc (sbr_vector::sbr_vector): Same.
	(sbr_vector::grow): Same.
	(sbr_vector::set_bb_range): Same.
	(sbr_vector::get_bb_range): Same.
	(sbr_sparse_bitmap::sbr_sparse_bitmap): Same.
	(sbr_sparse_bitmap::set_bb_range): Same.
	(sbr_sparse_bitmap::get_bb_range): Same.
	(block_range_cache::block_range_cache): Same.
	(ssa_global_cache::ssa_global_cache): Same.
	(ssa_global_cache::get_global_range): Same.
	(ssa_global_cache::set_global_range): Same.
	* gimple-range-cache.h: Same.
	* gimple-range-edge.cc
	(gimple_outgoing_range::gimple_outgoing_range): Same.
	(gimple_outgoing_range::switch_edge_range): Same.
	(gimple_outgoing_range::calc_switch_ranges): Same.
	* gimple-range-edge.h: Same.
	* gimple-range-infer.cc
	(infer_range_manager::infer_range_manager): Same.
	(infer_range_manager::get_nonzero): Same.
	(infer_range_manager::maybe_adjust_range): Same.
	(infer_range_manager::add_range): Same.
	* gimple-range-infer.h: Rename obstack_vrange_allocator to
	vrange_allocator.
	* tree-core.h (struct irange_storage_slot): Remove.
	(struct tree_ssa_name): Remove irange_info and frange_info.  Make
	range_info a pointer to vrange_storage.
	* tree-ssanames.cc (range_info_fits_p): Adjust for vrange_storage.
	(range_info_alloc): Same.
	(range_info_free): Same.
	(range_info_get_range): Same.
	(range_info_set_range): Same.
	(get_nonzero_bits): Same.
	* value-query.cc (get_ssa_name_range_info): Same.
	* value-range-storage.cc (class vrange_internal_alloc): New.
	(class vrange_obstack_alloc): New.
	(class vrange_ggc_alloc): New.
	(vrange_allocator::vrange_allocator): New.
	(vrange_allocator::~vrange_allocator): New.
	(vrange_storage::alloc_slot): New.
	(vrange_allocator::alloc): New.
	(vrange_allocator::free): New.
	(vrange_allocator::clone): New.
	(vrange_allocator::clone_varying): New.
	(vrange_allocator::clone_undefined): New.
	(vrange_storage::alloc): New.
	(vrange_storage::set_vrange): Remove slot argument.
	(vrange_storage::get_vrange): Same.
	(vrange_storage::fits_p): Same.
	(vrange_storage::equal_p): New.
	(irange_storage::write_lengths_address): New.
	(irange_storage::lengths_address): New.
	(irange_storage_slot::alloc_slot): Remove.
	(irange_storage::alloc): New.
	(irange_storage_slot::irange_storage_slot): Remove.
	(irange_storage::irange_storage): New.
	(write_wide_int): New.
	(irange_storage_slot::set_irange): Remove.
	(irange_storage::set_irange): New.
	(read_wide_int): New.
	(irange_storage_slot::get_irange): Remove.
	(irange_storage::get_irange): New.
	(irange_storage_slot::size): Remove.
	(irange_storage::equal_p): New.
	(irange_storage_slot::num_wide_ints_needed): Remove.
	(irange_storage::size): New.
	(irange_storage_slot::fits_p): Remove.
	(irange_storage::fits_p): New.
	(irange_storage_slot::dump): Remove.
	(irange_storage::dump): New.
	(frange_storage_slot::alloc_slot): Remove.
	(frange_storage::alloc): New.
	(frange_storage_slot::set_frange): Remove.
	(frange_storage::set_frange): New.
	(frange_storage_slot::get_frange): Remove.
	(frange_storage::get_frange): New.
	(frange_storage_slot::fits_p): Remove.
	(frange_storage::equal_p): New.
	(frange_storage::fits_p): New.
	(ggc_vrange_allocator): New.
	(ggc_alloc_vrange_storage): New.
	* value-range-storage.h (class vrange_storage): Rewrite.
	(class irange_storage): Rewrite.
	(class frange_storage): Rewrite.
	(class obstack_vrange_allocator): Remove.
	(class ggc_vrange_allocator): Remove.
	(vrange_allocator::alloc_vrange): Remove.
	(vrange_allocator::alloc_irange): Remove.
	(vrange_allocator::alloc_frange): Remove.
	(ggc_alloc_vrange_storage): New.
	* value-range.h (class irange): Rename vrange_allocator to
	irange_storage.
	(class frange): Same.
2023-05-01 08:29:24 +02:00
Andrew MacLeod
0a38f67746 Create a lazy ssa_cache.
Sparsely used ssa caches can benefit from using a bitmap to
determine if a name already has an entry.  Utilize it in the path query
and remove its private bitmap for tracking the same info.
Also use it in the "assume" query class.

	PR tree-optimization/108697
	* gimple-range-cache.cc (ssa_global_cache::clear_range): Do
	not clear the vector on an out of range query.
	(ssa_cache::dump): Use dump_range_query instead of get_range.
	(ssa_cache::dump_range_query): New.
	(ssa_lazy_cache::dump_range_query): New.
	(ssa_lazy_cache::set_range): New.
	* gimple-range-cache.h (ssa_cache::dump_range_query): New.
	(class ssa_lazy_cache): New.
	(ssa_lazy_cache::ssa_lazy_cache): New.
	(ssa_lazy_cache::~ssa_lazy_cache): New.
	(ssa_lazy_cache::get_range): New.
	(ssa_lazy_cache::clear_range): New.
	(ssa_lazy_cache::clear): New.
	(ssa_lazy_cache::dump): New.
	* gimple-range-path.cc (path_range_query::path_range_query): Do
	not allocate a ssa_cache object nor has_cache bitmap.
	(path_range_query::~path_range_query): Do not free objects.
	(path_range_query::clear_cache): Remove.
	(path_range_query::get_cache): Adjust.
	(path_range_query::set_cache): Remove.
	(path_range_query::dump): Don't call through a pointer.
	(path_range_query::internal_range_of_expr): Set cache directly.
	(path_range_query::reset_path): Clear cache directly.
	(path_range_query::ssa_range_in_phi): Fold with globals only.
	(path_range_query::compute_ranges_in_phis): Simply set range.
	(path_range_query::compute_ranges_in_block): Call cache directly.
	* gimple-range-path.h (class path_range_query): Replace bitmap
	and cache pointer with lazy cache object.
	* gimple-range.h (class assume_query): Use ssa_lazy_cache.
2023-04-26 15:17:08 -04:00
Andrew MacLeod
8a3590e5ce Rename ssa_global_cache to ssa_cache and add has_range
This renames the ssa_global_cache to be ssa_cache.  The original use was
to function as a global cache, but its uses have expanded.  Remove all mention
of "global" from the class and methods.  Also add a has_range method.

	* gimple-range-cache.cc (ssa_cache::ssa_cache): Rename.
	(ssa_cache::~ssa_cache): Rename.
	(ssa_cache::has_range): New.
	(ssa_cache::get_range): Rename.
	(ssa_cache::set_range): Rename.
	(ssa_cache::clear_range): Rename.
	(ssa_cache::clear): Rename.
	(ssa_cache::dump): Rename and use get_range.
	(ranger_cache::get_global_range): Use get_range and set_range.
	(ranger_cache::range_of_def): Use get_range.
	* gimple-range-cache.h (class ssa_cache): Rename class and methods.
	(class ranger_cache): Use ssa_cache.
	* gimple-range-path.cc (path_range_query::path_range_query): Use
	ssa_cache.
	(path_range_query::get_cache): Use get_range.
	(path_range_query::set_cache): Use set_range.
	* gimple-range-path.h (class path_range_query): Use ssa_cache.
	* gimple-range.cc (assume_query::assume_range_p): Use get_range.
	(assume_query::range_of_expr): Use get_range.
	(assume_query::assume_query): Use set_range.
	(assume_query::calculate_op): Use get_range and set_range.
	* gimple-range.h (class assume_query): Use ssa_cache.
2023-04-26 15:17:08 -04:00
Jakub Jelinek
aeee481244 Update copyright years. 2023-01-02 09:40:19 +01:00
Andrew MacLeod
c838119946 Add transitive inferred range processing.
Rewalk statements at the end of a block to see if any inferred ranges
affect earlier calculations and register those as inferred ranges.

	gcc/
	PR tree-optimization/104530
	* gimple-range-cache.cc (ranger_cache::register_inferred_value):
	New.  Split from:
	(ranger_cache::apply_inferred_ranges): Move setting cache to
	separate function.
	* gimple-range-cache.h (register_inferred_value): New prototype.
	* gimple-range-infer.cc (infer_range_manager::has_range_p): New.
	* gimple-range-infer.h (has_range_p): New prototype.
	* gimple-range.cc (register_transitive_inferred_ranges): New.
	* gimple-range.h (register_transitive_inferred_ranges): New proto.
	* tree-vrp.cc (rvrp_folder::fold_stmt): Check for transitive inferred
	ranges at the end of the block before folding final stmt.

	gcc/testsuite/
	* gcc.dg/pr104530.c: New.
2022-11-07 19:22:19 -05:00
Andrew MacLeod
b0cc57cd76 Remove recursion from range_from_dom.
Avoid calling range_of_dom recursively by putting all nodes to be
calculated on the worklist, and figure out which kind they are
when removed from the list.

	* gimple-range-cache.cc (ranger_cache::resolve_dom): New.
	(ranger_cache::range_from_dom): Put all nodes to be calculated
	in the worklist and resolve after the dom walk.
	* gimple-range-cache.h (resolve_dom): New prototype.
2022-07-19 18:05:49 -04:00
Aldy Hernandez
3ae9def085 Move range allocator code to value-range-storage.*
Now that vrange_storage is in its own file, I think it's prudent to
move all the vrange allocator code there since it's all related.
The users of value-range.h do not need to know the implementation
details of the storage facilities.

Tested and benchmarked on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-cache.cc: Include value-range-storage.h.
	* gimple-range-cache.h (class block_range_cache): Add "class" to
	m_range_allocator.
	* gimple-range-edge.cc
	(gimple_outgoing_range::gimple_outgoing_range): Allocate allocator.
	(gimple_outgoing_range::~gimple_outgoing_range): Free allocator.
	(gimple_outgoing_range::calc_switch_ranges): Dereference allocator.
	* gimple-range-edge.h: Add "class" to m_range_allocator.
	* gimple-range-infer.cc
	(infer_range_manager::infer_range_manager): Allocate allocator.
	(infer_range_manager::~infer_range_manager): Free allocator.
	(infer_range_manager::get_nonzero): Dereference allocator.
	(infer_range_manager::add_range): Same.
	* gimple-range-infer.h (class vrange_allocator): Add "class" to
	m_range_allocator.
	* value-range-storage.h (class vrange_allocator): Move from
	value-range.h.
	(class obstack_vrange_allocator): Same.
	(class ggc_vrange_allocator): Same.
	(vrange_allocator::alloc_vrange): Same.
	(vrange_allocator::alloc_irange): Same.
	* value-range.h (class vrange_allocator): Move to value-range-storage.h.
	(class obstack_vrange_allocator): Same.
	(class ggc_vrange_allocator): Same.
2022-07-03 17:33:23 +02:00
David Malcolm
26f77c4d19 Add 'final' and 'override' in various places
gcc/cp/ChangeLog:
	* cxx-pretty-print.h: Add "final" and "override" to various vfunc
	implementations, removing redundant "virtual" as appropriate.
	* module.cc: Likewise.

gcc/ChangeLog:
	* genmatch.cc: Add "final" and "override" to various vfunc
	implementations, removing redundant "virtual" as appropriate.
	* gensupport.cc: Likewise.
	* gimple-range-cache.h: Likewise.
	* ipa-icf-gimple.h: Likewise.
	* ipa-icf.h: Likewise.
	* read-md.h: Likewise.
	* read-rtl-function.cc: Likewise.
	* tree-ssa-loop-ch.cc: Likewise.
	* tree-ssa-sccvn.cc: Likewise.

gcc/lto/ChangeLog:
	* lto-dump.cc: Add "final" and "override" to various vfunc
	implementations, removing redundant "virtual" as appropriate.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-06-27 17:00:34 -04:00
Aldy Hernandez
45c8523dd3 Convert ranger and clients to vrange.
Finally, the meat of the work.  Convert ranger and associated clients
to vrange.

Everything's relatively mechanical given the previous patches.  I did
include a minor cleanup in the edge code.  There's no need to check
that the type of the switch is an integer as non-integer switches are
invalid.  I verified this with an appropriately coded assert.

Tested on x86-64 & ppc64le Linux.

gcc/ChangeLog:

	* gimple-range-cache.cc (ssa_block_ranges::dump): Convert to vrange.
	(sbr_vector::sbr_vector): Same.
	(sbr_vector::grow): Same.
	(sbr_vector::set_bb_range): Same.
	(sbr_vector::get_bb_range): Same.
	(sbr_sparse_bitmap::sbr_sparse_bitmap): Same.
	(sbr_sparse_bitmap::set_bb_range): Same.
	(sbr_sparse_bitmap::get_bb_range): Same.
	(block_range_cache::set_bb_range): Same.
	(block_range_cache::get_bb_range): Same.
	(block_range_cache::dump): Same.
	(ssa_global_cache::get_global_range): Same.
	(ssa_global_cache::set_global_range): Same.
	(ssa_global_cache::clear): Same.
	(ssa_global_cache::dump): Same.
	(ranger_cache::get_global_range): Same.
	(ranger_cache::set_global_range): Same.
	(ranger_cache::range_of_def): Same.
	(ranger_cache::entry_range): Same.
	(ranger_cache::exit_range): Same.
	(ranger_cache::edge_range): Same.
	(ranger_cache::range_of_expr): Same.
	(ranger_cache::range_on_edge): Same.
	(ranger_cache::block_range): Same.
	(ranger_cache::propagate_cache): Same.
	(ranger_cache::fill_block_cache): Same.
	(ranger_cache::range_from_dom): Same.
	* gimple-range-cache.h: Same.
	* gimple-range-edge.cc (gimple_outgoing_range::get_edge_range):
	Same.
	(gimple_outgoing_range::switch_edge_range): Same.
	(gimple_outgoing_range::edge_range_p): Same.
	* gimple-range-edge.h: Same.
	* gimple-range-fold.cc (fur_source::get_operand): Same.
	(fur_source::get_phi_operand): Same.
	(fur_edge::get_operand): Same.
	(fur_edge::get_phi_operand): Same.
	(fur_stmt::get_operand): Same.
	(fur_stmt::get_phi_operand): Same.
	(fur_list::fur_list): Same.
	(fur_list::get_operand): Same.
	(fur_list::get_phi_operand): Same.
	(fold_range): Same.
	(adjust_imagpart_expr): Same.
	(adjust_realpart_expr): Same.
	(gimple_range_adjustment): Same.
	(fold_using_range::fold_stmt): Same.
	(fold_using_range::range_of_range_op): Same.
	(fold_using_range::range_of_address): Same.
	(fold_using_range::range_of_phi): Same.
	(fold_using_range::range_of_call): Same.
	(fold_using_range::range_of_builtin_call): Same.
	(fold_using_range::range_of_builtin_int_call): Same.
	(fold_using_range::range_of_cond_expr): Same.
	(fur_source::register_outgoing_edges): Same.
	* gimple-range-fold.h (fold_range): Same.
	(gimple_range_type): Same.
	(gimple_range_ssa_p): Same.
	* gimple-range-gori.cc (gimple_range_calc_op1): Same.
	(gimple_range_calc_op2): Same.
	(gori_compute::compute_operand_range_switch): Same.
	(gori_compute::compute_operand_range): Same.
	(gori_compute::logical_combine): Same.
	(gori_compute::compute_logical_operands): Same.
	(gori_compute::compute_operand1_range): Same.
	(gori_compute::compute_operand2_range): Same.
	(gori_compute::compute_operand1_and_operand2_range): Same.
	(gori_compute::outgoing_edge_range_p): Same.
	(gori_compute::condexpr_adjust): Same.
	* gimple-range-gori.h (gimple_range_calc_op1): Same.
	(gimple_range_calc_op2): Same.
	* gimple-range-path.cc (path_range_query::get_cache): Same.
	(path_range_query::set_cache): Same.
	(path_range_query::range_on_path_entry): Same.
	(path_range_query::internal_range_of_expr): Same.
	(path_range_query::range_of_expr): Same.
	(path_range_query::ssa_range_in_phi): Same.
	(path_range_query::range_defined_in_block): Same.
	(path_range_query::compute_ranges_in_phis): Same.
	(path_range_query::compute_ranges_in_block): Same.
	(path_range_query::add_to_imports): Same.
	(path_range_query::range_of_stmt): Same.
	* gimple-range-path.h: Same.
	* gimple-range-infer.cc (gimple_infer_range::add_range): Same.
	(gimple_infer_range::~side_effect_manager): Same.
	(gimple_infer_range::get_nonzero): Same.
	(gimple_infer_range::maybe_adjust_range): Same.
	(gimple_infer_range::add_range): Same.
	* gimple-range-infer.h: Same.
	* gimple-range-tests.cc: Same.
	* gimple-range-trace.cc (range_tracer::trailer): Same.
	(debug_seed_ranger): Same.
	* gimple-range-trace.h: Same.
	* gimple-range.cc (gimple_ranger::range_of_expr): Same.
	(gimple_ranger::range_on_entry): Same.
	(gimple_ranger::range_on_exit): Same.
	(gimple_ranger::range_on_edge): Same.
	(gimple_ranger::fold_range_internal): Same.
	(gimple_ranger::range_of_stmt): Same.
	(gimple_ranger::prefill_name): Same.
	(gimple_ranger::prefill_stmt_dependencies): Same.
	(gimple_ranger::export_global_ranges): Same.
	(gimple_ranger::dump_bb): Same.
	* gimple-range.h: Same.
	* gimple-ssa-warn-access.cc (check_nul_terminated_array): Same.
	(memmodel_to_uhwi): Same.
	* tree-ssa-loop-niter.cc (refine_value_range_using_guard): Same.
	(determine_value_range): Same.
	(record_nonwrapping_iv): Same.
	(infer_loop_bounds_from_signedness): Same.
	(scev_var_range_cant_overflow): Same.
	* tree-ssa-threadedge.cc (hybrid_jt_simplifier::simplify): Same.
	* value-query.cc (range_query::range_on_edge): Same.
	(range_query::range_of_stmt): Same.
	(range_query::value_of_expr): Same.
	(range_query::value_on_edge): Same.
	(range_query::value_of_stmt): Same.
	(range_query::get_tree_range): Same.
	(update_global_range): Same.
	(get_range_global): Same.
	(gimple_range_global): Same.
	(global_range_query::range_of_expr): Same.
	(range_query::query_relation): Same.
	* value-query.h (gimple_range_global): Same.
	(update_global_range): Same.
	* vr-values.cc (vr_values::range_of_expr): Same.
	(bounds_of_var_in_loop): Same.
	(simplify_using_ranges::vrp_visit_cond_stmt): Same.
	* vr-values.h (class vr_values): Same.
	* tree-ssa-loop-unswitch.cc (unswitch_predicate): Same.
2022-06-01 11:11:15 +02:00
Aldy Hernandez
d8474337a0 Revamp irange_allocator to handle vranges.
This patch revamps the range allocator to handle generic vrange's.
I've cleaned it up somehow to make it obvious the various things you
can allocate with it.  I've also moved away from overloads into
distinct names when appropriate.

The various entry points are now:

  // Allocate a range of TYPE.
  vrange *alloc_vrange (tree type);
  // Allocate a memory block of BYTES.
  void *alloc (unsigned bytes);
  // Return a clone of SRC.
  template <typename T> T *clone (const T &src);

It is now possible to allocate a clone of an irange, or any future
range types:

      irange *i = allocator.clone <irange> (some_irange);
      frange *f = allocator.clone <frange> (some_frange);

You can actually do so without the <>, but I find it clearer to
specify the vrange type.

So with it you can allocate a specific range type, or vrange, or a
block of memory.

I have rewritten the C style casts to C++ casts, since casts tend to
be hints of problematic designs.  With the C++ casts you can at least
grep for them easier.  Speak of which, the next patch, which converts
ranger to vrange, will further clean this space by removing some
unnecessary casts.

Tested on x86-64 Linux and ppc64le Linux.

	* gimple-range-cache.cc (sbr_vector::sbr_vector): Adjust for
	vrange allocator.
	(sbr_vector::grow): Same.
	(sbr_vector::set_bb_range): Same.
	(sbr_sparse_bitmap::sbr_sparse_bitmap): Same.
	(sbr_sparse_bitmap::set_bb_range): Same.
	(block_range_cache::~block_range_cache): Same.
	(block_range_cache::set_bb_range): Same.
	(ssa_global_cache::ssa_global_cache): Same.
	(ssa_global_cache::~ssa_global_cache): Same.
	(ssa_global_cache::set_global_range): Same.
	* gimple-range-cache.h (block_range_cache): Same.
	(ssa_global_cache): Same.
	* gimple-range-edge.cc
	(gimple_outgoing_range::calc_switch_ranges): Same.
	* gimple-range-edge.h (gimple_outgoing_range): Same.
	* gimple-range-infer.cc (infer_range_manager::get_nonzero):
	Same.
	(infer_range_manager::add_range): Same.
	* gimple-range-infer.h (class infer_range_manager): Same.
	* value-range.h (class irange_allocator): Rename to...
	(class vrange_allocator): ...this.
	(irange_allocator::irange_allocator): New.
	(vrange_allocator::vrange_allocator): New.
	(irange_allocator::~irange_allocator): New.
	(vrange_allocator::~vrange_allocator): New.
	(irange_allocator::get_memory): Rename to...
	(vrange_allocator::alloc): ...this.
	(vrange_allocator::alloc_vrange): Rename from...
	(irange_allocator::allocate): ...this.
	(vrange_allocator::alloc_irange): New.
2022-06-01 11:09:32 +02:00
Andrew MacLeod
156d7d8dbc Use infer instead of side-effect for ranges.
Rename the files and classes to reflect the term infer rather than side-effect.

	* Makefile.in (OBJS): Use gimple-range-infer.o.
	* gimple-range-cache.cc (ranger_cache::fill_block_cache): Change msg.
	(ranger_cache::range_from_dom): Rename var side_effect to infer.
	(ranger_cache::apply_inferred_ranges): Rename from apply_side_effects.
	* gimple-range-cache.h: Include gimple-range-infer.h.
	(class ranger_cache): Adjust prototypes, use infer_range_manager.
	* gimple-range-infer.cc: Rename from gimple-range-side-effects.cc.
	(gimple_infer_range::*): Rename from stmt_side_effects.
	(infer_range_manager::*): Rename from side_effect_manager.
	* gimple-range-side-effect.cc: Rename.
	* gimple-range-side-effect.h: Rename.
	* gimple-range-infer.h: Rename from gimple-range-side-effects.h.
	(class gimple_infer_range): Rename from stmt_side_effects.
	(class infer_range_manager): Rename from side_effect_manager.
	* gimple-range.cc (gimple_ranger::register_inferred_ranges): Rename
	from register_side_effects.
	* gimple-range.h (register_inferred_ranges): Adjust prototype.
	* range-op.h: Adjust comment.
	* tree-vrp.cc (rvrp_folder::pre_fold_bb): Use register_inferred_ranges.
	(rvrp_folder::post_fold_bb): Use register_inferred_ranges.
2022-05-25 10:33:07 -04:00
David Malcolm
ff171cb13d Use "final" and "override" directly, rather than via macros
As of GCC 11 onwards we have required a C++11 compiler, such as GCC 4.8
or later.  On the assumption that any such compiler correctly implements
"final" and "override", this patch updates the source tree to stop using
the FINAL and OVERRIDE macros from ansidecl.h, in favor of simply using
"final" and "override" directly.

libcpp/ChangeLog:
	* lex.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and
	"override".

gcc/analyzer/ChangeLog:
	* analyzer-pass.cc: Replace uses of "FINAL" and "OVERRIDE" with
	"final" and "override".
	* call-info.h: Likewise.
	* checker-path.h: Likewise.
	* constraint-manager.cc: Likewise.
	* diagnostic-manager.cc: Likewise.
	* engine.cc: Likewise.
	* exploded-graph.h: Likewise.
	* feasible-graph.h: Likewise.
	* pending-diagnostic.h: Likewise.
	* region-model-impl-calls.cc: Likewise.
	* region-model.cc: Likewise.
	* region-model.h: Likewise.
	* region.h: Likewise.
	* sm-file.cc: Likewise.
	* sm-malloc.cc: Likewise.
	* sm-pattern-test.cc: Likewise.
	* sm-sensitive.cc: Likewise.
	* sm-signal.cc: Likewise.
	* sm-taint.cc: Likewise.
	* state-purge.h: Likewise.
	* store.cc: Likewise.
	* store.h: Likewise.
	* supergraph.h: Likewise.
	* svalue.h: Likewise.
	* trimmed-graph.h: Likewise.
	* varargs.cc: Likewise.

gcc/c-family/ChangeLog:
	* c-format.cc: Replace uses of "FINAL" and "OVERRIDE" with "final"
	and "override".
	* c-pretty-print.h: Likewise.

gcc/cp/ChangeLog:
	* cxx-pretty-print.h: Replace uses of "FINAL" and "OVERRIDE" with
	"final" and "override".
	* error.cc: Likewise.

gcc/jit/ChangeLog:
	* jit-playback.h: Replace uses of "FINAL" and "OVERRIDE" with
	"final" and "override".
	* jit-recording.cc: Likewise.
	* jit-recording.h: Likewise.

gcc/ChangeLog:
	* config/aarch64/aarch64-sve-builtins-base.cc: Replace uses of
	"FINAL" and "OVERRIDE" with "final" and "override".
	* config/aarch64/aarch64-sve-builtins-functions.h: Likewise.
	* config/aarch64/aarch64-sve-builtins-shapes.cc: Likewise.
	* config/aarch64/aarch64-sve-builtins-sve2.cc: Likewise.
	* diagnostic-path.h: Likewise.
	* digraph.cc: Likewise.
	* gcc-rich-location.h: Likewise.
	* gimple-array-bounds.cc: Likewise.
	* gimple-loop-versioning.cc: Likewise.
	* gimple-range-cache.cc: Likewise.
	* gimple-range-cache.h: Likewise.
	* gimple-range-fold.cc: Likewise.
	* gimple-range-fold.h: Likewise.
	* gimple-range-tests.cc: Likewise.
	* gimple-range.h: Likewise.
	* gimple-ssa-evrp.cc: Likewise.
	* input.cc: Likewise.
	* json.h: Likewise.
	* read-rtl-function.cc: Likewise.
	* tree-complex.cc: Likewise.
	* tree-diagnostic-path.cc: Likewise.
	* tree-ssa-ccp.cc: Likewise.
	* tree-ssa-copy.cc: Likewise.
	* tree-vrp.cc: Likewise.
	* value-query.h: Likewise.
	* vr-values.h: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-05-20 10:05:54 -04:00
Andrew MacLeod
b7501739f3 Add side effect infrastructure.
Replace the non-null procesing with a generic side effect implementation that
can handle arbitrary side effects.

	* Makefile.in (OBJS): Add gimple-range-side-effect.o.
	* gimple-range-cache.cc (non_null_ref::non_null_ref): Delete.
	(non_null_ref::~non_null_ref): Delete.
	(non_null_ref::set_nonnull): Delete.
	(non_null_ref::non_null_deref_p): Delete.
	(non_null_ref::process_name): Delete.
	(ranger_cache::ranger_cache): Initialize m_exit object.
	(ranger_cache::fill_block_cache): Use m_exit object intead of nonnull.
	(ranger_cache::range_from_dom): Use side_effect class and m_exit object.
	(ranger_cache::update_to_nonnull): Delete.
	(non_null_loadstore): Delete.
	(ranger_cache::block_apply_nonnull): Delete.
	(ranger_cache::apply_side_effects): New.
	* gimple-range-cache.h (class non_null_ref): Delete.
	(non_null_ref::adjust_range): Delete.
	(class ranger_cache): Adjust prototypes, add side effect manager.
	* gimple-range-path.cc (path_range_query::range_defined_in_block): Use
	side effect manager for queries.
	(path_range_query::adjust_for_non_null_uses): Ditto.
	* gimple-range-path.h (class path_range_query): Delete non_null_ref.
	* gimple-range-side-effect.cc: New.
	* gimple-range-side-effect.h: New.
	* gimple-range.cc (gimple_ranger::gimple_ranger): Update contructor.
	(gimple_ranger::range_of_expr): Check def block for override value.
	(gimple_ranger::range_on_entry): Don't scan dominators for non-null.
	(gimple_ranger::range_on_edge): Check for outgoing side-effects.
	(gimple_ranger::register_side_effects): Call apply_side_effects.
	(enable_ranger): Update contructor.
	* gimple-range.h (class gimple_ranger): Update prototype.
	(enable_ranger): Update prototype.
	* tree-vrp.cc (execute_ranger_vrp): Invoke without immediate-use flag.
2022-05-17 14:38:03 -04:00
Andrew MacLeod
6b156044c1 Make range_from_dom more effective.
Add modes to range_from_dom such that we can simply query, or adjust the
cache and deal with multiple predecessor blocks.

	* gimple-range-cache.cc (ranger_cache::ranger_cache): Start with
	worlist truncated.
	(ranger_cache::entry_range): Add rfd_mode parameter.
	(ranger_cache::exit_range): Ditto.
	(ranger_cache::edge_range): New.  Incorporate from range_on_edge.
	(ranger_cache::range_of_expr): Adjust call to entry_range.
	(ranger_cache::range_on_edge): Split to edge_range and call.
	(ranger_cache::fill_block_cache): Always invoke range_from_dom.
	(ranger_cache::range_from_dom): Make reentrant, add search mode, handle
	mutiple predecessors.
	(ranger_cache::update_to_nonnull): Adjust call to exit_range.
	* gimple-range-cache.h (ranger_cache): Add enum rfd_mode.  Adjust
	prototypes.
2022-05-13 09:45:35 -04:00
Aldy Hernandez
71f2928e28 Make irange::intersect(wide_int, wide_int) private.
This method should have been private, and somehow seeped into the API.

Tested and benchmarked on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-cache.h (non_null_ref::adjust_range): Do not use
	irange::intersect (wide_int, wide_int).
	* gimple-range-fold.cc (adjust_pointer_diff_expr): Same.
	(adjust_imagpart_expr): Same.
	* value-range.h (irange::intersect (wide_int, wide_int)): Make
	private.
2022-04-29 10:41:59 +02:00
Andrew MacLeod
c6bb1db76b Register non-null side effects properly.
This patch adjusts uses of nonnull to accurately reflect "somewhere in block".
It also adds the ability to register statement side effects within a block
for ranger which will apply for the rest of the block.

	PR tree-optimization/104288
	gcc/
	* gimple-range-cache.cc (non_null_ref::set_nonnull): New.
	(non_null_ref::adjust_range): Move to header.
	(ranger_cache::range_of_def): Don't check non-null.
	(ranger_cache::entry_range): Don't check non-null.
	(ranger_cache::range_on_edge): Check for nonnull on normal edges.
	(ranger_cache::update_to_nonnull): New.
	(non_null_loadstore): New.
	(ranger_cache::block_apply_nonnull): New.
	* gimple-range-cache.h (class non_null_ref): Update prototypes.
	(non_null_ref::adjust_range): Move to here and inline.
	(class ranger_cache): Update prototypes.
	* gimple-range-path.cc (path_range_query::range_defined_in_block): Do
	not search dominators.
	(path_range_query::adjust_for_non_null_uses): Ditto.
	* gimple-range.cc (gimple_ranger::range_of_expr): Check on-entry for
	def overrides.  Do not check nonnull.
	(gimple_ranger::range_on_entry): Check dominators for nonnull.
	(gimple_ranger::range_on_edge): Check for nonnull on normal edges..
	(gimple_ranger::register_side_effects): New.
	* gimple-range.h (gimple_ranger::register_side_effects): New.
	* tree-vrp.cc (rvrp_folder::fold_stmt): Call register_side_effects.

	gcc/testsuite/
	* gcc.dg/pr104288.c: New.
2022-02-09 09:09:54 -05:00
Jakub Jelinek
7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
Andrew MacLeod
14dc5b71d7 Use dominators to reduce cache-flling.
Before walking the CFG and filling all cache entries, check if the
same information is available in a dominator.

	* gimple-range-cache.cc (ranger_cache::fill_block_cache): Check for
	a range from dominators before filling the cache.
	(ranger_cache::range_from_dom): New.
	* gimple-range-cache.h (ranger_cache::range_from_dom): Add prototype.
2021-12-06 13:27:10 -05:00
Andrew MacLeod
d986ff50b4 Split return functionality of get_non_stale_global_range.
Get_non_stale_global_range returns true only when there is a cache entry that
is not out of date.  Change it so that it returns true if there was a cache
value, but return the temporal comparison result in an auxiallary flag.

	* gimple-range-cache.cc (ranger_cache::get_global_range): Always
	return a range, return if it came from the cache or not.
	(get_non_stale_global_range): Rename to get_global_range, and return
	the temporal state in a flag.
	* gimple-range-cache.h (get_non_stale_global_range): Rename and adjust.
	* gimple-range.cc (gimple_ranger::range_of_expr): No need to query
	get_global_range.
	(gimple_ranger::range_of_stmt): Adjust for global cache temporal state
	returned in a flag.
2021-11-24 09:03:07 -05:00
Andrew MacLeod
98244c68e7 Abstract ranger cache update list.
Make it more efficient by removing the call to vec::contains.

	PR tree-optimization/102943
	* gimple-range-cache.cc (class update_list): New.
	(update_list::add): Replace add_to_update.
	(update_list::pop): New.
	(ranger_cache::ranger_cache): Adjust.
	(ranger_cache::~ranger_cache): Adjust.
	(ranger_cache::add_to_update): Delete.
	(ranger_cache::propagate_cache): Adjust to new class.
	(ranger_cache::propagate_updated_value): Ditto.
	(ranger_cache::fill_block_cache): Ditto.
	* gimple-range-cache.h (class ranger_cache): Adjust to update class.
2021-11-05 13:15:19 -04:00
Andrew MacLeod
cb596fd436 Perform on-entry propagation after range_of_stmt on a gcond.
Propagation is automatically done by the temporal cache when defs are
out of date from the names on the RHS, but a gcond has no LHS, and any
updates on the RHS are never propagated.  Always propagate them.

	gcc/
	PR tree-optimization/102983
	* gimple-range-cache.h (propagate_updated_value): Make public.
	* gimple-range.cc (gimple_ranger::range_of_stmt): Propagate exports
	when processing gcond stmts.

	gcc/testsuite/
	* gcc.dg/pr102983.c: New.
2021-10-29 10:31:56 -04:00
Andrew MacLeod
053e1d6421 Create a ranger-local flag for non-executable edges.
Instead of repurposing EDGE_EXECUTABLE, ranger creates a local flag and
ultizes it throughout.

	* gimple-range-cache.cc (ranger_cache::ranger_cache): Take
	non-executable_edge flag as parameter.
	* gimple-range-cache.h (ranger_cache): Adjust prototype.
	* gimple-range-gori.cc (gori_compute::gori_compute): Take
	non-executable_edge flag as parameter.
	(gori_compute::outgoing_edge_range_p): Check new flag.
	* gimple-range-gori.h (gori_compute): Adjust prototype.
	* gimple-range.cc (gimple_ranger::gimple_ranger): Create new flag.
	(gimple_ranger::range_on_edge): Check new flag.
	* gimple-range.h (gimple_ranger::non_executable_edge_flag): New.
	* gimple-ssa-evrp.c (rvrp_folder): Pass ranger flag to simplifer.
	(hybrid_folder::hybrid_folder): Set ranger non-executable flag value.
	(hybrid_folder::fold_stmt): Set flag value in the simplifer.
	* vr-values.c (simplify_using_ranges::set_and_propagate_unexecutable):
	Use not_executable flag if provided inmstead of EDGE_EXECUTABLE.
	(simplify_using_ranges::simplify_switch_using_ranges): Clear
	EDGE_EXECUTABLE like it originally did.
	(simplify_using_ranges::cleanup_edges_and_switches): Clear any
	NON_EXECUTABLE flags.
	(simplify_using_ranges::simplify_using_ranges): Adjust.
	* vr-values.h (class simplify_using_ranges): Adjust.
	(simplify_using_ranges::set_range_query): Add non-executable flag param.
2021-09-23 12:56:43 -04:00
Andrew MacLeod
e68c8280fa Abstract tracing routines into a class.
Generalize range tracing into a class and integrae it with gimple_ranger.
Remove the old derived trace_ranger class.

	* Makefile.in (OBJS): Add gimple-range-trace.o.
	* gimple-range-cache.h (enable_new_values): Remove unused prototype.
	* gimple-range-fold.cc: Adjust headers.
	* gimple-range-trace.cc: New.
	* gimple-range-trace.h: New.
	* gimple-range.cc (gimple_ranger::gimple_ranger): Enable tracer.
	(gimple_ranger::range_of_expr): Add tracing.
	(gimple_ranger::range_on_entry): Ditto.
	(gimple_ranger::range_on_exit): Ditto.
	(gimple_ranger::range_on_edge): Ditto.
	(gimple_ranger::fold_range_internal): Ditto.
	(gimple_ranger::dump_bb): Do not calculate edge range twice.
	(trace_ranger::*): Remove.
	(enable_ranger): Never create a trace_ranger.
	(debug_seed_ranger): Move to gimple-range-trace.cc.
	(dump_ranger): Ditto.
	(debug_ranger): Ditto.
	* gimple-range.h: Include gimple-range-trace.h.
	(range_on_entry, range_on_exit): No longer virtual.
	(class trace_ranger): Remove.
	(DEBUG_RANGE_CACHE): Move to gimple-range-trace.h.
2021-08-17 19:28:42 -04:00
Andrew MacLeod
d242acc396 Change const basic_block to const_basic_block.
* gimple-range-cache.cc (*::set_bb_range): Change const basic_block to
	const_basic_block..
	(*::get_bb_range): Ditto.
	(*::bb_range_p): Ditto.
	* gimple-range-cache.h: Change prototypes.
2021-07-30 15:10:48 -04:00
Aldy Hernandez
79f71ec6fc Abstract out non_null adjustments in ranger.
There are 4 exact copies of the non-null range adjusting code in the
ranger.  This patch abstracts the functionality into a separate method.

As a follow-up I would like to remove the varying_p check, since I have
seen incoming ranges such as [0, 0xff....ef] which are not varying, but
are not-null.  Removing the varying restriction catches those.

gcc/ChangeLog:

	* gimple-range-cache.cc (non_null_ref::adjust_range): New.
	(ranger_cache::range_of_def): Call adjust_range.
	(ranger_cache::entry_range): Same.
	* gimple-range-cache.h (non_null_ref::adjust_range): New.
	* gimple-range.cc (gimple_ranger::range_of_expr): Call
	adjust_range.
	(gimple_ranger::range_on_entry): Same.
2021-07-15 14:23:55 +02:00
Andrew MacLeod
a03e944e92 Do not continue propagating values which cannot be set properly.
If the on-entry cache cannot properly represent a range, do not continue
trying to propagate it.

	PR tree-optimization/101148
	PR tree-optimization/101014
	* gimple-range-cache.cc (ranger_cache::ranger_cache): Adjust.
	(ranger_cache::~ranger_cache): Adjust.
	(ranger_cache::block_range): Check if propagation disallowed.
	(ranger_cache::propagate_cache): Disallow propagation if new value
	can't be stored properly.
	* gimple-range-cache.h (ranger_cache::m_propfail): New member.
2021-06-23 10:26:16 -04:00
Andrew MacLeod
ca4d381662 Adjust on_entry cache to indicate if the value was set properly.
* gimple-range-cache.cc (class ssa_block_ranges): Adjust prototype.
	(sbr_vector::set_bb_range): Return true.
	(class sbr_sparse_bitmap): Adjust.
	(sbr_sparse_bitmap::set_bb_range): Return value.
	(block_range_cache::set_bb_range): Return value.
	(ranger_cache::propagate_cache): Use return value to print msg.
	* gimple-range-cache.h (class block_range_cache): Adjust.
2021-06-23 10:24:30 -04:00
Andrew MacLeod
cb448ade74 Calculate a global definition if one has not been registered.
With poor values gone, Pick up range restrictions from statements
by folding them with global cache values.

	* gimple-range-cache.cc (ranger_cache::range_of_def):  Calculate
	a range if global is not available.
	(ranger_cache::entry_range): Fallback to range_of_def.
	* gimple-range-cache.h (range_of_def): Adjust prototype.
2021-06-18 17:43:28 -04:00
Andrew MacLeod
870b674f72 Remove poor value computations.
Remove the old "poor value" approach which made callbacks into ranger
from the cache.  Use only the best available value for all propagation.

	PR tree-optimization/101014
	* gimple-range-cache.cc (ranger_cache::ranger_cache): Remove poor
	value list.
	(ranger_cache::~ranger_cache): Ditto.
	(ranger_cache::enable_new_values): Delete.
	(ranger_cache::push_poor_value): Delete.
	(ranger_cache::range_of_def): Remove poor value processing.
	(ranger_cache::entry_range): Ditto.
	(ranger_cache::fill_block_cache): Ditto.
	* gimple-range-cache.h (class ranger_cache): Remove poor value members.
	* gimple-range.cc (gimple_ranger::range_of_expr): Remove call.
	* gimple-range.h (class gimple_ranger): Adjust.
2021-06-18 17:43:28 -04:00
Andrew MacLeod
ecc5644fa3 Limit new value calculations to first order effects.
When utilzing poor values during propagation, we mostly care about values that
were undefined/processed directly used in calcualting the SSA_NAME being
processed.  2nd level derivations of such poor values rarely affect the
inital calculation.  Leave them to when they are directly encountered.

	* gimple-range-cache.cc (ranger_cache::ranger_cache): Adjust.
	(ranger_cache::enable_new_values): Set to specified value and
	return the old value.
	(ranger_cache::disable_new_values): Delete.
	(ranger_cache::fill_block_cache): Disable non 1st order derived
	poor values.
	* gimple-range-cache.h (ranger_cache): Adjust prototypes.
	* gimple-range.cc (gimple_ranger::range_of_expr): Adjust.
2021-06-14 17:06:32 -04:00
Andrew MacLeod
9858cd1a68 Implement a sparse bitmap representation for Rangers on-entry cache.
Use a sparse representation for the on entry cache, and utilize it when
the number of basic blocks in the function exceeds param_evrp_sparse_threshold.

	PR tree-optimization/PR100299
	* gimple-range-cache.cc (class sbr_sparse_bitmap): New.
	(sbr_sparse_bitmap::sbr_sparse_bitmap): New.
	(sbr_sparse_bitmap::bitmap_set_quad): New.
	(sbr_sparse_bitmap::bitmap_get_quad): New.
	(sbr_sparse_bitmap::set_bb_range): New.
	(sbr_sparse_bitmap::get_bb_range): New.
	(sbr_sparse_bitmap::bb_range_p): New.
	(block_range_cache::block_range_cache): initialize bitmap obstack.
	(block_range_cache::~block_range_cache): Destruct obstack.
	(block_range_cache::set_bb_range): Decide when to utilze the
	sparse on entry cache.
	* gimple-range-cache.h (block_range_cache): Add bitmap obstack.
	* params.opt (-param=evrp-sparse-threshold): New.
2021-06-07 17:31:01 -04:00
Andrew MacLeod
715914d3f9 Do not calculate new values when evaluating a debug statement.
Add a flag to enable/disable immediately improving poor values found during
cache propagation. Then disable it when processing debug statements.

	gcc/
	PR tree-optimization/100781
	* gimple-range-cache.cc (ranger_cache::ranger_cache): Enable new
	value calculation by default.
	(ranger_cache::enable_new_values): New.
	(ranger_cache::disable_new_values): New.
	(ranger_cache::push_poor_value): Check if new values are allowed.
	* gimple-range-cache.h (class ranger_cache): New member/methods.
	* gimple-range.cc (gimple_ranger::range_of_expr): Check for debug
	statement, and disable/renable new value calculation.

	gcc/testsuite/
	PR tree-optimization/100781
	* gcc.dg/pr100781.c: New.
2021-05-31 20:51:18 -04:00
Andrew MacLeod
2e0f3246e0 Replace ssa_range_in_bb with entry exit and def range
Split the old functionality of ssa_name_in_bb into the components for
definition in a block, entry and exit range.  Call these as appropriate.

	* gimple-range-cache.cc (ranger_cache::ssa_range_in_bb): Delete.
	(ranger_cache::range_of_def): New.
	(ranger_cache::entry_range): New.
	(ranger_cache::exit_range): New.
	(ranger_cache::range_of_expr): Adjust.
	(ranger_cache::range_on_edge): Adjust.
	(ranger_cache::propagate_cache): Call exit_range directly.
	* gimple-range-cache.h (class ranger_cache): Adjust.
2021-05-31 20:49:40 -04:00
Andrew MacLeod
47ea02bb86 Move Ranger cache to range-query and fur_source model.
Flatten and simplify gori-computes. Tweak debug output.
range-cache now provides range_of_expr and range_on_edge in the
standard formats, but in a "query what you have" mode rather than
"go figure out anything that is missing" mode.

	* gimple-range-cache.cc (ranger_cache::ranger_cache): Adjust for
	gori_compute being a member rather than base class.
	dervied call to member call.
	(ranger_cache::dump): No longer dump gori_map.
	(ranger_cache::dump_bb): New.
	(ranger_cache::get_non_stale_global_range): Adjust for gori_compute
	being a member rather than base class.
	(ranger_cache::set_global_range): Ditto.
	(ranger_cache::ssa_range_in_bb): Ditto.
	(ranger_cache::range_of_expr): New.
	(ranger_cache::range_on_edge): New.
	(ranger_cache::block_range): Adjust for gori_computes.  Debug changes.
	(ranger_cache::propagate_cache):  Adjust debugging output.
	(ranger_cache::fill_block_cache): Adjust for gori_computes.  Debug
	output changes.
	* gimple-range-cache.h (class ranger_cache): Make gori_compute a
	member, and inherit from range_query instead.
	(ranger_cache::dump_bb): New. split from dump.
	* gimple-range-gori.cc (gori_compute::ssa_range_in_bb): Delete.
	(gori_compute::expr_range_at_stmt): Delete.
	(gori_compute::compute_name_range_op): Delete.
	(gori_compute::compute_operand_range_switch): Add fur_source.
	(gori_compute::compute_operand_range): Add fur_source param, inline
	old compute_name_range_op and optimize_logical_operands.
	(struct tf_range): Delete.
	(gori_compute::logical_combine): Adjust
	(gori_compute::optimize_logical_operands): Delete.
	(gori_compute::compute_logical_operands_in_chain): Delete.
	(gori_compute::compute_logical_operands): Adjust.
	(gori_compute::compute_operand1_range): Adjust to fur_source.
	(gori_compute::compute_operand2_range): Ditto.
	(gori_compute::compute_operand1_and_operand2_range): Ditto.
	(gori_compute::outgoing_edge_range_p): Add range_query parameter,
	and adjust to fur_source.
	* gimple-range-gori.h (class gori_compute): Simplify and adjust to
	range_query and fur_source.
	* gimple-range.cc (gimple_ranger::range_on_edge): Query range_on_edge
	from the ranger_cache..
	(gimple_ranger::fold_range_internal): Adjust to base class change of
	ranger_cache.
	(gimple_ranger::dump_bb): Adjust dump.
	* gimple-range.h (gimple_ranger):export gori computes object.
2021-05-31 20:49:39 -04:00