Commit Graph

322 Commits

Author SHA1 Message Date
Richard Biener e1f38328f4 re PR tree-optimization/82985 (ICC: in vn_nary_build_or_lookup_1, at tree-ssa-sccvn.c:1722)
2017-11-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82985
	Backport from mainline
	2017-08-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81790
	* tree-ssa-sccvn.c (vn_lookup_simplify_result): Handle both
	CONSTRUCTORs from simplifying and VN.

	* gcc.dg/torture/pr81790.c: New testcase.
	* g++.dg/torture/pr82985.C: Likewise.

From-SVN: r254766
2017-11-15 12:50:39 +00:00
Richard Biener 87c7cf4766 Backport PRs 82244, 82264, 82276, 82285, 82291
2017-09-26  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-09-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82244
	* tree-vrp.c (remove_range_assertions): Do not propagate
	a constant to abnormals but replace the assert with a copy.

	* gcc.dg/torture/pr82244.c: New testcase.

	2017-09-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82276
	PR tree-optimization/82244
	* tree-vrp.c (build_assert_expr_for): Set
	SSA_NAME_OCCURS_IN_ABNORMAL_PHI if the variable we assert on
	has it set.
	(remove_range_assertions): Revert earlier change.

	* gcc.dg/torture/pr82276.c: New testcase.

	2017-09-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82264
	* tree-ssa-sccvn.c (vn_phi_eq): Use safe_dyn_cast to check
	for GIMPLE_CONDs.
	(vn_phi_lookup): Likewise.
	(vn_phi_insert): Likewise.
	* is-a.h (safe_dyn_cast): New.

	* gcc.dg/torture/pr82264.c: New testcase.

	2017-09-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82285
	* tree-vect-patterns.c (vect_recog_bool_pattern): Also handle
	enumeral types.

	* gcc.dg/torture/pr82285.c: New testcase.

	2017-09-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82291
	* tree-if-conv.c (predicate_mem_writes): Make sure to
	remove writes in blocks predicated with false.

	* gcc.dg/torture/pr82291.c: New testcase.

From-SVN: r253190
2017-09-26 10:16:40 +00:00
Richard Biener 897c0169ea backport: re PR tree-optimization/81977 (Issue with inline memcpy with optimizations enabled)
2017-08-29  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-08-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81977
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Fix look through
	memcpy.

	* g++.dg/torture/pr81977.C: New testcase.

	2017-08-28  Richard Biener  <rguenther@suse.de>

	PR debug/81993
	* dwarf2out.c (gen_remaining_tmpl_value_param_die_attributes):
	Do nothing for removed DIEs.

From-SVN: r251399
2017-08-29 07:06:46 +00:00
Richard Biener 075a5f6aaf backport: [multiple changes]
2017-06-28  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-06-09  Richard Biener  <rguenther@suse.de>

	PR middle-end/81007
	* ipa-polymorphic-call.c
	(ipa_polymorphic_call_context::restrict_to_inner_class):
	Skip FIELD_DECLs with error_mark_node type.
	* passes.def (all_lowering_passes): Run pass_build_cgraph_edges
	last again.

	* g++.dg/pr81007.C: New testcase.

	2017-06-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81083
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Do not use abnormals
	as values.

	* gcc.dg/torture/pr81083.c: New testcase.

	2017-06-21  Richard Biener  <rguenther@suse.de>

	PR gcov-profile/81080
	* configure.ac: Add AC_SYS_LARGEFILE.
	* libgcov.h: Include auto-target.h before tsystem.h to pick
	up _FILE_OFFSET_BITS which might differ for multilibs.
	* config.in: Regenerate.
	* configure: Likewise.

From-SVN: r249738
2017-06-28 13:25:33 +00:00
Richard Biener 6987b50fcc backport: [multiple changes]
2017-05-03  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-04-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80453
	* tree-ssa-sccvn.h (struct vn_phi_s): Add cclhs and ccrhs members.
	* tree-ssa-sccvn.c (cond_stmts_equal_p): Use recorded lhs and rhs
	from the conditions.
	(vn_phi_eq): Pass them down.
	(vn_phi_lookup): Record them.
	(vn_phi_insert): Likewise.

	2017-04-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80492
	* alias.c (compare_base_decls): Handle registers with asm
	specification conservatively.

	* gcc.dg/pr80492.c: New testcase.

	2017-04-27  Richard Biener  <rguenther@suse.de>

	PR middle-end/80539
	* tree-chrec.c (chrec_fold_plus_poly_poly): Deal with not
	being in loop-closed SSA form conservatively.
	(chrec_fold_multiply_poly_poly): Likewise.

	* gcc.dg/torture/pr80539.c: New testcase.

From-SVN: r247545
2017-05-03 11:22:34 +00:00
Richard Biener 0f78434635 re PR middle-end/80262 (address space gets lost in memory access)
2017-04-06  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80262
	* tree-sra.c (build_ref_for_offset): Preserve address-space
	information.
	* tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address):
	Drop useless address-space information on MEM_REF offsets.

	* gcc.target/i386/pr80262.c: New testcase.

From-SVN: r246728
2017-04-06 12:31:05 +00:00
Richard Biener 41aa3a3857 re PR tree-optimization/79740 (ICE on -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in VN_INFO_GET, at tree-ssa-sccvn.c:407 }))
2017-02-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/79740
	* tree-ssa-sccvn.c (vn_nary_op_insert_into): Allow redundant
	inserts.
	(visit_nary_op): Insert the nary into the hashtable if we
	pattern-matched sth.
	* tree-ssa-pre.c (eliminate_insert): Robustify.

	* gcc.dg/torture/pr79740.c: New testcase.

