1. 03 Jul, 2017 26 commits
    • re PR rtl-optimization/81290 (ICE in update_br_prob_note) · 2f70a979
      
      	PR middle-end/81290
      	* predict.c (force_edge_cold): Be more careful about propagation
      	backward.
      	* profile-count.h (profile_probability::guessed,
      	profile_probability::fdo, profile_count::guessed, profile_count::fdo):
      	New.
      	* tree-ssa-threadupdate.c (recompute_probabilities): Result is guessed.
      
      	* gcc.c-torture/compile/pr81290.c: New.
      
      From-SVN: r249924
      Jan Hubicka committed
    • Andrew pointed out that I did not document the new architecture extension flag I… · d31415ba
      Andrew pointed out that I did not document the new architecture extension flag I added for the RcPc extension.
      
      Andrew pointed out that I did not document the new architecture extension
      flag I added for the RcPc extension. This was intentional, as enabling the
      rcpc extension does not change GCC code generation, and is just
      an assembler flag. But for completeness, here is documentation for the
      new option.
      
      gcc/
      
      2017-07-03  James Greenhalgh  <james.greenhalgh@arm.com>
      
      	* doc/invoke.texi (rcpc architecture extension): Document it.
      
      From-SVN: r249923
      James Greenhalgh committed
    • configure.ac: Set srcdir when sourcing config-lang.in fragments. · d4360477
      	* configure.ac: Set srcdir when sourcing config-lang.in fragments.
      	* configure: Rebuilt.
      
      	gcc/objcp/
      	* config-lang.in: Source cp/config-lang.in, sort objc++ gtfiles list.
      
      From-SVN: r249922
      Nathan Sidwell committed
    • Readd myself as c6x maintainer. · 9dc9ae74
      From-SVN: r249920
      Bernd Schmidt committed
    • re PR tree-optimization/60510 (SLP blocks loop vectorization (with reduction)) · 6b5e165b
      2017-07-03  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/60510
      	* tree-vect-loop.c (vect_create_epilog_for_reduction): Pass in
      	the scalar reduction PHI and use it.
      	(vectorizable_reduction): Properly guard the single_defuse_cycle
      	path for non-SLP reduction chains where we cannot use it.
      	Rework reduc_def/index and vector type deduction.  Rework
      	vector operand gathering during reduction op code-gen.
      	* tree-vect-slp.c (vect_analyze_slp): For failed SLP reduction
      	chains dissolve the chain and leave it to non-SLP reduction
      	handling.
      
      	* gfortran.dg/vect/pr60510.f: New testcase.
      
      From-SVN: r249919
      Richard Biener committed
    • Fix secure_getenv.h include in plugin-hsa.c · 9607b014
      2017-07-03  Tom de Vries  <tom@codesourcery.com>
      
      	* plugin/plugin-hsa.c: Fix secure_getenv.h include.
      
      From-SVN: r249918
      Tom de Vries committed
    • Add a helper for getting the overall alignment of a DR · 25f68d90
      This combines the information from previous patches to give a guaranteed
      alignment for the DR as a whole.  This should be a bit safer than using
      base_element_aligned, since that only really took the base into account
      (not the init or offset).
      
      2017-07-03  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* tree-data-ref.h (dr_alignment): Declare.
      	* tree-data-ref.c (dr_alignment): New function.
      	* tree-vectorizer.h (dataref_aux): Remove base_element_aligned.
      	* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Don't
      	set it.
      	* tree-vect-stmts.c (vectorizable_store): Use dr_alignment.
      
      From-SVN: r249917
      Richard Sandiford committed
    • Add DR_BASE_ALIGNMENT and DR_BASE_MISALIGNMENT · bb642979
      This patch records the base alignment and misalignment in
      innermost_loop_behavior, to avoid the second-guessing that was
      previously done in vect_compute_data_ref_alignment.  It also makes
      vect_analyze_data_refs use dr_analyze_innermost, instead of having an
      almost-copy of the same code.
      
      I wasn't sure whether the alignments should be measured in bits
      (for consistency with most other interfaces) or in bytes (for consistency
      with DR_ALIGNED_TO, now DR_OFFSET_ALIGNMENT, and with *_ptr_info_alignment).
      I went for bytes because:
      
      - I think in practice most consumers are going to want bytes.
        E.g. using bytes avoids having to mix TYPE_ALIGN and TYPE_ALIGN_UNIT
        in vect_compute_data_ref_alignment.
      
      - It means that any bit-level paranoia is dealt with when building
        the innermost_loop_behavior and doesn't get pushed down to consumers.
      
      2017-07-03  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* tree-data-ref.h (innermost_loop_behavior): Add base_alignment
      	and base_misalignment fields.
      	(DR_BASE_ALIGNMENT, DR_BASE_MISALIGNMENT): New macros.
      	* tree-data-ref.c: Include builtins.h.
      	(dr_analyze_innermost): Set up the new innmost_loop_behavior fields.
      	* tree-vectorizer.h (STMT_VINFO_DR_BASE_ALIGNMENT): New macro.
      	(STMT_VINFO_DR_BASE_MISALIGNMENT): Likewise.
      	* tree-vect-data-refs.c: Include tree-cfg.h.
      	(vect_compute_data_ref_alignment): Use the new innermost_loop_behavior
      	fields instead of calculating an alignment here.
      	(vect_analyze_data_refs): Use dr_analyze_innermost.  Dump the new
      	innermost_loop_behavior fields.
      
      From-SVN: r249916
      Richard Sandiford committed
    • Add DR_STEP_ALIGNMENT · 832b4117
      A later patch adds base alignment information to innermost_loop_behavior.
      After that, the only remaining piece of alignment information that wasn't
      immediately obvious was the step alignment.  Adding that allows a minor
      simplification to vect_compute_data_ref_alignment, and also potentially
      improves the handling of variable strides for outer loop vectorisation.
      A later patch will also use it to give the alignment of the DR as a whole.
      
      2017-07-03  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* tree-data-ref.h (innermost_loop_behavior): Add a step_alignment
      	field.
      	(DR_STEP_ALIGNMENT): New macro.
      	* tree-vectorizer.h (STMT_VINFO_DR_STEP_ALIGNMENT): Likewise.
      	* tree-data-ref.c (dr_analyze_innermost): Initalize step_alignment.
      	(create_data_ref): Print it.
      	* tree-vect-stmts.c (vectorizable_load): Use the step alignment
      	to tell whether the step preserves vector (mis)alignment.
      	* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Likewise.
      	Move the check for an integer step and generalise to all INTEGER_CST.
      	(vect_analyze_data_refs): Set DR_STEP_ALIGNMENT when setting DR_STEP.
      	Print the outer step alignment.
      
      From-SVN: r249915
      Richard Sandiford committed
    • Rename DR_ALIGNED_TO to DR_OFFSET_ALIGNMENT · e054a185
      This patch renames DR_ALIGNED_TO to DR_OFFSET_ALIGNMENT, to avoid
      confusion with the upcoming DR_BASE_ALIGNMENT.  Nothing needed the
      value as a tree, and the value is clipped to BIGGEST_ALIGNMENT
      (maybe it should be MAX_OFILE_ALIGNMENT?) so we might as well use
      an unsigned int instead.
      
      2017-07-03  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* tree-data-ref.h (innermost_loop_behavior): Replace aligned_to
      	with offset_alignment.
      	(DR_ALIGNED_TO): Delete.
      	(DR_OFFSET_ALIGNMENT): New macro.
      	* tree-vectorizer.h (STMT_VINFO_DR_ALIGNED_TO): Delete.
      	(STMT_VINFO_DR_OFFSET_ALIGNMENT): New macro.
      	* tree-data-ref.c (dr_analyze_innermost): Update after above changes.
      	(create_data_ref): Likewise.
      	* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Likewise.
      	(vect_analyze_data_refs): Likewise.
      	* tree-if-conv.c (if_convertible_loop_p_1): Use memset before
      	creating dummy innermost behavior.
      
      From-SVN: r249914
      Richard Sandiford committed
    • Make dr_analyze_innermost operate on innermost_loop_behavior · abbe3756
      This means that callers to dr_analyze_innermost don't need a full
      data_reference and don't need to fill in any fields beforehand.
      
      2017-07-03  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* tree-data-ref.h (dr_analyze_innermost): Replace the dr argument
      	with a "innermost_loop_behavior *" and refeence tree.
      	* tree-data-ref.c (dr_analyze_innermost): Likewise.
      	(create_data_ref): Update call accordingly.
      	* tree-predcom.c (find_looparound_phi): Likewise.
      
      From-SVN: r249913
      Richard Sandiford committed
    • Require ifunc support in gcc.target/i386/mvc6.c · d8ac7e28
      	* gcc.target/i386/mvc6.c: Require ifunc support.
      
      From-SVN: r249912
      Rainer Orth committed
    • Use innermost_loop_behavior for outer loop vectorisation · 3f5e8a76
      This patch replaces the individual stmt_vinfo dr_* fields with
      an innermost_loop_behavior, so that the changes in later patches
      get picked up automatically.  It also adds a helper function for
      getting the behavior of a data reference wrt the vectorised loop.
      
      2017-07-03  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* tree-vectorizer.h (_stmt_vec_info): Replace individual dr_*
      	fields with dr_wrt_vec_loop.
      	(STMT_VINFO_DR_BASE_ADDRESS, STMT_VINFO_DR_INIT, STMT_VINFO_DR_OFFSET)
      	(STMT_VINFO_DR_STEP, STMT_VINFO_DR_ALIGNED_TO): Update accordingly.
      	(STMT_VINFO_DR_WRT_VEC_LOOP): New macro.
      	(vect_dr_behavior): New function.
      	(vect_create_addr_base_for_vector_ref): Remove loop parameter.
      	* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Use
      	vect_dr_behavior.  Use a step_preserves_misalignment_p boolean to
      	track whether the step preserves the misalignment.
      	(vect_create_addr_base_for_vector_ref): Remove loop parameter.
      	Use vect_dr_behavior.
      	(vect_setup_realignment): Update call accordingly.
      	(vect_create_data_ref_ptr): Likewise.  Use vect_dr_behavior.
      	* tree-vect-loop-manip.c (vect_gen_prolog_loop_niters): Update
      	call to vect_create_addr_base_for_vector_ref.
      	(vect_create_cond_for_align_checks): Likewise.
      	* tree-vect-patterns.c (vect_recog_bool_pattern): Copy
      	STMT_VINFO_DR_WRT_VEC_LOOP as a block.
      	(vect_recog_mask_conversion_pattern): Likewise.
      	* tree-vect-stmts.c (compare_step_with_zero): Use vect_dr_behavior.
      	(new_stmt_vec_info): Remove redundant zeroing.
      
      From-SVN: r249911
      Richard Sandiford committed
    • [arm] Clean up generation of BE8 format images. · 63d03dce
      The existing code in arm/bpabi.h was quite fragile and relied on matching
      specific CPU and/or architecture names.  The introduction of the option
      format for -mcpu and -march broke that in a way that would be non-trivial
      to fix by updating the list.  The hook in that file was always a pain
      as it required every new CPU being added to be add an update here as well
      (easy to miss).
      
      I've fixed that problem once and for all by adding a new callback into
      the driver to select the correct BE8 behaviour.  This uses features in
      the ISA capabilities list to select whether or not to use BE8 format
      during linking.
      
      I also noticed that if the user happened to pass both -mbig-endian and
      -mlittle-endian on the command line then the linker spec rules would
      get somewhat confused and potentially do the wrong thing.  I've fixed that
      by marking these options as opposites in the option descriptions.  The
      driver will now automatically suppress overridden options leading to the
      correct desired behavior.
      
      Whilst fixing this I noticed a couple of anomolus cases in the
      existing BE8 support: we were not generating BE8 format for ARMv6 or
      ARMv7-R targets.  While the ARMv6 status was probably deliberate at
      the time, this is probably not a good idea in the long term as the
      alternative, BE32, has been deprecated by ARM.  After discussion with
      a couple of colleagues I've decided to change this, but to then add an
      option to restore the existing behaviour at the user's option.  So
      this patch introduces two new options (opposites) -mbe8 and -mbe32.
      
      This is a quiet behavior change, so I'll add a comment to the release
      notes shortly.
      
      	* common/config/arm/arm-common.c (arm_be8_option): New function.
      	* config/arm/arm-isa.h (isa_feature): Add new feature bit isa_bit_be8.
      	(ISA_ARMv6): Add isa_bit_be8.
      	* config/arm/arm.h (arm_be8_option): Add prototype.
      	(BE8_SPEC_FUNCTION): New define.
      	(EXTRA_SPEC_FUNCTIONS): Add BE8_SPEC_FUNCTION.
      	* config/arm/arm.opt (mbig-endian): Mark as Negative of mlittle-endian.
      	(mlittle-endian): Similarly.
      	(mbe8, mbe32): New options.
      	* config/arm/bpabi.h (BE8_LINK_SPEC): Call arm_be8_option.
      	* doc/invoke.texi (ARM Options): Document -mbe8 and -mbe32.
      
      From-SVN: r249909
      Richard Earnshaw committed
    • * tree-cfg.c (gimple_find_sub_bbs): Fix profile updating. · e1a921dd
      From-SVN: r249908
      Jan Hubicka committed
    • tree-cfgcleanup.c (want_merge_blocks_p): New function. · b5db8b44
      
      	* tree-cfgcleanup.c (want_merge_blocks_p): New function.
              (cleanup_tree_cfg_bb): Use it.
      	* profile-count.h (profile_count::of_for_merging, profile_count::merge):
      	New functions.
      	* tree-cfg.c (gimple_merge_blocks): Use profile_count::merge.
      
      From-SVN: r249907
      Jan Hubicka committed
    • re PR target/81285 (r249888 breaks bootstrap on ppc64le) · edfe99a4
      
      	PR bootstrap/81285
      	* loop-doloop.c (add_test): Update profile.
      
      From-SVN: r249904
      Jan Hubicka committed
    • ASAN: handle addressable params (PR sanitize/81040). · da402967
      2017-07-03  Martin Liska  <mliska@suse.cz>
      
      	PR sanitize/81040
      	* g++.dg/asan/function-argument-1.C: New test.
      	* g++.dg/asan/function-argument-2.C: New test.
      	* g++.dg/asan/function-argument-3.C: New test.
      2017-07-03  Martin Liska  <mliska@suse.cz>
      
      	PR sanitize/81040
      	* sanopt.c (rewrite_usage_of_param): New function.
      	(sanitize_rewrite_addressable_params): Likewise.
      	(pass_sanopt::execute): Call rewrite_usage_of_param.
      
      From-SVN: r249903
      Martin Liska committed
    • tree-vect-loop.c (vect_create_epilog_for_reduction): Revert back to using VIEW_CONVERT_EXPR. · b6d447f2
      2017-07-03  Richard Biener  <rguenther@suse.de>
      
      	* tree-vect-loop.c (vect_create_epilog_for_reduction): Revert
      	back to using VIEW_CONVERT_EXPR.
      
      From-SVN: r249902
      Richard Biener committed
    • Make stack epilogue more efficient · 7b972538
      2017-07-03  Martin Liska  <mliska@suse.cz>
      
      	* asan.c (asan_emit_stack_protection): Unpoison just red zones
      	and shadow memory of auto variables which are subject of
      	use-after-scope sanitization.
      	(asan_expand_mark_ifn): Add do set only when is_poison.
      
      From-SVN: r249900
      Martin Liska committed
    • tree-vect-loop.c (vect_analyze_loop_operations): Also analyze reduction PHIs. · c78e3652
      2016-07-03  Richard Biener  <rguenther@suse.de>
      
      	* tree-vect-loop.c (vect_analyze_loop_operations): Also analyze
      	reduction PHIs.
      	(vect_force_simple_reduction): Record reduction def -> phi mapping.
      	(vectorizable_reduction): Perform reduction PHI creation when
      	visiting a reduction PHI and adjust and simplify code generation
      	phase of the reduction op.  Cache dts, use fold_binary, not fold_build2.
      	(vect_transform_loop): Visit reduction PHIs.
      	* tree-vect-slp.c (vect_get_and_check_slp_defs): Record reduction
      	defs into the SLP tree.
      	(vect_build_slp_tree): Reduction defs terminate the recursion.
      	* tree-vect-stmts.c (vect_get_vec_def_for_operand_1): Allow lookup
      	of reduction defs.
      	(vect_get_vec_defs_for_stmt_copy): Export.
      	(vect_get_vec_defs): Likewise.
      	* tree-vectorizer.h (struct _stmt_vec_info): Amend reduc_def
      	purpose.
      	(vect_get_vec_defs_for_stmt_copy): Declare.
      	(vect_get_vec_defs): Likewise.
      
      From-SVN: r249897
      Richard Biener committed
    • Tweak BB analysis for dr_analyze_innermost · bc9f4235
      dr_analyze_innermost had a "struct loop *nest" parameter that acted
      like a boolean.  This was added in r179161, with the idea that a
      null nest selected BB-level analysis rather than loop analysis.
      
      The handling seemed strange though.  If the DR was part of a loop,
      we still tried to express the base and offset values as IVs, potentially
      giving a nonzero step.  If that failed for any reason, we'd revert to
      using the original base and offset, just as we would if we hadn't asked
      for an IV in the first place.
      
      It seems more natural to use the !in_loop handling whenever nest is null
      and always set the step to zero.  This actually enables one more SLP
      opportunity in bb-slp-pr65935.c.
      
      I checked out r179161 and tried the patch there.  The test case added
      in that revision still passes, so I don't think there was any particular
      need to check simple_iv.
      
      2017-06-28  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* tree-data-ref.c (dr_analyze_innermost): Replace the "nest"
      	parameter with a "loop" parameter and use it instead of the
      	loop containing DR_STMT.  Don't check simple_iv when doing
      	BB analysis.  Describe the two analysis modes in the comment.
      
      gcc/testsuite/
      	* gcc.dg/vect/bb-slp-pr65935.c: Expect SLP to be used in main
      	as well.
      
      From-SVN: r249896
      Richard Sandiford committed
    • Ignore EDGE_{DFS_BACK,EXECUTABLE} in tail-merge · be086ff5
      2017-07-03  Tom de Vries  <tom@codesourcery.com>
      
      	PR tree-optimization/69468
      	* tree-ssa-tail-merge.c (ignore_edge_flags): New constant.
      	(find_same_succ_bb): Handle ignore_edge_flags.
      
      	* gcc.dg/pr81192.c: Update.
      
      From-SVN: r249895
      Tom de Vries committed
    • Don't tail-merge blocks from different loops · 4752be46
      2017-07-03  Tom de Vries  <tom@codesourcery.com>
      
      	PR tree-optimization/81192
      	* tree-ssa-tail-merge.c (same_succ_hash): Use bb->loop_father->num in
      	hash.
      	(same_succ::equal): Don't find bbs to be equal if bb->loop_father
      	differs.
      	(find_same_succ_bb): Remove obsolete test on bb->loop_father->latch.
      
      	* gcc.dg/pr81192.c: Update.
      
      From-SVN: r249894
      Tom de Vries committed
    • Fix sigsegv in find_same_succ_bb · 0bbfd554
      2017-07-03  Tom de Vries  <tom@codesourcery.com>
      
      	PR tree-optimization/81192
      	* tree-ssa-tail-merge.c (same_succ_flush_bb): Handle
      	BB_SAME_SUCC (bb) == NULL.
      
      	* gcc.dg/pr81192.c: New test.
      
      From-SVN: r249893
      Tom de Vries committed
    • Daily bump. · 37623e6c
      From-SVN: r249892
      GCC Administrator committed
  2. 02 Jul, 2017 13 commits
    • cfgrtl.c (rtl_verify_edges): Enable checking of profile_probability consistency. · a4c57f86
      
      	* cfgrtl.c (rtl_verify_edges): Enable checking of profile_probability
      	consistency.
      
      From-SVN: r249888
      Jan Hubicka committed
    • dumpfile.c: Include profile-count.h · 0de11d4d
      
      	* dumpfile.c: Include profile-count.h
      	* tree-cfg.c (gimple_duplicate_sese_tail): Drop UNUSED attributes; update
      	profile.
      	(insert_cond_bb): Update profile.
      	* tree-cfg.h (insert_cond_bb): Update prototype.
      	* tree-chkp-opt.c (chkp_optimize_string_function_calls): Update.
      	* tree-dump.c: Do not include tree-cfg.
      
      From-SVN: r249887
      Jan Hubicka committed
    • * bb-reorder.c (fix_up_crossing_landing_pad): Update profile. · d872853d
      From-SVN: r249886
      Jan Hubicka committed
    • expect.c (dw2_build_landing_pads): Update profile of the landing pad bb. · 57a5a8b3
      	* expect.c (dw2_build_landing_pads): Update profile of the landing pad
      	bb.
      
      From-SVN: r249885
      Jan Hubicka committed
    • * tree-complex.c (expand_complex_div_wide): update profile. · b543d680
      From-SVN: r249884
      Jan Hubicka committed
    • include/ChangeLog · ef29f5dd
      2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
      
              * dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset)
              (DW_IDX_parent, DW_IDX_type_hash, DW_IDX_lo_user, DW_IDX_hi_user)
              (DW_IDX_GNU_internal, DW_IDX_GNU_external): New.
              * dwarf2.h (DW_IDX, DW_IDX_DUP, DW_FIRST_IDX, DW_END_IDX): New.
              (enum dwarf_name_index_attribute): Remove.
              (get_DW_IDX_name): New declaration.
      
      libiberty/ChangeLog
      2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
      
              * dwarfnames.c (DW_FIRST_IDX, DW_END_IDX, DW_IDX, DW_IDX_DUP): New.
      
      From-SVN: r249883
      Jan Kratochvil committed
    • eoshift0.c: For contiguous arrays, use block algorithm. · b677e2f6
      2017-07-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
      
      	* intrinsics/eoshift0.c:  For contiguous arrays, use
      	block algorithm.  Use memcpy where possible.
      
      2017-07-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
      
      	* gfortran/eoshift_3.f90:  New test.
      
      From-SVN: r249882
      Thomas Koenig committed
    • Reorganise machmode.h headers · b0e84cf7
      This patch splits the auto-generated inline functions out of
      insn-modes.h and puts them in a new header file, insn-modes-inline.h.
      It also makes coretypes.h include these files directly, rather than
      indirectly via machmode.h.  This in turn allows insn-modes-inline.h
      and machmode.h to come later in the include list, after wide-int.h.
      This is useful for later patches.
      
      insn-modes.h itself still needs to come first, since it provides
      configuration information like MAX_BITSIZE_MODE_ANY_INT, which is
      used to control the size of a wide_int.
      
      The patch also makes the generator files include machmode.h
      via coretypes.h.  Previously they did it by more indirect means.
      
      Finally, the patch makes wide-int-print.h available via coretypes.h
      too.  There didn't seem to be any reason to force only the print
      routines to be included directly, and it would be painful to extend
      that approach to the SVE patches.
      
      
      [Based on the code ARM contributed in branches/ARM/sve-branch@242100]
      
      2017-07-02  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      contrib/header-tools/
      	* graph-header-logs (ignore): Update coretypes.h header list.
      
      gcc/
      	* Makefile.in (MACHMODE_H): Remove insn-modes.h
      	(CORETYPES_H): New define.
      	(MOSTLYCLEANFILES): Add insn-modes-inline.h.
      	(insn-modes-inline.h, s-modes-inline-h): New rules.
      	(generated_files): Add insn-modes-inline.h.
      	(RTL_BASE_H, TREE_CORE_H): Use CORETYPES_H instead of coretypes.h.
      	(build/gensupport.o, build/ggc-none.o, build/print-rtl.o): Likewise.
      	(build/read-md.o, build/read-rtl.o, build/rtl.o): Likewise.
      	(build/vec.o, build/hash-table.o, build/inchash.o): Likewise.
      	(build/gencondmd.o, build/genattr.o, build/genattr-common.o): Likewise.
      	(build/genattrtab.o, build/genautomata.o, build/gencheck.o): Likewise.
      	(build/gencodes.o, build/genconditions.o): Likewise.
      	(build/genconfig.o, build/genconstants.o, build/genemit.o): Likewise.
      	(build/genenums.o, build/genextract.o, build/genflags.o): Likewise.
      	(build/gentarget-def.o, build/genmddeps.o, build/genopinit.o)
      	(build/genoutput.o, build/genpeep.o, build/genpreds.o): Likewise.
      	(build/genrecog.o, build/genmddump.o, build/genmatch.o): Likewise.
      	(build/gencfn-macros.o, build/gcov-iov.o): Likewise.
      	* coretypes.h: Include everything up to real.h for generators.
      	Include insn-modes.h first.  Include wide-int-print.h after
      	wide-int.h.  Include insn-modes-inline.h and then machmode.h.
      	* machmode.h: Don't include insn-modes.h here.
      	* function-tests.c: Remove includes of signop.h, machmode.h,
      	double-int.h and wide-int.h.
      	* rtl.h: Likewise.
      	* gcc-rich-location.c: Remove includes of machmode.h, double-int.h
      	and wide-int.h.
      	* optc-save-gen.awk: Likewise.
      	* gencheck.c (BITS_PER_UNIT): Delete dummy definition.
      	* godump.c: Remove include of wide-int-print.h.
      	* pretty-print.h: Likewise.
      	* wide-int-print.cc: Likewise.
      	* wide-int.cc: Likewise.
      	* hash-map-tests.c: Remove include of signop.h.
      	* hash-set-tests.c: Likewise.
      	* rtl-tests.c: Likewise.
      	* mkconfig.sh: Remove include of machmode.h.
      	* genmodes.c (emit_insn_modes_h): Split emission of inline functions
      	into...
      	(emit_insn_modes_inline_h): ...this new function.  Emit the code
      	into an insn-modes-inline.h header file, adding appropriate
      	include guards and end comments.
      	(emit_insn_modes_c_header): Remove include of machmode.h.
      	(emit_min_insn_modes_c_header): Include coretypes.h rather than
      	machmode.h.
      	(main): Handle -i flag and call emit_insn_modes_inline_h when
      	it is passed.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r249881
      Richard Sandiford committed
    • Make tree-ssa-strlen.c handle partial unterminated strings · e3f9a279
      tree-ssa-strlen.c looks for cases in which a string is built up using
      operations like:
      
          memcpy (a, "foo", 4);
          memcpy (a + 3, "bar", 4);
          int x = strlen (a);
      
      As a side-effect, it optimises the non-final memcpys so that they don't
      include the nul terminator.
      
      However, after removing some "& ~0x1"s from tree-ssa-dse.c, the DSE pass
      does this optimisation itself (because it can tell that later memcpys
      overwrite the terminators).  The strlen pass wasn't able to handle these
      pre-optimised calls in the same way as the unoptimised ones.
      
      This patch adds support for tracking unterminated strings.
      
      [Based on the code ARM contributed in branches/ARM/sve-branch@246236]
      
      2017-07-02  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* tree-ssa-strlen.c (strinfo): Rename the length field to
      	nonzero_chars.  Add a full_string_p field.
      	(compare_nonzero_chars, zero_length_string_p): New functions.
      	(get_addr_stridx): Add an offset_out parameter.
      	Use compare_nonzero_chars.
      	(get_stridx): Update accordingly.  Use compare_nonzero_chars.
      	(new_strinfo): Update after above changes to strinfo.
      	(set_endptr_and_length): Set full_string_p.
      	(get_string_length): Update after above changes to strinfo.
      	(unshare_strinfo): Update call to new_strinfo.
      	(maybe_invalidate): Likewise.
      	(get_stridx_plus_constant): Change off to unsigned HOST_WIDE_INT.
      	Use compare_nonzero_chars and zero_string_p.  Treat nonzero_chars
      	as a uhwi instead of an shwi.  Update after above changes to
      	strinfo and new_strinfo.
      	(zero_length_string): Assert that chainsi contains full strings.
      	Use zero_length_string_p.  Update call to new_strinfo.
      	(adjust_related_strinfos): Update after above changes to strinfo.
      	Copy full_string_p from origsi.
      	(adjust_last_stmt): Use zero_length_string_p.
      	(handle_builtin_strlen): Update after above changes to strinfo and
      	new_strinfo.  Install the lhs as the string length if the previous
      	entry didn't describe a full string.
      	(handle_builtin_strchr): Update after above changes to strinfo
      	and new_strinfo.
      	(handle_builtin_strcpy): Likewise.
      	(handle_builtin_strcat): Likewise.
      	(handle_builtin_malloc): Likewise.
      	(handle_pointer_plus): Likewise.
      	(handle_builtin_memcpy): Likewise.  Track nonzero characters
      	that aren't necessarily followed by a nul terminator.
      	(handle_char_store): Likewise.
      
      gcc/testsuite/
      	* gcc.dg/strlenopt-32.c: New testcase.
      	* gcc.dg/strlenopt-33.c: Likewise.
      	* gcc.dg/strlenopt-33g.c: Likewise.
      	* gcc.dg/strlenopt-34.c: Likewise.
      	* gcc.dg/strlenopt-35.c: Likewise.
      
      From-SVN: r249880
      Richard Sandiford committed
    • PR 80769: Incorrect strlen optimisation · 862088aa
      In this testcase, we (correctly) record after:
      
        strcpy (p1, "abcde");
        char *p2 = strchr (p1, '\0');
        strcpy (p2, q);
      
      that the length of p1 and p2 can be calculated by converting the
      second strcpy to:
      
        tmp = stpcpy (p2, q)
      
      and then doing tmp - p1 for p1 and tmp - p2 for p2.  This is delayed
      until we know whether we actually need it.  Then:
      
        char *p3 = strchr (p2, '\0');
      
      forces us to calculate the length of p2 in this way.  At this point
      we had three related strinfos:
      
        p1: delayed length, calculated from tmp = stpcpy (p2, q)
        p2: known length, tmp - p2
        p3: known length, 0
      
      After:
      
        memcpy (p3, "x", 2);
      
      we use adjust_related_strinfos to add 1 to each length.  However,
      that didn't do anything for delayed lengths because:
      
      	  else if (si->stmt != NULL)
      	    /* Delayed length computation is unaffected.  */
      	    ;
      
      So after the memcpy we had:
      
        p1: delayed length, calculated from tmp = stpcpy (p2, q)
        p2: known length, tmp - p2 + 1
        p3: known length, 1
      
      where the length of p1 was no longer correct.
      
      2017-05-16  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	PR tree-optimization/80769
      	* tree-ssa-strlen.c (strinfo): Document that "stmt" is also used
      	for malloc and calloc.  Document the new invariant that all related
      	strinfos have delayed lengths or none do.
      	(verify_related_strinfos): Move earlier in file.
      	(set_endptr_and_length): New function, split out from...
      	(get_string_length): ...here.  Also set the lengths of related
      	strinfos.
      	(zero_length_string): Assert that chainsi has known (rather than
      	delayed) lengths.
      	(adjust_related_strinfos): Likewise.
      
      gcc/testsuite/
      	PR tree-optimization/80769
      	* gcc.dg/strlenopt-31.c: New test.
      	* gcc.dg/strlenopt-31g.c: Likewise.
      
      From-SVN: r249879
      Richard Sandiford committed
    • PR81136: ICE from inconsistent DR_MISALIGNMENTs · c34d0927
      The test case triggered this assert in vect_update_misalignment_for_peel:
      
            gcc_assert (DR_MISALIGNMENT (dr) / dr_size ==
                        DR_MISALIGNMENT (dr_peel) / dr_peel_size);
      
      The problem was that:
      
      - one memory reference guaranteed a high base alignment, when considering
        that reference in isolation.  This meant that we could calculate the
        vector misalignment for its DR at compile time.
      
      - the other memory reference only guaranteed a low base alignment,
        when considering that reference in isolation.  We therefore couldn't
        calculate the vector misalignment for its DR at compile time.
      
      - when looking at the values of the two addresses as a pair (rather
        than the memory references), it was obvious that they had the same
        misalignment, whatever that misalignment happened to be.
      
      This is working as designed, so the patch restricts the assert to cases
      in which both addresses have a compile-time misalignment.
      
      In the test case this looks like a missed opportunity.  Both references
      are unconditional, so it should be possible to use the highest of the
      available base alignment guarantees when analyzing each reference.
      A later patch does this, but the problem would still remain for
      conditional references.
      
      2017-07-02  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	PR tree-optimization/81136
      	* tree-vect-data-refs.c (vect_update_misalignment_for_peel): Only
      	assert that two references with the same misalignment have the same
      	compile-time misalignment if those compile-time misalignments
      	are known.
      
      gcc/testsuite/
      	PR tree-optimization/81136
      	* gcc.dg/vect/pr81136.c: New test.
      
      From-SVN: r249878
      Richard Sandiford committed
    • Always print attributes when dumping tree · 86ae8a3d
      A tree type dump currently doesn't print the attributes. Since we have
      so many now and they do many interesting things dumping them can be
      useful. So dump them by default for tree type dumps.
      
      gcc/:
      
      2017-07-01  Andi Kleen  <ak@linux.intel.com>
      
              * print-tree.c (print_node): Print all attributes.
      
      From-SVN: r249877
      Andi Kleen committed
    • Daily bump. · 01be4b2d
      From-SVN: r249876
      GCC Administrator committed
  3. 01 Jul, 2017 1 commit
    • cfg.c (scale_bbs_frequencies): New function. · af2bbc51
      	* cfg.c (scale_bbs_frequencies): New function.
      	* cfg.h (scale_bbs_frequencies): Declare it.
      	* cfgloopanal.c (single_likely_exit): Cleanup.
      	* cfgloopmanip.c (scale_loop_frequencies): Take profile_probability
      	as parameter.
      	(scale_loop_profile): Likewise.
      	(loop_version): Likewise.
      	(create_empty_loop_on_edge): Update.
      	* cfgloopmanip.h (scale_loop_frequencies, scale_loop_profile,
      	scale_loop_frequencies, scale_loop_profile, loopify,
      	loop_version): Update prototypes.
      	* modulo-sched.c (sms_schedule): Update.
      	* predict.c (unlikely_executed_edge_p): Also check probability.
      	(probably_never_executed_edge_p): Fix typo.
      	* tree-if-conv.c (version_loop_for_if_conversion): Update.
      	* tree-parloops.c (gen_parallel_loop): Update.
      	* tree-ssa-loop-ivcanon.c (try_peel_loop): Update.
      	* tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Update.
      	* tree-ssa-loop-split.c (split_loop): Update.
      	* tree-ssa-loop-unswitch.c (tree_unswitch_loop): Update.
      	* tree-vect-loop-manip.c (vect_do_peeling): Update.
      	(vect_loop_versioning): Update.
      	* tree-vect-loop.c (scale_profile_for_vect_loop): Update.
      
      From-SVN: r249872
      Jan Hubicka committed