1. 21 Nov, 2017 5 commits
    • C/C++: more stdlib header hints (PR c/81404) · 26edace6
      This patch extends the C frontend's "knowledge" of the C stdlib within
      get_c_name_hint to cover some more macros and functions, covering
      a case reported in PR c/81404 ("INT_MAX"), so that rather than printing:
      
        t.c:5:12: error: 'INT_MAX' undeclared here (not in a function); did you mean '__INT_MAX__'?
         int test = INT_MAX;
                    ^~~~~~~
                    __INT_MAX__
      
      we instead print:
      
        t.c:5:12: error: 'INT_MAX' undeclared here (not in a function)
         int test = INT_MAX;
                    ^~~~~~~
        t.c:5:12: note: 'INT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
        t.c:1:1:
        +#include <limits.h>
      
        t.c:5:12:
          int test = INT_MAX;
                     ^~~~~~~
      
      It also adds generalizes some of the code for this (and for the "std::"
      namespace hints in the C++ frontend), moving it to a new
      c-family/known-headers.cc and .h, and introducing a class known_headers.
      This currently just works by scanning a hardcoded array of known
      name/header associations, but perhaps in the future could be turned
      into some kind of symbol database so that the compiler could record API
      uses and use that to offer suggestions e.g.
      
      foo.cc: error: 'myapi::foo' was not declared in this scope
      foo.cc: note: 'myapi::foo" was declared in header 'myapi/private.h'
      (included via 'myapi/public.h') when compiling 'bar.cc'; did you forget to
      '#include "myapi/public.h"'?
      
      or somesuch.
      
      In any case, moving this to a class gives an easier way to locate the
      hardcoded knowledge about the stdlib.
      
      The patch also adds similar code to the C++ frontend covering
      unqualified names in the standard library, so that rather than just
      e.g.:
      
        t.cc:19:13: error: 'NULL' was not declared in this scope
         void *ptr = NULL;
                     ^~~~
      
      we can emit:
      
        t.cc:19:13: error: 'NULL' was not declared in this scope
         void *ptr = NULL;
                     ^~~~
        t.cc:19:13: note: 'NULL' is defined in header '<cstddef>'; did you forget
        to '#include <cstddef>'?
        t.cc:1:1:
        +#include <cstddef>
      
        t.cc:19:13:
         void *ptr = NULL;
                     ^~~~
      
      (Also XFAIL for PR c++/80567 added for the C++ testcase; this is a
      separate pre-existing bug exposed by the testcase for PR 81404).
      
      gcc/ChangeLog:
      	PR c/81404
      	* Makefile.in (C_COMMON_OBJS): Add c-family/known-headers.o.
      
      gcc/c-family/ChangeLog:
      	PR c/81404
      	* known-headers.cc: New file, based on material from c/c-decl.c.
      	(suggest_missing_header): Copied as-is.
      	(get_stdlib_header_for_name): New, based on get_c_name_hint but
      	heavily edited to add C++ support.  Add some knowledge about
      	<limits.h>, <stdint.h>, and <wchar.h>.
      	* known-headers.h: Likewise.
      
      gcc/c/ChangeLog:
      	PR c/81404
      	* c-decl.c: Include "c-family/known-headers.h".
      	(get_c_name_hint): Rename to get_stdlib_header_for_name and move
      	to known-headers.cc.
      	(class suggest_missing_header): Move to known-header.h.
      	(lookup_name_fuzzy): Call get_c_stdlib_header_for_name rather
      	than get_c_name_hint.
      
      gcc/cp/ChangeLog:
      	PR c/81404
      	* name-lookup.c: Include "c-family/known-headers.h"
      	(lookup_name_fuzzy): Call get_cp_stdlib_header_for_name and
      	potentially return a new suggest_missing_header hint.
      
      gcc/testsuite/ChangeLog:
      	PR c/81404
      	* g++.dg/spellcheck-stdlib.C: New.
      	* gcc.dg/spellcheck-stdlib.c (test_INT_MAX): New.
      
      From-SVN: r254980
      David Malcolm committed
    • C: hints for missing stdlib includes for macros and types · b1212255
      The C frontend already "knows" about many common functions in
      the C standard library:
      
        test.c: In function 'test':
        test.c:3:3: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
           printf ("hello world\n");
           ^~~~~~
        test.c:3:3: warning: incompatible implicit declaration of built-in function 'printf'
        test.c:3:3: note: include '<stdio.h>' or provide a declaration of 'printf'
      
      and which header file they are in.
      
      However it doesn't know about various types and macros:
      
      test.c:1:13: error: 'NULL' undeclared here (not in a function)
       void *ptr = NULL;
                   ^~~~
      
      This patch uses the name_hint/deferred_diagnostic machinery to
      add hints for missing C standard library headers for some of the
      most common type and macro names.
      
      For example, the above becomes:
      test.c:1:13: error: 'NULL' undeclared here (not in a function)
       void *ptr = NULL;
                   ^~~~
      test.c:1:13: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
      
      gcc/c/ChangeLog:
      	* c-decl.c (get_c_name_hint): New function.
      	(class suggest_missing_header): New class.
      	(lookup_name_fuzzy): Call get_c_name_hint and use it to
      	suggest missing headers to the user.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/spellcheck-stdlib.c: New test case.
      
      From-SVN: r254979
      David Malcolm committed
    • C++: provide macro used-before-defined hint (PR c++/72786) · 01ada121
      This patch uses the name_hint/deferred_diagnostic to provide
      a message in the C++ frontend if a macro is used before it is defined
      e.g.:
      
      test.c:6:24: error: expected ';' at end of member declaration
         virtual void clone() const OVERRIDE { }
                              ^~~~~
                                   ;
      test.c:6:30: error: 'OVERRIDE' does not name a type
         virtual void clone() const OVERRIDE { }
                                    ^~~~~~~~
      test.c:6:30: note: the macro 'OVERRIDE' had not yet been defined
      test.c:15:0: note: it was later defined here
       #define OVERRIDE override
      
      It's possible to do it from the C++ frontend as tokenization happens
      up-front (and hence the macro already exists when the above is parsed);
      I attempted to do it from the C frontend, but because the C frontend only
      tokenizes on-demand during parsing, the macro isn't known about until
      later.
      
      gcc/cp/ChangeLog:
      	PR c++/72786
      	* name-lookup.c (class macro_use_before_def): New class.
      	(lookup_name_fuzzy): Detect macro that were used before being
      	defined, and report them as such.
      
      gcc/ChangeLog:
      	PR c++/72786
      	* spellcheck.h (best_match::blithely_get_best_candidate): New
      	accessor.
      
      gcc/testsuite/ChangeLog:
      	PR c++/72786
      	* g++.dg/spellcheck-macro-ordering-2.C: New test case.
      	* g++.dg/spellcheck-macro-ordering.C: Add dg-message directives
      	for macro used-before-defined.
      
      libcpp/ChangeLog:
      	PR c++/72786
      	* include/cpplib.h (cpp_macro_definition_location): New decl.
      	* macro.c (cpp_macro_definition): New function.
      
      From-SVN: r254978
      David Malcolm committed
    • re PR target/81356 (__builtin_strcpy is not good for copying an empty string on aarch64) · 874b8068
      2017-11-20  Steve Ellcey  <sellcey@cavium.com>
      
      	PR target/81356
      	* gfortran.dg/pr45636.f90 (aarch64*-*-*): Remove from xfail list.
      
      From-SVN: r254977
      Steve Ellcey committed
    • Daily bump. · a121f822
      From-SVN: r254976
      GCC Administrator committed
  2. 20 Nov, 2017 27 commits
    • Avoid duplicate visibility warning. · 753c2e69
      	* decl2.c (constrain_class_visibility): Don't warn about artificial
      	fields.
      
      From-SVN: r254973
      Jason Merrill committed
    • streambuf_iterator.h (istreambuf_iterator<>): Declare std::advance for… · e324f9cb
      streambuf_iterator.h (istreambuf_iterator<>): Declare std::advance for istreambuf_iterator of char types to be friend.
      
      2017-11-20  François Dumont  <fdumont@gcc.gnu.org>
      
      	* include/bits/streambuf_iterator.h (istreambuf_iterator<>): Declare
      	std::advance for istreambuf_iterator of char types to be friend.
      	(std::advance(istreambuf_iterator&, _Distance)): New overload.
      	* include/std/streambuf (basic_streambuf<>): Declare std::advance for
      	istreambuf_iterator of char types to be friend.
      	* testsuite/22_locale/money_get/get/char/9.cc: Have
      	istreambuf_iterator created on the fly when calling money_get<>::get.
      	* testsuite/22_locale/money_get/get/wchar_t/9.cc: Likewise.
      	* testsuite/24_iterators/istreambuf_iterator/debug/1_neg.cc: New.
      	* testsuite/24_iterators/istreambuf_iterator/debug/2_neg.cc: New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/char/1.cc: New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/char/1_neg.cc:
      	New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc: New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/char/2_neg.cc:
      	New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/char/3_neg.cc:
      	New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/1.cc:
      	New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/1_neg.cc:
      	New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc:
      	New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2_neg.cc:
      	New.
      	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/3_neg.cc:
      	New.
      	* testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc: Leverage
      	on std::advance overload.
      	* testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc:
      	Likewise.
      
      From-SVN: r254972
      François Dumont committed
    • Fix failing tests caused by duplicate dg-options · 9be0a9d6
      	* testsuite/special_functions/18_riemann_zeta/check_value.cc: Fix
      	duplicate dg-options directive.
      	* testsuite/tr1/5_numerical_facilities/special_functions/
      	20_riemann_zeta/check_value_neg.cc: Likewise.
      
      From-SVN: r254971
      Jonathan Wakely committed
    • i386.c (parse_mtune_ctrl_str): Start diagnostics with lower case letter. · 49e68526
      	* config/i386/i386.c (parse_mtune_ctrl_str): Start diagnostics
      	with lower case letter.
      
      From-SVN: r254970
      Jakub Jelinek committed
    • i386.md (bswaphi2): New expander. · 121075d7
      	* config/i386/i386.md (bswaphi2): New expander.
      	(*bswaphi2_movbe): New insn pattern.
      	(bswaphi -> rorhi pepehole2): New peephole pattern.
      
      testsuite/ChangeLog:
      
      	* gcc.target/i386/movbe-5.c: New test.
      
      From-SVN: r254967
      Uros Bizjak committed
    • re PR fortran/79072 (ICE with class(*) pointer function result and character value) · 6017b8f0
      2017-11-20  Paul Thomas  <pault@gcc.gnu.org>
      
      	PR fortran/79072
      	* trans-expr.c (trans_class_vptr_len_assignment): Set from_len
      	if the temporary is unlimited polymorphic.
      	* trans-stmt.c (trans_associate_var): Use the fake result decl
      	to obtain the 'len' field from an explicit function result when
      	in that function scope.
      
      2017-11-20  Paul Thomas  <pault@gcc.gnu.org>
      
      	PR fortran/79072
      	* gfortran.dg/class_result_5.f90: New test.
      
      From-SVN: r254966
      Paul Thomas committed
    • RISC-V: Implement __umulsidi3, umul_ppmm and __muluw3 · ee1c2133
      2017-11-20  Kito Cheng  <kito.cheng@gmail.com>
      
              * longlong.h [__riscv] (__umulsidi3): Define.
              [__riscv] (umul_ppmm): Likewise.
              [__riscv] (__muluw3): Likewise.
      
      From-SVN: r254965
      Kito Cheng committed
    • P0329R4: Designated Initialization · d68ddd2b
      	P0329R4: Designated Initialization
      	* parser.c (cp_parser_initializer_clause): List in comment grammar
      	designated-initializer-list.
      	(cp_parser_initializer_list): Allow .identifier = without pedwarn for
      	C++2A, parse .identifier { ... }.  Improve location_t argument to
      	pedwarn.  Add pedwarn for [cst] = designators.  Diagnose ... in
      	designated initializer list.  Diagnose mixing designated and
      	non-designated initializer clauses for C++2A.  Diagnose duplicated
      	identifiers in designators.
      	* name-lookup.h (search_anon_aggr): New declaration.
      	* name-lookup.c (fields_linear_search): Use search_anon_aggr.
      	(search_anon_aggr): New function.
      	* typeck2.c (process_init_constructor_record): Allow designator
      	to skip over some non-static data members.  Handle anonymous
      	aggregates.  Add diagnostics for designator order not matching
      	member declaration order.
      
      	* g++.dg/ext/desig2.C: Adjust comment, no sorry about designator
      	refering to second member.
      	(b): New variable and associated expected diagnostic.
      	* g++.dg/ext/desig4.C: For C++2A expect diagnostics.
      	* g++.dg/ext/desig5.C: Add dg-do dg-compile and empty dg-options.
      	* g++.dg/ext/desig8.C: Likewise.
      	* g++.dg/ext/desig9.C: New test.
      	* g++.dg/ext/pr27019.C: Don't expect any diagnostics.
      	* g++.dg/init/error2.C: Adjust expected diagnostics.
      	* g++.dg/cpp0x/desig1.C: Add dg-options with -pedantic, expect
      	warning on C99 designators.
      	* g++.dg/cpp2a/desig1.C: New test.
      	* g++.dg/cpp2a/desig2.C: New test.
      	* g++.dg/cpp2a/desig3.C: New test.
      	* g++.dg/cpp2a/desig4.C: New test.
      	* g++.dg/cpp2a/desig5.C: New test.
      	* g++.dg/cpp2a/desig6.C: New test.
      
      From-SVN: r254964
      Jakub Jelinek committed
    • c-family: add name_hint/deferred_diagnostic · 6c7a259b
      In various places we use lookup_name_fuzzy to provide a hint,
      and can report messages of the form:
        error: unknown foo named 'bar'
      or:
        error: unknown foo named 'bar'; did you mean 'SUGGESTION?
      
      This patch provides a way for lookup_name_fuzzy to provide
      both the suggestion above, and (optionally) additional hints
      that can be printed e.g.
      
        note: did you forget to include <SOME_HEADER.h>?
      
      This patch provides the mechanism and ports existing users
      of lookup_name_fuzzy to the new return type.
      There are no uses of such hints in this patch, but followup
      patches provide various front-end specific uses of this.
      
      gcc/c-family/ChangeLog:
      	* c-common.h (enum lookup_name_fuzzy_kind): Move to name-hint.h.
      	(lookup_name_fuzzy): Likewise.  Convert return type from
      	const char * to name_hint.  Add location_t param.
      	* name-hint.h: New header.
      
      gcc/c/ChangeLog:
      	* c-decl.c: Define INCLUDE_UNIQUE_PTR before including system.h.
      	Include "c-family/name-hint.h"
      	(implicit_decl_warning): Convert "hint" from
      	const char * to name_hint.  Pass location to
      	lookup_name_fuzzy.  Suppress any deferred diagnostic if the
      	warning was not printed.
      	(undeclared_variable): Likewise for "guessed_id".
      	(lookup_name_fuzzy): Convert return type from const char *
      	to name_hint.  Add location_t param.
      	* c-parser.c: Define INCLUDE_UNIQUE_PTR before including system.h.
      	Include "c-family/name-hint.h"
      	(c_parser_declaration_or_fndef): Convert "hint" from
      	const char * to name_hint.  Pass location to lookup_name_fuzzy.
      	(c_parser_parameter_declaration): Likewise.
      
      gcc/cp/ChangeLog:
      	* name-lookup.c: Define INCLUDE_UNIQUE_PTR before including system.h.
      	Include "c-family/name-hint.h"
      	(suggest_alternatives_for): Convert "fuzzy_name" from const char *
      	to name_hint, and rename to "hint".  Pass location to
      	lookup_name_fuzzy.
      	(lookup_name_fuzzy): Convert return type from const char *
      	to name_hint.  Add location_t param.
      	* parser.c: Define INCLUDE_UNIQUE_PTR before including system.h.
      	Include "c-family/name-hint.h"
      	(cp_parser_diagnose_invalid_type_name): Convert
      	"suggestion" from const char * to name_hint, and rename to "hint".
      	Pass location to lookup_name_fuzzy.
      
      From-SVN: r254963
      David Malcolm committed
    • Makefile.in (OBJS): Add gimple-ssa-evrp-analyze.o. · 74ba745b
      	* Makefile.in (OBJS): Add gimple-ssa-evrp-analyze.o.
      	* gimple-ssa-evrp-analyze.c: New file pulled from gimple-ssa-evrp.c.
      	* gimple-ssa-evrp-analyze.h: New file pulled from gimple-ssa-evrp.c.
      	* gimple-ssa-evrp.c: Remove bits moved into new files.  Include
      	gimple-ssa-evrp-analyze.h.
      
      From-SVN: r254961
      Jeff Law committed
    • gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Do not set BB_VISITED here. · 8c66dd9b
      	* gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Do not
      	set BB_VISITED here.
      	(evrp_range_analyzer::enter): Set BB_VISITED here instead.
      
      From-SVN: r254960
      Jeff Law committed
    • [PR c++/82878] pass-by-invisiref in lambda · 6aa80414
      https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01115.html
      	PR c++/82878
      	PR c++/78495
      	* call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited
      	ctor.
      	* cp-gimplify.c	(cp_genericize_r): Restore THUNK dereference
      	inhibibition check removed in previous c++/78495 change.
      
      	PR c++/82878
      	* g++.dg/cpp0x/pr82878.C: New.
      	* g++.dg/cpp1z/inh-ctor38.C: Check moves too.
      
      From-SVN: r254958
      Nathan Sidwell committed
    • Implement LWG 2353 · 7b7b60c8
      * include/bits/stl_iterator_base_funcs.h (next):
      Use InputIterator instead of ForwardIterator.
      * testsuite/24_iterators/operations/lwg2353.cc: New.
      * testsuite/24_iterators/operations/next_neg.cc: Remove.
      
      From-SVN: r254957
      Ville Voutilainen committed
    • tree-predcom.c: Add general comment on Store-Store chains. · 9cdcebf9
      	* tree-predcom.c: Add general comment on Store-Store chains.
      	(split_data_refs_to_components): Postpone clearing eliminate_store_p
      	flag in component.
      	(get_chain_last_ref_at): Rename into...
      	(get_chain_last_write_at): ...this.
      	(get_chain_last_write_before_load): New function.
      	(add_ref_to_chain): Promote type of chain from CT_STORE_LOAD to
      	CT_STORE_STORE when write reference is added.
      	(determine_roots_comp): Support load ref in CT_STORE_STORE chains.
      	(is_inv_store_elimination_chain): Update get_chain_last_write_at call.
      	(initialize_root_vars_store_elim_1): Ditto.
      	(initialize_root_vars_store_elim_2): Ditto.  Replace rhs once default
      	definition is created.
      	(execute_pred_commoning_chain): Support load ref in CT_STORE_STORE
      	chain by replacing it with dominant stored value.
      
      	gcc/testsuite
      	* gcc.dg/tree-ssa/predcom-dse-12.c: New test.
      
      From-SVN: r254956
      Bin Cheng committed
    • * tree-predcom.c (add_ref_to_chain): Remove check on distance. · 90ef5773
      From-SVN: r254955
      Bin Cheng committed
    • VRP: x+1 and -x cannot be INT_MIN · 50dec459
      2017-11-20  Marc Glisse  <marc.glisse@inria.fr>
      
      gcc/
      	* vr-values.c (extract_range_from_binary_expr): Use a full range
      	for VR_VARYING.
      
      gcc/testsuite/
      	PR testsuite/82951
      	* gcc.c-torture/execute/20040409-1.c: Move invalid tests...
      	* gcc.c-torture/execute/20040409-1w.c: ... here with -fwrapv.
      	* gcc.c-torture/execute/20040409-2.c: Move invalid tests...
      	* gcc.c-torture/execute/20040409-2w.c: ... here with -fwrapv.
      	* gcc.c-torture/execute/20040409-3.c: Move invalid tests...
      	* gcc.c-torture/execute/20040409-3w.c: ... here with -fwrapv.
      	* gcc.dg/tree-ssa/cmpmul-1.c: Tweak condition.
      	* gcc.dg/tree-ssa/vrp118.c: New file.
      
      From-SVN: r254954
      Marc Glisse committed
    • Add g++.dg/pr82836.C requirements · 9aab5534
      	* g++.dg/pr82836.C: Require int128, __float128 support.
      	Add __float128 options.
      	(size_t): Define using __SIZE_TYPE__.
      
      From-SVN: r254953
      Rainer Orth committed
    • re PR c++/82781 (Vector extension operators return wrong result in constexpr) · f370e36d
      	PR c++/82781
      	* constexpr.c (cxx_eval_vector_conditional_expression): New function.
      	(cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
      	of cxx_eval_conditional_expression.
      
      	* g++.dg/ext/constexpr-pr82781.C: New test.
      
      From-SVN: r254952
      Jakub Jelinek committed
    • re PR bootstrap/83015 (bootstrap comparison failure on ia64) · 1ebafce0
      	PR bootstrap/83015
      	* config/cr16/unwind-cr16.c (uw_install_context): Add FRAMES
      	parameter.
      	* config/xtensa/unwind-dw2-xtensa.c: Likewise
      	* config/ia64/unwind-ia64.c: Add frames parameter.
      	* unwind-sjlj.c: Likewise.
      
      From-SVN: r254951
      Igor Tsimbalist committed
    • [ARM] Do no clobber r4 in Armv8-M nonsecure call · 0a413fbc
      Expanders for Armv8-M nonsecure call unnecessarily clobber r4 despite
      the libcall they perform not writing to r4.  Furthermore, the
      requirement for the branch target address to be in r4 as expected by
      the libcall is modeled in a convoluted way in the define_insn patterns:
      the address is a register match_operand constrained by the match_dup
      for the clobber which is guaranteed to be r4 due to the expander.
      
      This patch simplifies all this by simply requiring the address to be in
      r4 and removing the clobbers. Expanders are left alone because
      cmse_nonsecure_call_clear_caller_saved relies on branch target memory
      attributes which would be lost if expanding to reg:SI R4_REGNUM.
      
      2017-11-20  Thomas Preud'homme  <thomas.preudhomme@arm.com>
      
          gcc/
          * config/arm/arm.md (R4_REGNUM): Define constant.
          (nonsecure_call_internal): Remove r4 clobber.
          (nonsecure_call_value_internal): Likewise.
          * config/arm/thumb1.md (nonsecure_call_reg_thumb1_v5): Remove second
          clobber and resequence match_operands.
          (nonsecure_call_value_reg_thumb1_v5): Likewise.
          * config/arm/thumb2.md (nonsecure_call_reg_thumb2): Likewise.
          (nonsecure_call_value_reg_thumb2): Likewise.
      
      From-SVN: r254950
      Thomas Preud'homme committed
    • [testsuite,arm] [Diagnostic Patch] don't print column zero · 4acdaf98
      2017-11-20  Christophe Lyon  <christophe.lyon@linaro.org>
      
      	gcc/testsuite/
      	* gcc.target/arm/pr69180.c: Use -: for no column in expected
      	warnings.
      
      From-SVN: r254949
      Christophe Lyon committed
    • re PR tree-optimization/78821 (GCC7: Copying whole 32 bits structure field by… · 4b84d9b8
      re PR tree-optimization/78821 (GCC7: Copying whole 32 bits structure field by field not optimised into copying whole 32 bits at once)
      
      	PR tree-optimization/78821
      	* gimple-ssa-store-merging.c (find_bswap_or_nop_load): Give up
      	if base is TARGET_MEM_REF.  If base is not MEM_REF, set base_addr
      	to the address of the base rather than the base itself.
      	(find_bswap_or_nop_1): Just use pointer comparison for vuse check.
      	(find_bswap_or_nop_finalize): New function.
      	(find_bswap_or_nop): Use it.
      	(bswap_replace): Return a tree rather than bool, change first
      	argument from gimple * to gimple_stmt_iterator, allow inserting
      	into an empty sequence, allow ins_stmt to be NULL - then emit
      	all stmts into gsi.  Fix up MEM_REF address gimplification.
      	(pass_optimize_bswap::execute): Adjust bswap_replace caller.
      	(struct store_immediate_info): Add N and INS_STMT non-static
      	data members.
      	(store_immediate_info::store_immediate_info): Initialize them
      	from newly added ctor args.
      	(merged_store_group::apply_stores): Formatting fixes.  Sort by
      	bitpos at the end.
      	(stmts_may_clobber_ref_p): For stores call also
      	refs_anti_dependent_p.
      	(gather_bswap_load_refs): New function.
      	(imm_store_chain_info::try_coalesce_bswap): New method.
      	(imm_store_chain_info::coalesce_immediate_stores): Use it.
      	(split_group): Handle LROTATE_EXPR and NOP_EXPR rhs_code specially.
      	(imm_store_chain_info::output_merged_store): Fail if number of
      	new estimated stmts is bigger or equal than old.  Handle LROTATE_EXPR
      	and NOP_EXPR rhs_code.
      	(pass_store_merging::process_store): Compute n and ins_stmt, if
      	ins_stmt is non-NULL and the store rhs is otherwise invalid, use
      	LROTATE_EXPR rhs_code.  Pass n and ins_stmt to store_immediate_info
      	ctor.
      	(pass_store_merging::execute): Calculate dominators.
      
      	* gcc.dg/store_merging_16.c: New test.
      
      From-SVN: r254948
      Jakub Jelinek committed
    • tree-ssa-math-opts.c (nop_stats, [...]): Moved to ... · dffec8eb
      	* tree-ssa-math-opts.c (nop_stats, bswap_stats, struct symbolic_number,
      	BITS_PER_MARKER, MARKER_MASK, MARKER_BYTE_UNKNOWN, HEAD_MARKER, CMPNOP,
      	CMPXCHG, do_shift_rotate, verify_symbolic_number_p,
      	init_symbolic_number, find_bswap_or_nop_load, perform_symbolic_merge,
      	find_bswap_or_nop_1, find_bswap_or_nop, pass_data_optimize_bswap,
      	class pass_optimize_bswap, bswap_replace,
      	pass_optimize_bswap::execute): Moved to ...
      	* gimple-ssa-store-merging.c: ... this file.
      	Include optabs-tree.h.
      	(nop_stats, bswap_stats, do_shift_rotate, verify_symbolic_number_p,
      	init_symbolic_number, find_bswap_or_nop_load, perform_symbolic_merge,
      	find_bswap_or_nop_1, find_bswap_or_nop, bswap_replace): Put into
      	anonymous namespace, remove static keywords.
      	(pass_optimize_bswap::gate): Test BITS_PER_UNIT == 8 here...
      	(pass_optimize_bswap::execute): ... rather than here.  Formatting fix.
      
      From-SVN: r254947
      Jakub Jelinek committed
    • re PR bootstrap/83062 (Bootstrap failure: libsanitizer/tsan/tsan_rtl.h:713:44:… · 12b8cb2e
      re PR bootstrap/83062 (Bootstrap failure: libsanitizer/tsan/tsan_rtl.h:713:44: error: inlining failed in call to always_inline ‘void __tsan::MemoryRead(__tsan::ThreadState*, __sanitizer::uptr, __sanitizer: :uptr, int)’: caller is not optimized)
      
      	PR bootstrap/83062
      	* ipa-inline.c (can_inline_edge_p): Fix typo in previous patch.
      
      From-SVN: r254946
      Jan Hubicka committed
    • vec.h (debug_helper): New function. · 19a30b71
      	* vec.h (debug_helper): New function.
      	(DEFINE_DEBUG_VEC): New macro.
      	* hash-set.h (debug_helper): New function.
      	(DEFINE_DEBUG_HASH_SET): New macro.
      	* cfg.c (debug_slim (edge)): New function.
      	Call DEFINE_DEBUG_VEC for edges.
      	Call DEFINE_DEBUG_HASH_SET for edges.
      	* cfghooks.c (debug_slim (basic_block)): New function.
      	Call DEFINE_DEBUG_VEC for basic blocks.
      	Call DEFINE_DEBUG_HASH_SET for basic blocks.
      	* print-tree.c (debug_slim): New function to handle trees.
      	Call DEFINE_DEBUG_VEC for trees.
      	Call DEFINE_DEBUG_HASH_SET for trees.
      	(debug (vec<tree, va_gc>) &): Remove.
      	(debug (<vec<tree, va_gc>) *): Remove.
      	* print-rtl.c (debug_slim): New function to handle const_rtx.
      	Call DEFINE_DEBUG_VEC for rtx_def.
      	Call DEFINE_DEBUG_VEC for rtx_insn.
      	Call DEFINE_DEBUG_HASH_SET for rtx_def.
      	Call DEFINE_DEBUG_HASH_SET for rtx_insn.
      	* sel-sched-dump.c (debug (vec<rtx_insn *> &): Remove.
      	(debug (vec<rtx_insn *> *ptr): Remove.
      	(debug_insn_vector): Remove.
      	* stor-layout.c (debug_rli): Call debug() instead of debug_vec_tree.
      
      From-SVN: r254945
      Aldy Hernandez committed
    • Fix comparison mode in simplify_ternary_operation · 7cfaa4c6
      2017-11-20  Tom de Vries  <tom@codesourcery.com>
      
      	PR rtl-optimization/82020
      	* simplify-rtx.c (simplify_ternary_operation): Fix comparison mode of
      	IF_THEN_ELSE condition.
      
      From-SVN: r254944
      Tom de Vries committed
    • Daily bump. · 7476c7da
      From-SVN: r254943
      GCC Administrator committed
  3. 19 Nov, 2017 8 commits