From-SVN: r245780
2017-02-28 15:32:24 +00:00
Richard Biener 68b948d3ba re PR tree-optimization/45397 (Issues with integer narrowing conversions)
2017-02-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/45397
	* tree-ssa-pre.c (eliminate_insert): Handle BIT_AND_EXPR.
	* tree-ssa-sccvn.c (valueized_wider_op): New helper.
	(visit_nary_op): Add pattern matching for CSEing sign-changed
	or truncated operations with wider ones.

	* gcc.dg/tree-ssa/pr45397.c: New testcase.

From-SVN: r245752
2017-02-27 08:51:28 +00:00
Jakub Jelinek aa326bfb90 cprop.c (cprop_jump): Add missing space in string literal.
* cprop.c (cprop_jump): Add missing space in string literal.
	* tree-ssa-structalias.c (rewrite_constraints): Likewise.
	(get_constraint_for_component_ref): Likewise.
	* df-core.c (df_worklist_dataflow_doublequeue): Likewise.
	* tree-outof-ssa.c (insert_partition_copy_on_edge): Likewise.
	* lra-constraints.c (process_alt_operands): Likewise.
	* ipa-inline.c (inline_small_functions): Likewise.
	* tree-ssa-sccvn.c (visit_reference_op_store): Likewise.
	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Likewise.
	* trans-mem.c (diagnose_tm_1_op): Likewise.
	* omp-grid.c (grid_find_single_omp_among_assignments): Likewise.
	(grid_parallel_clauses_gridifiable): Likewise.
c/
	* c-parser.c (c_parser_oacc_declare): Add missing space in
	diagnostics.
fortran/
	* trans-expr.c (gfc_conv_substring): Add missing space in diagnostics.

From-SVN: r245409
2017-02-13 22:56:13 +01:00
Richard Biener ed20a004e1 re PR rtl-optimization/72488 (wrong code (SIGFPE) at -Os and above on x86_64-linux-gnu (in the 64-bit mode))
2017-01-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/72488
	* tree-ssa-sccvn.c (run_scc_vn): When we abort the VN make
	sure to restore SSA info.
	* tree-ssa.c (verify_ssa): Verify SSA info is not shared.

From-SVN: r244623
2017-01-19 12:00:42 +00:00
Jakub Jelinek bd2c62704b re PR translation/79019 (translatable string typo in cif-code.def:141)
PR translation/79019
	PR translation/79020
	* params.def (PARAM_INLINE_MIN_SPEEDUP,
	PARAM_IPA_CP_SINGLE_CALL_PENALTY,
	PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD): Fix typos
	in descriptions.
	* config/avr/avr.opt (maccumulate-args): Likewise.
	* config/msp430/msp430.opt (mwarn-mcu): Likewise.
	* common.opt (freport-bug): Likewise.
	* cif-code.def (CIF_FINAL_ERROR): Likewise.
	* doc/invoke.texi (ipa-cp-single-call-penalty): Likewise.
	* config/s390/s390.c (s390_invalid_binary_op): Fix spelling in
	translatable string.
	* config/i386/i386.c (function_value_32): Likewise.
	* config/nios2/nios2.c (nios2_valid_target_attribute_rec): Likewise.
	* config/msp430/msp430.c (msp430_option_override, msp430_attr):
	Likewise.
	* config/msp430/driver-msp430.c (msp430_select_hwmult_lib): Likewise.
	* common/config/msp430/msp430-common.c (msp430_handle_option):
	Likewise.
	* symtab.c (symtab_node::verify_base): Likewise.
	* opts.c (set_debug_level): Likewise.
	* tree.c (verify_type_variant): Likewise.  Fix typo in comment.
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add
	missing whitespace to translatable strings.
	* config/avr/avr.md (bswapsi2): Fix typo in comment.
	* config/sh/superh.h: Likewise.
	* config/i386/xopintrin.h: Likewise.
	* config/i386/znver1.md: Likewise.
	* config/rs6000/rs6000.c (struct rs6000_opt_mask): Likewise.
	* ipa-inline-analysis.c (compute_inline_parameters): Likewise.
	* double-int.h (struct double_int): Likewise.
	* double-int.c (div_and_round_double): Likewise.
	* wide-int.cc: Likewise.
	* tree-ssa.c (non_rewritable_mem_ref_base): Likewise.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
	* cfgcleanup.c (crossjumps_occured): Renamed to ...
	(crossjumps_occurred): ... this.
	(try_crossjump_bb, try_head_merge_bb, try_optimize_cfg, cleanup_cfg):
	Adjust all uses.
cp/
	* semantics.c (finish_omp_clauses): Add missing whitespace to
	translatable strings.
	* cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
lto/
	* lto-symtab.c (lto_symtab_merge_symbols): Fix comment typo.
fortran/
	* decl.c (attr_decl1): Fix spelling in translatable string.
	* intrinsic.texi: Fix spelling - invokation -> invocation.
	* lang.opt (faggressive-function-elimination, gfc_convert): Fix
	typos in descriptions.
	* openmp.c (resolve_omp_clauses): Add missing whitespace to
	translatable strings.
c-family/
	* c.opt (Wnormalized=): Fix typo in description.
testsuite/
	* c-c++-common/goacc/host_data-2.c (f): Adjust expected spelling of
	diagnostics.
	* gfortran.dg/initialization_17.f90: Likewise.

