1. 26 Apr, 2016 19 commits
    • match.pd: u + 3 < u is u > UINT_MAX - 3 · ca1206be
      2016-04-26  Marc Glisse  <marc.glisse@inria.fr>
      
      gcc/
      	* match.pd (X + CST CMP X): New transformation.
      
      gcc/testsuite/
      	* gcc.dg/tree-ssa/overflow-1.c: New testcase.
      
      From-SVN: r235448
      Marc Glisse committed
    • re PR c/70791 (-Wnested-externs prints inconsistent column number) · b02a5e26
      	PR c/70791
      	* c-decl.c (pushdecl): Pass LOCUS down to warning.
      
      	* gcc.dg/Wnested-externs-2.c: New test.
      
      From-SVN: r235447
      Marek Polacek committed
    • re PR c/67784 (Incorrect parsing when using declarations in for loops and typedefs) · 2448a956
      	PR c/67784
      	* c-parser.c (c_parser_maybe_reclassify_token): New function factored
      	out of ...
      	(c_parser_for_statement): ... here.
      	(c_parser_if_statement): Use it.
      	(c_parser_switch_statement): Use it.
      	(c_parser_while_statement): Use it.
      
      	* gcc.dg/pr67784-3.c: New test.
      	* gcc.dg/pr67784-4.c: New test.
      	* gcc.dg/pr67784-5.c: New test.
      
      From-SVN: r235446
      Marek Polacek committed
    • match.pd: X + X --> X * 2 for integers · 6b6aa8d3
      2016-04-26  Marc Glisse  <marc.glisse@inria.fr>
      
      gcc/
      	* genmatch.c (write_predicate): Add ATTRIBUTE_UNUSED.
      	* fold-const.c (fold_binary_loc): Remove 2 transformations
      	superseded by match.pd.
      	* match.pd (x+x -> x*2): Generalize to integers.
      
      gcc/testsuite/
      	* gcc.dg/fold-plusmult.c: Adjust.
      	* gcc.dg/no-strict-overflow-6.c: Adjust.
      	* gcc.dg/gomp/loop-1.c: Xfail some tests.
      
      From-SVN: r235444
      Marc Glisse committed
    • i386: Add a variant peephole for lea rather than ops that clobber CC. · a84454dc
      	* config/i386/i386.md (operation on memory peephole): Duplicate an
      	existing peephole and adapt it to match lea rather than an operation
      	that clobbers CC.
      
      From-SVN: r235443
      Bernd Schmidt committed
    • Enable -frename-registers at -O2. · 1d776c5f
      	PR rtl-optimization/57193
      	* opts.c (default_options_table): Add OPT_frename_registers at -O2
      	and above.
      	* doc/invoke.texi (-frename-registers, -O2): Update documentation.
      
      From-SVN: r235442
      Bernd Schmidt committed
    • Fix x86 testcases for -frename-registers. · a2095b55
      	* gcc.target/i386/avx512bw-vptestmb-1.c: Correct [xyz]mm register
      	number scans.
      	* gcc.target/i386/avx512bw-vptestmw-1.c: Likewise.
      	* gcc.target/i386/avx512bw-vptestnmb-1.c: Likewise.
      	* gcc.target/i386/avx512bw-vptestnmw-1.c: Likewise.
      	* gcc.target/i386/avx512cd-vpbroadcastmb2q-1.c: Likewise.
      	* gcc.target/i386/avx512cd-vpbroadcastmw2d-1.c: Likewise.
      	* gcc.target/i386/avx512dq-vfpclasspd-1.c: Likewise.
      	* gcc.target/i386/avx512dq-vfpclassps-1.c: Likewise.
      	* gcc.target/i386/avx512dq-vinsertf64x2-1.c: Likewise.
      	* gcc.target/i386/avx512dq-vinserti64x2-1.c: Likewise.
      	* gcc.target/i386/avx512f-gather-5.c: Likewise.
      	* gcc.target/i386/avx512f-vptestmd-1.c: Likewise.
      	* gcc.target/i386/avx512f-vptestmq-1.c: Likewise.
      	* gcc.target/i386/avx512f-vptestnmd-1.c: Likewise.
      	* gcc.target/i386/avx512f-vptestnmq-1.c: Likewise.
      	* gcc.target/i386/avx512f-vrndscaleps-1.c: Likewise.
      	* gcc.target/i386/avx512vl-vpbroadcastmb2q-1.c: Likewise.
      	* gcc.target/i386/avx512vl-vpbroadcastmw2d-1.c: Likewise.
      	* gcc.target/i386/avx512vl-vptestmd-1.c: Likewise.
      	* gcc.target/i386/avx512vl-vptestmq-1.c: Likewise.
      	* gcc.target/i386/avx512vl-vptestnmd-1.c: Likewise.
      	* gcc.target/i386/avx512vl-vptestnmq-1.c: Likewise.
      	* gcc.target/i386/pr32219-2.c: Allow registers other than %eax in
      	scans.
      	* gcc.target/i386/pr32219-4.c: Likewise.
      	* gcc.target/i386/pr32219-6.c: Likewise.
      	* gcc.target/i386/pr32219-8.c: Likewise.
      
      From-SVN: r235441
      Bernd Schmidt committed
    • Fix FAIL: gcc.dg/tree-ssa/minmax-2.c scan-tree-dump optimized "__builtin_fmin" · bb0cc5c8
      	* gcc.dg/tree-ssa/minmax-2.c: Require c99_runtime and add the
      	associated options.
      
      From-SVN: r235440
      Kyrylo Tkachov committed
    • Verify __builtin_unreachable and __builtin_trap are not called with arguments · 83f5f27d
      2016-04-26  Martin Jambor  <mjambor@suse.cz>
      
      	* tree-cfg.c (verify_gimple_call): Check that calls to
      	__builtin_unreachable or __builtin_trap do not have actual arguments.
      
      From-SVN: r235439
      Martin Jambor committed
    • Bootstrapped/regtested on x86_64-linux, ok for trunk? · 5a0802ea
      2016-04-25  Marek Polacek  <polacek@redhat.com>
      
      	PR c++/70744
      	* call.c (build_conditional_expr_1): Call cp_stabilize_reference
      	instead of stabilize_reference.
      	(build_over_call): Likewise.
      	* cp-tree.h (cp_stabilize_reference): Declare.
      	* tree.c (cp_stabilize_reference): New function.
      	* typeck.c (cp_build_unary_op): Call cp_stabilize_reference instead of
      	stabilize_reference.
      	(unary_complex_lvalue): Likewise.
      	(cp_build_modify_expr): Likewise.
      
      	* g++.dg/ext/cond2.C: New test.
      
      diff --git gcc/cp/call.c gcc/cp/call.c
      index 11f2d42..476e806 100644
      --- gcc/cp/call.c
      +++ gcc/cp/call.c
      @@ -4634,7 +4634,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
       
             /* Make sure that lvalues remain lvalues.  See g++.oliva/ext1.C.  */
             if (real_lvalue_p (arg1))
      -	arg2 = arg1 = stabilize_reference (arg1);
      +	arg2 = arg1 = cp_stabilize_reference (arg1);
             else
       	arg2 = arg1 = save_expr (arg1);
           }
      @@ -7644,8 +7644,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
       	       || (TREE_CODE (arg) == TARGET_EXPR
       		   && !unsafe_copy_elision_p (fa, arg)))
       	{
      -	  tree to = stabilize_reference (cp_build_indirect_ref (fa, RO_NULL,
      -								complain));
      +	  tree to = cp_stabilize_reference (cp_build_indirect_ref (fa,
      +								   RO_NULL,
      +								   complain));
       
       	  val = build2 (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
       	  return val;
      @@ -7655,7 +7656,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
       	   && trivial_fn_p (fn)
       	   && !DECL_DELETED_FN (fn))
           {
      -      tree to = stabilize_reference
      +      tree to = cp_stabilize_reference
       	(cp_build_indirect_ref (argarray[0], RO_NULL, complain));
             tree type = TREE_TYPE (to);
             tree as_base = CLASSTYPE_AS_BASE (type);
      diff --git gcc/cp/cp-tree.h gcc/cp/cp-tree.h
      index ec92718..0e46ae1 100644
      --- gcc/cp/cp-tree.h
      +++ gcc/cp/cp-tree.h
      @@ -6494,6 +6494,7 @@ extern cp_lvalue_kind real_lvalue_p		(const_tree);
       extern cp_lvalue_kind lvalue_kind		(const_tree);
       extern bool lvalue_or_rvalue_with_address_p	(const_tree);
       extern bool xvalue_p	                        (const_tree);
      +extern tree cp_stabilize_reference		(tree);
       extern bool builtin_valid_in_constant_expr_p    (const_tree);
       extern tree build_min				(enum tree_code, tree, ...);
       extern tree build_min_nt_loc			(location_t, enum tree_code,
      diff --git gcc/cp/tree.c gcc/cp/tree.c
      index 112c8c7..137186f 100644
      --- gcc/cp/tree.c
      +++ gcc/cp/tree.c
      @@ -296,6 +296,46 @@ xvalue_p (const_tree ref)
         return (lvalue_kind (ref) == clk_rvalueref);
       }
       
      +/* C++-specific version of stabilize_reference.  */
      +
      +tree
      +cp_stabilize_reference (tree ref)
      +{
      +  switch (TREE_CODE (ref))
      +    {
      +    /* We need to treat specially anything stabilize_reference doesn't
      +       handle specifically.  */
      +    case VAR_DECL:
      +    case PARM_DECL:
      +    case RESULT_DECL:
      +    CASE_CONVERT:
      +    case FLOAT_EXPR:
      +    case FIX_TRUNC_EXPR:
      +    case INDIRECT_REF:
      +    case COMPONENT_REF:
      +    case BIT_FIELD_REF:
      +    case ARRAY_REF:
      +    case ARRAY_RANGE_REF:
      +    case COMPOUND_EXPR:
      +    case ERROR_MARK:
      +      break;
      +    default:
      +      cp_lvalue_kind kind = lvalue_kind (ref);
      +      if ((kind & ~clk_class) != clk_none)
      +	{
      +	  tree type = unlowered_expr_type (ref);
      +	  bool rval = !!(kind & clk_rvalueref);
      +	  type = cp_build_reference_type (type, rval);
      +	  /* This inhibits warnings in, eg, cxx_mark_addressable
      +	     (c++/60955).  */
      +	  warning_sentinel s (extra_warnings);
      +	  ref = build_static_cast (type, ref, tf_error);
      +	}
      +    }
      +
      +  return stabilize_reference (ref);
      +}
      +
       /* Test whether DECL is a builtin that may appear in a
          constant-expression. */
       
      diff --git gcc/cp/typeck.c gcc/cp/typeck.c
      index cef5604..7e12009 100644
      --- gcc/cp/typeck.c
      +++ gcc/cp/typeck.c
      @@ -5912,7 +5912,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
       	{
       	  tree real, imag;
       
      -	  arg = stabilize_reference (arg);
      +	  arg = cp_stabilize_reference (arg);
       	  real = cp_build_unary_op (REALPART_EXPR, arg, 1, complain);
       	  imag = cp_build_unary_op (IMAGPART_EXPR, arg, 1, complain);
       	  real = cp_build_unary_op (code, real, 1, complain);
      @@ -6112,7 +6112,7 @@ unary_complex_lvalue (enum tree_code code, tree arg)
             tree lvalue = TREE_OPERAND (arg, 0);
             if (TREE_SIDE_EFFECTS (lvalue))
       	{
      -	  lvalue = stabilize_reference (lvalue);
      +	  lvalue = cp_stabilize_reference (lvalue);
       	  arg = build2 (TREE_CODE (arg), TREE_TYPE (arg),
       			lvalue, TREE_OPERAND (arg, 1));
       	}
      @@ -7496,7 +7496,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
           case PREINCREMENT_EXPR:
             if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0)))
       	lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs),
      -		      stabilize_reference (TREE_OPERAND (lhs, 0)),
      +		      cp_stabilize_reference (TREE_OPERAND (lhs, 0)),
       		      TREE_OPERAND (lhs, 1));
             newrhs = cp_build_modify_expr (TREE_OPERAND (lhs, 0),
       				     modifycode, rhs, complain);
      @@ -7516,7 +7516,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
           case MODIFY_EXPR:
             if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0)))
       	lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs),
      -		      stabilize_reference (TREE_OPERAND (lhs, 0)),
      +		      cp_stabilize_reference (TREE_OPERAND (lhs, 0)),
       		      TREE_OPERAND (lhs, 1));
             newrhs = cp_build_modify_expr (TREE_OPERAND (lhs, 0), modifycode, rhs,
       				     complain);
      @@ -7665,7 +7665,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
       	     not intervene between the lvalue-to-rvalue conversion and the
       	     side effect associated with any single compound assignment
       	     operator. -- end note ]  */
      -	  lhs = stabilize_reference (lhs);
      +	  lhs = cp_stabilize_reference (lhs);
       	  rhs = rvalue (rhs);
       	  rhs = stabilize_expr (rhs, &init);
       	  newrhs = cp_build_binary_op (input_location,
      diff --git gcc/testsuite/g++.dg/ext/cond2.C gcc/testsuite/g++.dg/ext/cond2.C
      index e69de29..d9f1d59 100644
      --- gcc/testsuite/g++.dg/ext/cond2.C
      +++ gcc/testsuite/g++.dg/ext/cond2.C
      @@ -0,0 +1,28 @@
      +// PR c++/70744
      +// { dg-do run }
      +// { dg-options "" }
      +
      +static void
      +fn1 (void)
      +{
      +  int x = 2;
      +  ++x ? : 42;
      +  if (x != 3)
      +    __builtin_abort ();
      +  --x ? : 42;
      +  if (x != 2)
      +    __builtin_abort ();
      +  x++ ? : 42;
      +  if (x != 3)
      +    __builtin_abort ();
      +  x-- ? : 42;
      +  if (x != 2)
      +    __builtin_abort ();
      +}
      +
      +int
      +main ()
      +{
      +  fn1 ();
      +  return 0;
      +}
      
      From-SVN: r235438
      Marek Polacek committed
    • tree-if-conv.c (any_pred_load_store): New static variable. · 520435ec
      	* tree-if-conv.c (any_pred_load_store): New static variable.
      	(if_convertible_gimple_assign_stmt_p): Remove parameter.  Use
      	any_pred_load_store instead of and_mask_load_store.
      	(if_convertible_stmt_p, if_convertible_loop_p_1): Ditto.
      	(if_convertible_loop_p, insert_gimplified_predicates): Ditto.
      	(combine_blocks, tree_if_conversion): Ditto.
      
      From-SVN: r235437
      Bin Cheng committed
    • re PR tree-optimization/70771 (ICE on valid code at -O3 on x86_64-linux-gnu in… · 00f615af
      re PR tree-optimization/70771 (ICE on valid code at -O3 on x86_64-linux-gnu in operator[], at vec.h:714)
      
      	PR tree-optimization/70771
      	PR tree-optimization/70775
      	* tree-if-conv.c (if_convertible_phi_p): Remove check on special
      	virtual PHI nodes.  Delete parameter.
      	(if_convertible_loop_p_1): Delete argument to above function.
      	(predicate_all_scalar_phis): Delete code handling single-argument
      	PHIs.
      	(tree_if_conversion): Mark and update virtual SSA.
      
      	gcc/testsuite/ChangeLog
      	PR tree-optimization/70771
      	PR tree-optimization/70775
      	* gcc.dg/pr70771.c: New test.
      	* gcc.dg/pr70771.c: New test.
      
      From-SVN: r235436
      Bin Cheng committed
    • Support .largecomm with Solaris as (PR target/61821) · 901f29c8
      	PR target/61821
      	* config/i386/i386.c (LARGECOMM_SECTION_ASM_OP): Define default.
      	(x86_elf_aligned_common): Rename to ...
      	(x86_elf_aligned_decl_common): ... this.
      	Add decl arg.  Switch to .lbss for largecomm object.  Use
      	LARGECOMM_SECTION_ASM_OP.
      	* config/i386/i386-protos.h (x86_elf_aligned_common): Reflect
      	renaming.
      	* config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_COMMON): Rename to ...
      	(ASM_OUTPUT_ALIGNED_DECL_COMMON): ... this.
      	Pass new decl arg.
      	* config/i386/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Likewise.
      	[!USE_GAS] (LARGECOMM_SECTION_ASM_OP): Define.
      
      From-SVN: r235435
      Rainer Orth committed
    • Support .lbss etc. sections with Solaris as (PR target/59407) · b2eb4ed5
      	PR target/59407
      	* config/i386/i386.c (SECTION_LARGE): Define.
      	(x86_64_elf_select_section): Set it for large data/bss sections.
      	Only clear SECTION_WRITE for .lrodata.
      	(x86_64_elf_section_type_flags): Set SECTION_LARGE for large
      	data/bss sections.
      	* config/i386/sol2.h (MACH_DEP_SECTION_ASM_FLAG): Define.
      	* varasm.c (default_elf_asm_named_section): Grow flagchars.
      	[MACH_DEP_SECTION_ASM_FLAG] Emit MACH_DEP_SECTION_ASM_FLAG for
      	SECTION_MACH_DEP.
      	* doc/tm.texi.in (Sections, MACH_DEP_SECTION_ASM_FLAG): Describe.
      	* doc/tm.texi: Regenerate.
      
      From-SVN: r235434
      Rainer Orth committed
    • Compile libcilkrts with -funwind-tables (PR target/60290) · ec1a9e7d
      	PR target/60290
      	* Makefile.am (GENERAL_FLAGS): Add -funwind-tables.
      	* Makefile.in: Regenerate.
      
      From-SVN: r235432
      Rainer Orth committed
    • re PR bootstrap/70704 (AIX bootstrap comparison failure) · 7db11a5a
      	PR bootstrap/70704
      	* configure.ac (--enable-stage1-checking): For --disable-checking or
      	implicit --enable-checking, make sure extra flag matches in between
      	stage1 and later checking.
      	* configure: Regenerated.
      gcc/
      	* configure.ac (--enable-checking): Document extra flag, for
      	non-release builds default to --enable-checking=yes,extra.
      	If misc checking and extra checking, define CHECKING_P to 2 instead
      	of 1.
      	* common.opt (fchecking=): Add.
      	* doc/invoke.texi (-fchecking=): Document.
      	* doc/install.texi: Document --enable-checking changes.
      	* configure: Regenerated.
      	* config.in: Regenerated.
      gcc/cp/
      	* pt.c (build_non_dependent_expr): Use flag_checking > 1 instead of
      	just flag_checking.
      
      From-SVN: r235430
      Jakub Jelinek committed
    • Daily bump. · 513d5d7f
      From-SVN: r235428
      GCC Administrator committed
  2. 25 Apr, 2016 15 commits
  3. 24 Apr, 2016 6 commits
    • i386.md (*lea<mode>_general_4): Use const_0_to_3_operand predicate for operand 2. · 9bb069e5
      	* config/i386/i386.md (*lea<mode>_general_4): Use const_0_to_3_operand
      	predicate for operand 2.
      
      From-SVN: r235397
      Uros Bizjak committed
    • i386-protos.h (standard_sse_constant_p): Add machine_mode argument. · 55284a77
      	* config/i386/i386-protos.h (standard_sse_constant_p): Add
      	machine_mode argument.
      	* config/i386/i386.c (standard_sse_constant_p): Return 2 for
      	constm1_rtx operands.  For VOIDmode constants, get mode from
      	pred_mode.  Check mode size if the mode is supported by ABI.
      	(standard_sse_constant_opcode): Do not use standard_constant_p.
      	Strictly check ABI support for all-ones operands.
      	(ix86_legitimate_constant_p): Handle TImode, OImode and XImode
      	immediates. Update calls to standard_sse_constant_p.
      	(ix86_expand_vector_move): Update calls to standard_sse_constant_p.
      	(ix86_rtx_costs): Ditto.
      	* config/i386/i386.md (*movxi_internal_avx512f): Use
      	nonimmediate_or_sse_const_operand instead of vector_move_operand.
      	Use (v,BC) alternative instead of (v,C). Use register_operand
      	checks instead of MEM_P.
      	(*movoi_internal_avx): Use nonimmediate_or_sse_const_operand instead
      	of vector_move_operand.  Add (v,BC) alternative and corresponding avx2
      	isa attribute.  Use register_operand checks instead of MEM_P.
      	(*movti_internal): Use nonimmediate_or_sse_const_operand for
      	TARGET_SSE.  Improve TARGET_SSE insn constraint.  Add (v,BC)
      	alternative and corresponding sse2 isa attribute.
      	(*movtf_internal, *movdf_internal, *movsf_interal): Update calls
      	to standard_sse_constant_p.
      	(FP constant splitters): Ditto.
      	* config/i386/constraints.md (BC): Do not use standard_sse_constant_p.
      	(C): Ditto.
      	* config/i386/predicates.md (constm1_operand): Remove.
      	(nonimmediate_or_sse_const_operand): Rewrite using RTX.
      	* config/i386/sse.md (*<avx512>_cvtmask2<ssemodesuffix><mode>): Use
      	vector_all_ones_operand instead of constm1_operand.
      
      
      Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>
      
      From-SVN: r235396
      Uros Bizjak committed
    • libstdc++/70762 fix fallback implementation of nonexistent_path · a635cdb2
      	PR libstdc++/70762
      	* testsuite/util/testsuite_fs.h (__gnu_test::nonexistent_path): Use
      	static counter to return a different path on every call.
      
      From-SVN: r235395
      Jonathan Wakely committed
    • make avail_stores a vec<rtx_insn *> · e4dbabfe
      gcc/ChangeLog:
      
      2016-04-24  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
      
      	* print-rtl.c (print_rtx_insn_vec): New function.
      	* print-rtl.h: New prototype.
      	* store-motion.c (struct st_expr): Make avail_stores a vector.
      	(st_expr_entry): Adjust.
      	(free_st_expr_entry): Likewise.
      	(print_store_motion_mems): Likewise.
      	(find_moveable_store): Likewise.
      	(compute_store_table): Likewise.
      	(delete_store): Likewise.
      	(build_store_vectors): Likewise.
      
      From-SVN: r235394
      Trevor Saunders committed
    • stop using rtx_insn_list in reorg.c · 5d911caf
      gcc/ChangeLog:
      
      2016-04-24  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
      
      	* reorg.c (try_merge_delay_insns): Make merged_insns a vector.
      
      From-SVN: r235393
      Trevor Saunders committed
    • add some utility methods to vec · 12e109d1
      gcc/ChangeLog:
      
      2016-04-24  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
      
      	* vec.h (vec_safe_contains): New function.
      	(vec::contains): Likewise.
      	(vec::begin): Likewise.
      	(vec::end): Likewise.
      
      From-SVN: r235392
      Trevor Saunders committed