From-SVN: r244245
2017-01-09 22:48:33 +01:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Richard Biener 14e7281244 fold-const.c (tree_swap_operands_p): Remove unused arg.
2016-11-09  Richard Biener  <rguenther@suse.de>

	* fold-const.c (tree_swap_operands_p): Remove unused arg.
	* fold-const.c (tree_swap_operands_p): Likewise.
	(fold_binary_loc): Adjust.
	(fold_ternary_loc): Likewise.
	* genmatch.c (dt_operand::gen_gimple_exp): Likewise.
	* gimple-fold.c (fold_stmt_1): Likewise.
	* gimple-match-head.c (gimple_resimplify2): Likewise.
	(gimple_resimplify3): Likewise.
	(gimple_simplify): Likewise.
	* tree-ssa-dom.c (record_equality): Likewise.
	* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Likewise.
	* tree-ssa-sccvn.c (vn_nary_op_compute_hash): Likewise.
	* tree-ssa-threadedge.c (simplify_control_stmt_condition_1): Likewise.

From-SVN: r242004
2016-11-09 15:15:28 +00:00
Thomas Preud'homme 4d0cdd0ce6 Move MEMMODEL_* from coretypes.h to memmodel.h
2016-10-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    * coretypes.h: Move MEMMODEL_* macros and enum memmodel definition
    into ...
    * memmodel.h: This file.
    * alias.c, asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
      caller-save.c, calls.c, ccmp.c, cfgbuild.c, cfgcleanup.c,
      cfgexpand.c, cfgloopanal.c, cfgrtl.c, cilk-common.c, combine.c,
      combine-stack-adj.c, common/config/aarch64/aarch64-common.c,
      common/config/arm/arm-common.c, common/config/bfin/bfin-common.c,
      common/config/c6x/c6x-common.c, common/config/i386/i386-common.c,
      common/config/ia64/ia64-common.c, common/config/nvptx/nvptx-common.c,
      compare-elim.c, config/aarch64/aarch64-builtins.c,
      config/aarch64/aarch64-c.c, config/aarch64/cortex-a57-fma-steering.c,
      config/arc/arc.c, config/arc/arc-c.c, config/arm/arm-builtins.c,
      config/arm/arm-c.c, config/avr/avr.c, config/avr/avr-c.c,
      config/avr/avr-log.c, config/bfin/bfin.c, config/c6x/c6x.c,
      config/cr16/cr16.c, config/cris/cris.c, config/darwin-c.c,
      config/darwin.c, config/epiphany/epiphany.c,
      config/epiphany/mode-switch-use.c,
      config/epiphany/resolve-sw-modes.c, config/fr30/fr30.c,
      config/frv/frv.c, config/ft32/ft32.c, config/h8300/h8300.c,
      config/i386/i386-c.c, config/i386/winnt.c, config/iq2000/iq2000.c,
      config/lm32/lm32.c, config/m32c/m32c.c, config/m32r/m32r.c,
      config/m68k/m68k.c, config/mcore/mcore.c,
      config/microblaze/microblaze.c, config/mmix/mmix.c,
      config/mn10300/mn10300.c, config/moxie/moxie.c,
      config/msp430/msp430.c, config/nds32/nds32-cost.c,
      config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c,
      config/nds32/nds32-memory-manipulation.c,
      config/nds32/nds32-predicates.c, config/nds32/nds32.c,
      config/nios2/nios2.c, config/nvptx/nvptx.c, config/pa/pa.c,
      config/pdp11/pdp11.c, config/rl78/rl78.c, config/rs6000/rs6000-c.c,
      config/rx/rx.c, config/s390/s390-c.c, config/s390/s390.c,
      config/sh/sh.c, config/sh/sh-c.c, config/sh/sh-mem.cc,
      config/sh/sh_treg_combine.cc, config/sol2.c, config/spu/spu.c,
      config/stormy16/stormy16.c, config/tilegx/tilegx.c,
      config/tilepro/tilepro.c, config/v850/v850.c, config/vax/vax.c,
      config/visium/visium.c, config/vms/vms-c.c, config/xtensa/xtensa.c,
      coverage.c, cppbuiltin.c, cprop.c, cse.c, cselib.c, dbxout.c, dce.c,
      df-core.c, df-problems.c, df-scan.c, dojump.c, dse.c, dwarf2asm.c,
      dwarf2cfi.c, dwarf2out.c, emit-rtl.c, except.c, explow.c, expmed.c,
      expr.c, final.c, fold-const.c, function.c, fwprop.c, gcse.c,
      ggc-page.c, haifa-sched.c, hsa-brig.c, hsa-gen.c, hw-doloop.c,
      ifcvt.c, init-regs.c, internal-fn.c, ira-build.c, ira-color.c,
      ira-conflicts.c, ira-costs.c, ira-emit.c, ira-lives.c, ira.c, jump.c,
      loop-doloop.c, loop-invariant.c, loop-iv.c, loop-unroll.c,
      lower-subreg.c, lra.c, lra-assigns.c, lra-coalesce.c,
      lra-constraints.c, lra-eliminations.c, lra-lives.c, lra-remat.c,
      lra-spills.c, mode-switching.c, modulo-sched.c, omp-low.c, passes.c,
      postreload-gcse.c, postreload.c, predict.c, print-rtl-function.c,
      recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c,
      reload.c, reload1.c, reorg.c, resource.c, rtl-chkp.c, rtl-tests.c,
      rtlanal.c, rtlhooks.c, sched-deps.c, sched-rgn.c, sdbout.c,
      sel-sched-ir.c, sel-sched.c, shrink-wrap.c, simplify-rtx.c,
      stack-ptr-mod.c, stmt.c, stor-layout.c, target-globals.c,
      targhooks.c, toplev.c, tree-nested.c, tree-outof-ssa.c,
      tree-profile.c, tree-ssa-coalesce.c, tree-ssa-ifcombine.c,
      tree-ssa-loop-ivopts.c, tree-ssa-loop.c, tree-ssa-reassoc.c,
      tree-ssa-sccvn.c, tree-vect-data-refs.c, ubsan.c, valtrack.c,
      var-tracking.c, varasm.c: Include memmodel.h.
    * genattrtab.c (write_header): Include memmodel.h in generated file.
    * genautomata.c (main): Likewise.
    * gengtype.c (open_base_files): Likewise.
    * genopinit.c (main): Likewise.
    * genconditions.c (write_header): Include memmodel.h earlier in
    generated file.
    * genemit.c (main): Likewise.
    * genoutput.c (output_prologue): Likewise.
    * genpeep.c (main): Likewise.
    * genpreds.c (write_insn_preds_c): Likewise.
    * genrecog.c (write_header): Likewise.
    * Makefile.in (PLUGIN_HEADERS): Include memmodel.h

    gcc/ada/
    * gcc-interface/utils2.c: Include memmodel.h.

    gcc/c-family/
    * c-cppbuiltin.c: Include memmodel.h.
    * c-opts.c: Likewise.
    * c-pragma.c: Likewise.
    * c-warn.c: Likewise.

    gcc/c/
    * c-typeck.c: Include memmodel.h.

    gcc/cp/
    * decl2.c: Include memmodel.h.
    * rtti.c: Likewise.

    gcc/fortran/
    * trans-intrinsic.c: Include memmodel.h.

    gcc/go/
    * go-backend.c: Include memmodel.h.

    libgcc/
    * libgcov-profiler.c: Replace MEMMODEL_* macros by their __ATOMIC_*
    equivalent.
    * config/tilepro/atomic.c: Likewise and stop casting model to
    enum memmodel.

From-SVN: r241121
2016-10-13 14:17:52 +00:00
Richard Biener 37f6a157f5 re PR tree-optimization/77839 (Memory- and compile time hog at -O1 and above)
2016-10-06  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77839
	* tree-ssa-sccvn.c (set_ssa_val_to): Forbid value -> constant value
	lattice transition.

	* gcc.dg/torture/pr77839.c: New testcase.

From-SVN: r240829
2016-10-06 08:54:37 +00:00
Richard Biener ca0e1607e9 re PR bootstrap/77768 (LTO/PGO -O3 bootstrap broken: tree-vrp.c:11053:0: internal compiler error: Segmentation fault)
2016-09-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77768
	* tree-ssa-sccvn.c (visit_reference_op_store): Properly deal
	with stores to a place we know has a constant value.

From-SVN: r240610
2016-09-29 07:15:13 +00:00
Richard Biener 59896334f9 re PR tree-optimization/77745 (Inconsistent application of aliasing rules)
2016-09-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77745
	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
	When removing redundant stores make sure to check compatibility
	of the TBAA state for downstream accesses.
	* tree-ssa-sccvn.c (visit_reference_op_store): Likewise for when
	value-numbering virtual operands for store matches.

	* g++.dg/torture/pr77745.C: New testcase.

From-SVN: r240534
2016-09-27 12:56:38 +00:00
Richard Biener 113d06a486 tree-ssa-sccvn.c (visit_reference_op_call): Value number virtual definition to virtual use if...
2016-09-23  Richard Biener  <rguenther@suse.de>

	* tree-ssa-sccvn.c (visit_reference_op_call): Value number
	virtual definition to virtual use if the call devirtualizes
	to a const or pure function.
	(visit_use): Also visit calls we can devirtualize to a
	const or pure function.

	* gcc.dg/tree-ssa/ssa-fre-56.c: New testcase.

From-SVN: r240431
2016-09-23 12:39:05 +00:00
Jakub Jelinek 199d1d488f ipa-cp.c (ipcp_store_vr_results): Avoid static local var zero.
* ipa-cp.c (ipcp_store_vr_results): Avoid static local
	var zero.
	* sreal.h (sreal::min, sreal::max): Avoid static local vars,
	construct values without normalization.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Don't initialize
	static local lhs_ops to vNULL.
cp/
	* name-lookup.c (store_bindings, store_class_bindings): Don't
	initialize static local bindings_need_stored to vNULL.

From-SVN: r240408
2016-09-23 11:43:09 +02:00
Richard Biener b5bbe47bb3 re PR tree-optimization/77646 (GCC Segfault with -O3)
2016-09-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77646
	* tree-ssa-sccvn.c (visit_reference_op_call): Always value-number
	a VDEF.

	* gcc.dg/torture/pr77646.c: New testcase.

From-SVN: r240261
2016-09-20 12:20:37 +00:00
Kugan Vivekanandarajah 46aa019a01 Iterator to visit SSA
Iterator to visit SSA
gcc/ChangeLog:

2016-09-15  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* tree-ssanames.h (FOR_EACH_SSA_NAME): New.
	* cfgexpand.c (update_alias_info_with_stack_vars): Use
	FOR_EACH_SSA_NAME to iterate over SSA variables.
	(pass_expand::execute): Likewise.
	* omp-simd-clone.c (ipa_simd_modify_function_body): Likewise.
	* tree-cfg.c (dump_function_to_file): Likewise.
	* tree-into-ssa.c (pass_build_ssa::execute): Likewise.
	(update_ssa): Likewise.
	* tree-ssa-alias.c (dump_alias_info): Likewise.
	* tree-ssa-ccp.c (ccp_finalize): Likewise.
	* tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise.
	(create_outofssa_var_map): Likewise.
	(coalesce_ssa_name): Likewise.
	* tree-ssa-operands.c (dump_immediate_uses): Likewise.
	* tree-ssa-pre.c (compute_avail): Likewise.
	* tree-ssa-sccvn.c (init_scc_vn): Likewise.
	(scc_vn_restore_ssa_info): Likewise.
	(free_scc_vn): Likwise.
	(run_scc_vn): Likewise.
	* tree-ssa-structalias.c (compute_points_to_sets): Likewise.
	* tree-ssa-ter.c (new_temp_expr_table): Likewise.
	* tree-ssa-copy.c (fini_copy_prop): Likewise.
	* tree-ssa.c (verify_ssa): Likewise.

From-SVN: r240152
2016-09-15 02:03:51 +00:00
Richard Biener e4969090b6 re PR tree-optimization/73434 (Wrong code with casting, branches and aliasing)
2016-08-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/73434
	* tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address): Preserve
	TBAA info on the base when forwarding a non-invariant address.

	* gcc.dg/torture/pr73434.c: New testcase.

From-SVN: r239471
2016-08-15 09:56:00 +00:00
Richard Biener 13e889530d gimple-fold.c (get_base_constructor): Add VIEW_CONVERT case, handle all tcc_constant bases and valueize SSA names.
2016-07-19  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (get_base_constructor): Add VIEW_CONVERT case,
	handle all tcc_constant bases and valueize SSA names.
	* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Handle
	tcc_constant bases.

	* c-c++-common/vector-subscript-6.c: New testcase.
	* c-c++-common/vector-subscript-7.c: Likewise.

From-SVN: r238475
2016-07-19 14:16:54 +00:00
Richard Biener cef5388d95 re PR tree-optimization/71901 (ice in find_or_generate_expression)
2016-07-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71901
	* tree-ssa-sccvn.h (struct vn_reference_op_struct): Add
	align member, group stuff with the bitfield.
	(vn_ref_op_align_unit): New inline.
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): For ARRAY_REFs
	record element alignment and operand 3 unchanged.
	(ao_ref_init_from_vn_reference): Adjust.
	(valueize_refs_1): Likewise.
	* tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise.

	* gcc.dg/torture/pr71901.c: New testcase.

From-SVN: r238468
2016-07-19 10:19:46 +00:00
Richard Biener 2e7565b268 re PR tree-optimization/71893 (gfortran.dg ICEs in gcc/tree-ssa-pre.c; -fcode-hoisting?)
2016-07-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71893
	* tree-ssa-pre.c (create_component_ref_by_pieces_1): Compensate
	for sizetype cast added by array_ref_element_size.
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise.

From-SVN: r238426
2016-07-18 08:46:42 +00:00
Richard Biener 351168fe55 re PR tree-optimization/71866 (gcc locks up after fix for PR70159)
2016-07-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71866
	* tree-ssa-pre.c (get_constant_for_value_id): Remove.
	(do_hoist_insertion): Avoid endless recursion when we
	didn't insert anything because we managed to simplify
	things down to a constant or SSA name.
	(fully_constant_expression): Re-write in terms of ...
	* tree-ssa-sccvn.h (vn_nary_simplify): ... this.  Declare.
	* tree-ssa-sccvn.c (vn_nary_simplify): New wrapper around
	vn_nary_build_or_lookup_1.
	(vn_nary_build_or_lookup_1): Added flag and renamed from ...
	(vn_nary_build_or_lookup): ... this which now wraps it.

	* gcc.dg/torture/pr71866.c: New testcase.

From-SVN: r238334
2016-07-14 12:15:38 +00:00
Trevor Saunders 8c6812476a use auto_vec for more local variables
gcc/c/ChangeLog:

2016-07-12  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* c-parser.c (c_parser_generic_selection): Make type of variable
	auto_vec.
	(c_parser_omp_declare_simd): Likewise.

gcc/ChangeLog:

2016-07-12  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* cfgexpand.c (expand_used_vars): Make the type of a local variable auto_vec.
	* genmatch.c (lower_for): Likewise.
	* haifa-sched.c (haifa_sched_init): Likewise.
	(add_to_speculative_block): Likewise.
	(create_check_block_twin): Likewise.
	* predict.c (handle_missing_profiles): Likewise.
	* tree-data-ref.c (loop_nest_has_data_refs): Likewise.
	* tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Likewise.
	* tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Likewise.
	(maybe_lower_iteration_bound): Likewise.
	* tree-ssa-sccvn.c (DFS): Likewise.
	* tree-stdarg.c (reachable_at_most_once): Likewise.
	* tree-vect-stmts.c (vectorizable_conversion): Likewise.
	(vectorizable_store): Likewise.

From-SVN: r238285
2016-07-13 02:44:52 +00:00
Trevor Saunders fcd215916e tree-ssa-sccvn.c: use auto_vec for sccvn_dom_walker::cond_stack
gcc/ChangeLog:

2016-07-12  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree-ssa-sccvn.c (sccvn_dom_walker::~sccvn_dom_walker): remove.
	(sccvn_dom_walker): make cond_stack an auto_vec.

From-SVN: r238284
2016-07-13 02:44:35 +00:00
Richard Biener 3c5b29f561 tree-ssa-pre.c: Include alias.h.
2016-07-07  Richard Biener  <rguenther@suse.de>

	* tree-ssa-pre.c: Include alias.h.
	(compute_avail): If we have multiple VN_REFERENCEs with the
	same hashtable entry adjust that to make it a valid replacement
	for all of them with respect to alignment and aliasing
	when doing insertion.
	* tree-ssa-sccvn.h (vn_reference_operands_for_lookup): Declare.
	* tree-ssa-sccvn.c (vn_reference_operands_for_lookup): New function.

From-SVN: r238078
2016-07-07 07:43:35 +00:00
Eric Botcazou ec67c62e3c tree-ssa-sccvn.c (vn_reference_lookup_3): Use a uniform test and update shared_lookup_references only once after changing...
* tree-ssa-sccvn.c (vn_reference_lookup_3): Use a uniform test and
	update shared_lookup_references only once after changing operands.

From-SVN: r237388
2016-06-13 17:44:12 +00:00
Richard Biener 1ef33ef304 re PR tree-optimization/71059 (gcc ICE at -O3 on valid code on x86_64-linux-gnu in "vn_nary_op_insert_into")
2016-05-12  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71059
	* tree-ssa-pre.c (phi_translate_1): Fully fold translated
	nary before looking up or entering the expression into the VN
	hashes.
	* tree-ssa-sccvn.c (vn_nary_build_or_lookup): Fix comment typo.
	Make sure to re-use NARYs without result as inserted by
	phi-translation.

	* gcc.dg/torture/pr71059.c: New testcase.

From-SVN: r236175
2016-05-12 13:46:26 +00:00
Richard Biener f35ea97de8 re PR tree-optimization/71055 (FAIL: gcc.dg/torture/pr53663-1.c -Os execution test)
2016-05-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71055
	* tree-ssa-sccvn.c (vn_reference_lookup_3): When native-interpreting
	sth with precision not equal to access size verify we don't chop
	off bits.

	* gcc.dg/torture/pr71055.c: New testcase.

From-SVN: r236122
2016-05-11 14:04:32 +00:00
Richard Biener 64ea4e151b re PR tree-optimization/70497 (Missed CSE of subregs on GIMPLE)
2016-05-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/70497
	PR tree-optimization/28367
	* tree-ssa-sccvn.c (vn_nary_build_or_lookup): New function
	split out from ...
	(visit_reference_op_load): ... here.
	(vn_reference_lookup_3): Use it to handle subreg-like accesses
	with simplified BIT_FIELD_REFs.
	* tree-ssa-pre.c (eliminate_insert): Handle inserting BIT_FIELD_REFs.
	* tree-complex.c (extract_component): Handle BIT_FIELD_REFs
	correctly.

	* gcc.dg/torture/20160404-1.c: New testcase.
	* gcc.dg/tree-ssa/ssa-fre-54.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-55.c: Likewise.

From-SVN: r236066
2016-05-10 08:20:43 +00:00
Richard Sandiford 8de73453a4 Support << and >> for offset_int and widest_int
Following on from the comparison patch, I think it makes sense to
support << and >> for offset_int (int128_t) and widest_int (intNNN_t),
with >> being arithmetic shift.  It doesn't make sense to use
logical right shift on a potentially negative offset_int, since
the precision of 128 bits has no meaning on the target.

Tested on x86_64-linux-gnu and aarch64-linux-gnu.

gcc/
	* wide-int.h: Update offset_int and widest_int documentation.
	(WI_SIGNED_SHIFT_RESULT): New macro.
	(wi::binary_shift): Define signed_shift_result_type for
	shifts on offset_int- and widest_int-like types.
	(generic_wide_int): Support <<= and >>= if << and >> are supported.
	* tree.h (int_bit_position): Use shift operators instead of wi::
	 shifts.
	* alias.c (adjust_offset_for_component_ref): Likewise.
	* expr.c (get_inner_reference): Likewise.
	* fold-const.c (fold_comparison): Likewise.
	* gimple-fold.c (fold_nonarray_ctor_reference): Likewise.
	* gimple-ssa-strength-reduction.c (restructure_reference): Likewise.
	* tree-dfa.c (get_ref_base_and_extent): Likewise.
	* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Likewise.
	(stmt_kills_ref_p): Likewise.
	* tree-ssa-ccp.c (bit_value_binop_1): Likewise.
	* tree-ssa-math-opts.c (find_bswap_or_nop_load): Likewise.
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise.
	(ao_ref_init_from_vn_reference): Likewise.

gcc/cp/
	* init.c (build_new_1): Use shift operators instead of wi:: shifts.

From-SVN: r235720
2016-05-02 09:39:38 +00:00
Richard Biener 65f52ee9b9 re PR tree-optimization/70724 (Miscompiles python3 with FDO)
2016-04-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/70724
	* tree-ssa-sccvn.c (scc_vn_restore_ssa_info): Split SSA info
	restoring out from ...
	(free_scc_vn): ... here.
	* tree-ssa-sccvn.h (scc_vn_restore_ssa_info): Declare.
	* tres-ssa-pre.c (pass_pre::execute): Restore SSA info before
	tail merging.
	(pass_fre::execute): Restore SSA info.

	* gcc.dg/torture/pr70724.c: New testcase.

From-SVN: r235203
2016-04-19 13:22:19 +00:00
Richard Biener edd048e29a re PR tree-optimization/70701 (incomplete value numbering when memcpy-ing from array)
2016-04-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/70701
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Resolve fully constant
	references after translating through a memcpy.

	* gcc.dg/tree-ssa/ssa-fre-53.c: New testcase.

From-SVN: r235131
2016-04-18 11:39:04 +00:00
Jakub Jelinek 511e5c4889 re PR middle-end/70239 (ICE in ggc_set_mark)
PR middle-end/70239
	* tree-ssa-sccvn.c (VN_INFO_GET): Use safe_grow_cleared instead
	of safe_grow.

From-SVN: r234221
2016-03-15 17:10:59 +01:00
Richard Biener 87440c298e re PR tree-optimization/69776 (Wrong optimization with aliasing)
2016-02-16  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69776
	* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Get alias
	sets from caller.
	(indirect_refs_may_alias_p): Likewise.
	(refs_may_alias_p_1): Pass alias sets as from ao_ref.
	* tree-ssa-sccvn.c (vn_reference_lookup): Also adjust vr alias-set
	according to tbaa_p.
	* tree-ssa-dom.c (lookup_avail_expr): Add tbaa_p flag.
	(optimize_stmt): For redundant store discovery do not allow tbaa.

	* gcc.dg/torture/pr69776-2.c: New testcase.

From-SVN: r233453
2016-02-16 15:00:45 +00:00
Richard Biener 1c48bff185 re PR tree-optimization/69776 (Wrong optimization with aliasing)
2016-02-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69776
	* tree-ssa-sccvn.h (vn_reference_lookup): Adjust prototype.
	* tree-ssa-sccvn.c (vn_reference_lookup): Add parameter to
	indicate whether we can use TBAA to disambiguate against stores.
	Use alias-set zero if not.
	(visit_reference_op_store): Do not use TBAA when looking up
	redundant stores.
	* tree-ssa-pre.c (compute_avail): Use TBAA here.
	(eliminate_dom_walker::before_dom_children): But not when looking
	up redundant stores.

	* gcc.dg/torture/pr69776.c: New testcase.

From-SVN: r233418
2016-02-15 08:42:38 +00:00
Richard Biener fa4511c2f4 re PR tree-optimization/69376 (wrong code at -Os and above on x86_64-linux-gnu)
2016-01-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69376
	* tree-ssa-sccvn.h (struct vn_ssa_aux): Add range_info_anti_range_p
	flag.
	(VN_INFO_ANTI_RANGE_P): New inline.
	(VN_INFO_RANGE_TYPE): Likewise.
	* tree-ssa-sccvn.c (set_ssa_val_to): Also record and copy
	SSA_NAME_ANTI_RANGE_P.
	(free_scc_vn): Restore SSA_NAME_ANTI_RANGE_P.
	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
	Properly query VN_INFO_RANGE_TYPE.

	* gcc.dg/torture/pr69376.c: New testcase.

From-SVN: r232786
2016-01-25 09:05:47 +00:00
Richard Biener fac40b023f re PR tree-optimization/69378 (FAIL: g++.dg/tree-ssa/pr61034.C)
2016-01-21  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/69378
	* tree-ssa-sccvn.c (dominated_by_p_w_unex): New function.
	(set_ssa_val_to): Use it for dominance checks taking into
	account not executable edges.

From-SVN: r232666
2016-01-21 08:50:38 +00:00
Richard Biener dd6f2cf98c re PR target/69345 (459.GemsFDTD regression)
2016-01-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69345
	* tree-ssa-sccvn.h (VN_INFO_RANGE_INFO): New inline function.
	(VN_INFO_PTR_INFO): Likewise.
	* tree-ssa-sccvn.c (set_ssa_val_to): Avoid clearing points-to
	info when it is equal between non-dominating SSA names.
	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
	Make sure to look at original SSA infos.

From-SVN: r232603
2016-01-20 08:36:32 +00:00
Richard Biener e93c66bc45 re PR tree-optimization/69117 (wrong code at -O1 -fstrict-aliasing)
2016-01-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69117
	* tree-ssa-sccvn.h (struct vn_ssa_aux): Add info member.
	* tree-ssa-sccvn.c (set_ssa_val_to): Save and adjust SSA name info
	of the leader conservatively.
	(free_scc_vn): Restore original SSA name infos.

	* gcc.dg/torture/pr69117.c: New testcase.

From-SVN: r232401
2016-01-15 08:16:08 +00:00
Richard Biener 40311329e5 re PR tree-optimization/69242 (ICE in visit_reference_op_load, at tree-ssa-sccvn.c:3224)
2016-01-13  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69242
	* tree-ssa-sccvn.c (visit_reference_op_load): Replace bogus
	assert with a check.

	* gcc.dg/torture/pr69242.c: New testcase.

From-SVN: r232315
2016-01-13 08:27:42 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Jeff Law 3daacdcd5f re PR tree-optimization/68619 (error: loop with header 6 not in loop tree)
2015-12-10  Jeff Law  <law@redhat.com>

	PR tree-optimization/68619
	* tree-ssa-dom.c (dom_opt_dom_walker::before_dom_children): Propgate
	return value from optimize_stmt.
	(dom_opt_dom_walker): Add new argument to dom_walker constructor.
	(pass_dominator:execute): If a block has an unreachable edge,
	remove all jump threads through any successor of the affected block.
	(record_equivalences_from_phis): Ignore alternative if the edge
	does not have EDGE_EXECUTABLE set.
	(single_incoming_edge_ignoring_loop_edges): Similarly.
	(optimize_stmt): If a gimple_code has a compile-time constant
	condition, return the edge taken for that constant value.  Also
	change the condition to true/false as necessary.
	* domwalk.h (dom_walker::dom_walker): Add new argument
	skip_unreachable_blocks.  Don't provide empty constructor body.
	(dom_walker::before_dom_children): Change return type.
	(dom_walker::bb_reachable): Declare new private method.
	(dom_walker::propagate_unreachable_to_edges): Likewise.
	(dom_walker::m_unreachable_dom): Declare new private data member.
	(dom_walker::m_skip_unreachable_blocks): Likewise.
	* domwalk.c: Include dumpfile.h.
	(dom_walker::dom_walker): New constructor.  Initialize private data
	members.  If needed, set EDGE_EXECUTABLE for all edges in the CFG,
	extracted from tree-ssa-sccvn.c.
	(dom_walker::bb_reachable): New method extracted from tree-ssa-sccvn.c
	(dom_walker::propagate_unreachable_to_edges): Likewise.
	(dom_walker::walk): Only call before_dom_children on reachable
	blocks.  If before_dom_children returns an edge, then clear
	EDGE_EXECUTABLE for all other outgoing edges from the same block.
	For unreachable blocks, call propagate_unreachable_to_edges.
	Similarly, only call after_dom_children on reachable blocks.  For
	unreachable blocks, conditionally clear m_unreachable_dom.
	* tree-ssa-sccvn.c (sccvn_dom_walker::unreachable_dom): Remove
	private data member.
	(sccvn_dom_walker::after_dom_children): Use methods from dom_walker
	class.
	(run_scc_vn): Likewise.
	(sccvn_dom_walker::before_dom_children): Likewise.  Return the taken
	outgoing edge if a COND, SWITCH, or GOTO are optimized.
	* compare-elim.c (find_comparison_dom_walker::before_dom_children):
	Change return type to an edge.  Always return NULL.
	* fwprop.c (single_def_use_dom_walker::before_dom_children): Likewise.
	* gimple-ssa-strength-reduction.c
	(find_candidates_dom_walker::before_dom_children): Likewise.
	* ipa-prop.c (analysis_dom_walker::before_dom_children): Likewise.
	(ipcp_modif_dom_walker::before_dom_children): Likewise.
	* tree-into-ssa.c (rewrite_dom_walker::before_dom_children): Likewise.
	(rewrite_update_dom_walker::before_dom_children): Likewise.
	(mark_def_dom_children::before_dom_children): Likewise.
	* tree-ssa-dse.c (dse_dom_walker::before_dom_children): Likewise.
	* tree-ssa-loop-im.c
	(invariantness_dom_walker::before_dom_children): Likewise.
	(move_computations_dom_walker::before_dom_walker): Likewise.
	* tree-ssa-phiopt.c
	(nontrapping_dom_walker::before_dom_children): Likewise.
	* tree-ssa-pre.c
	(eliminate_dom_walker::before_dom_children): Likewise.
	* tree-ssa-propagate.c
	(substitute_and_fold_dom_walker::before_dom_children): Likewise.
	* tree-ssa-strlen.c
	(strlen_dom_walker::before_dom_children): Likewise.
	* tree-ssa-uncprop.c
	(uncprop_dom_walker::before_dom_children): Likewise.

	PR tree-optimization/68619
	* gcc.dg/tree-ssa/pr68619-1.c: New test.
	* gcc.dg/tree-ssa/pr68619-2.c: New test.
	* gcc.dg/tree-ssa/pr68619-3.c: New test.
	* gcc.dg/tree-ssa/pr68619-4.c: New test.
	* gcc.dg/tree-ssa/pr68619-5.c: New test.

From-SVN: r231527
2015-12-10 09:34:43 -07:00
Jakub Jelinek 1ff0a84c3d re PR middle-end/68785 (valgrind reports issues with folding on x86_64)
PR tree-optimization/68785
	* gimple-fold.c (fold_ctor_reference): Pass return value from
	native_encode_expr to native_interpret_expr.
	* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Likewise.

	* gcc.dg/pr68785.c: New test.

From-SVN: r231499
2015-12-10 11:14:38 +01:00
Richard Biener 1d6e77c504 tree-ssa-sccvn.c (sccvn_dom_walker): Add unreachable_dom member and initialize it.
2015-12-04  Richard Biener  <rguenther@suse.de>

	* tree-ssa-sccvn.c (sccvn_dom_walker): Add unreachable_dom
	member and initialize it.
	(sccvn_dom_walker::after_dom_children): Reset unreachable_dom
	if necessary.
	(sccvn_dom_walker::before_dom_children): If unreachable_dom
	is set BB is not reachable either.  Set unreachable_dom
	if not set and BB is unreachable.

From-SVN: r231262
2015-12-04 12:32:26 +00:00
Richard Biener 8ab1d9d72c re PR middle-end/68221 (libgomp reduction-11/12 failures)
2015-11-24  Richard Biener  <rguenther@suse.de>

	PR middle-end/68221
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Properly
	use mem_ref_offset.

From-SVN: r230793
2015-11-24 09:17:40 +00:00
Richard Biener 3789bf8412 re PR tree-optimization/68465 (pass_lim doesn't detect identical loop entry conditions)
2015-11-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/68465
	* tree-ssa-sccvn.c (sccvn_dom_walker::before_dom_children):
	Also record equalities from multiple predecessor blocks if
	only one non-backedge exists.

	* gcc.dg/tree-ssa/ssa-fre-52.c: New testcase.

From-SVN: r230764
2015-11-23 15:21:32 +00:00