From 0587cef3d7962a8b0f44779589ba2920dd3d71e5 Mon Sep 17 00:00:00 2001 From: Lewis Hyatt Date: Sat, 9 Jul 2022 16:12:21 -0400 Subject: c: Fix location for _Pragma tokens [PR97498] The handling of #pragma GCC diagnostic uses input_location, which is not always as precise as needed; in particular the relative location of some tokens and a _Pragma directive will crucially determine whether a given diagnostic is enabled or suppressed in the desired way. PR97498 shows how the C frontend ends up with input_location pointing to the beginning of the line containing a _Pragma() directive, resulting in the wrong behavior if the diagnostic to be modified pertains to some tokens found earlier on the same line. This patch fixes that by addressing two issues: a) libcpp was not assigning a valid location to the CPP_PRAGMA token generated by the _Pragma directive. b) C frontend was not setting input_location to something reasonable. With this change, the C frontend is able to change input_location to point to the _Pragma token as needed. This is just a two-line fix (one for each of a) and b)), the testsuite changes were needed only because the location on the tested warnings has been somewhat improved, so the tests need to look for the new locations. gcc/c/ChangeLog: PR preprocessor/97498 * c-parser.cc (c_parser_pragma): Set input_location to the location of the pragma, rather than the start of the line. libcpp/ChangeLog: PR preprocessor/97498 * directives.cc (destringize_and_run): Override the location of the CPP_PRAGMA token from a _Pragma directive to the location of the expansion point, as is done for the tokens lexed from it. gcc/testsuite/ChangeLog: PR preprocessor/97498 * c-c++-common/pr97498.c: New test. * c-c++-common/gomp/pragma-3.c: Adapt for improved warning locations. * c-c++-common/gomp/pragma-5.c: Likewise. * gcc.dg/pragma-message.c: Likewise. libgomp/ChangeLog: * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Adapt for improved warning locations. * testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: Likewise. --- gcc/c/c-parser.cc | 1 + gcc/testsuite/c-c++-common/gomp/pragma-3.c | 5 +++-- gcc/testsuite/c-c++-common/gomp/pragma-5.c | 5 +++-- gcc/testsuite/c-c++-common/pr97498.c | 4 ++++ gcc/testsuite/gcc.dg/pragma-message.c | 8 +++++--- 5 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/pr97498.c (limited to 'gcc') diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 9c02141..92049d1 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -12397,6 +12397,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context, bool *if_p) unsigned int id; const char *construct = NULL; + input_location = c_parser_peek_token (parser)->location; id = c_parser_peek_token (parser)->pragma_kind; gcc_assert (id != PRAGMA_NONE); diff --git a/gcc/testsuite/c-c++-common/gomp/pragma-3.c b/gcc/testsuite/c-c++-common/gomp/pragma-3.c index c1dee1b..ae18e9b 100644 --- a/gcc/testsuite/c-c++-common/gomp/pragma-3.c +++ b/gcc/testsuite/c-c++-common/gomp/pragma-3.c @@ -1,13 +1,14 @@ /* { dg-additional-options "-fdump-tree-original" } */ /* PR preprocessor/103165 */ -#define inner(...) #__VA_ARGS__ ; _Pragma("omp error severity(warning) message (\"Test\") at(compilation)") +#define inner(...) #__VA_ARGS__ ; _Pragma("omp error severity(warning) message (\"Test\") at(compilation)") /* { dg-line inner_location } */ #define outer(...) inner(__VA_ARGS__) void f (void) { - const char *str = outer(inner(1,2)); /* { dg-warning "'pragma omp error' encountered: Test" } */ + const char *str = outer(inner(1,2)); + /* { dg-warning "'pragma omp error' encountered: Test" "inner expansion" { target *-*-* } inner_location } */ } #if 0 diff --git a/gcc/testsuite/c-c++-common/gomp/pragma-5.c b/gcc/testsuite/c-c++-common/gomp/pragma-5.c index af54b68..8124f70 100644 --- a/gcc/testsuite/c-c++-common/gomp/pragma-5.c +++ b/gcc/testsuite/c-c++-common/gomp/pragma-5.c @@ -1,13 +1,14 @@ /* { dg-additional-options "-fdump-tree-original" } */ /* PR preprocessor/103165 */ -#define inner(...) #__VA_ARGS__ ; _Pragma ( " omp error severity (warning) message (\"Test\") at(compilation)" ) +#define inner(...) #__VA_ARGS__ ; _Pragma ( " omp error severity (warning) message (\"Test\") at(compilation)" ) /* { dg-line inner_location } */ #define outer(...) inner(__VA_ARGS__) void f (void) { - const char *str = outer(inner(1,2)); /* { dg-warning "'pragma omp error' encountered: Test" } */ + const char *str = outer(inner(1,2)); + /* { dg-warning "'pragma omp error' encountered: Test" "inner expansion" { target *-*-* } inner_location } */ } #if 0 diff --git a/gcc/testsuite/c-c++-common/pr97498.c b/gcc/testsuite/c-c++-common/pr97498.c new file mode 100644 index 0000000..f5fa420 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr97498.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-Wunused-function" } */ +#pragma GCC diagnostic ignored "-Wunused-function" +static void f() {} _Pragma("GCC diagnostic error \"-Wunused-function\"") /* { dg-bogus "-Wunused-function" } */ diff --git a/gcc/testsuite/gcc.dg/pragma-message.c b/gcc/testsuite/gcc.dg/pragma-message.c index 2f44b61..1b7cf09 100644 --- a/gcc/testsuite/gcc.dg/pragma-message.c +++ b/gcc/testsuite/gcc.dg/pragma-message.c @@ -42,9 +42,11 @@ #pragma message ("Okay " THREE) /* { dg-message "Okay 3" } */ /* Create a TODO() that prints a message on compilation. */ -#define DO_PRAGMA(x) _Pragma (#x) -#define TODO(x) DO_PRAGMA(message ("TODO - " #x)) -TODO(Okay 4) /* { dg-message "TODO - Okay 4" } */ +#define DO_PRAGMA(x) _Pragma (#x) /* { dg-line pragma_loc1 } */ +#define TODO(x) DO_PRAGMA(message ("TODO - " #x)) /* { dg-line pragma_loc2 } */ +TODO(Okay 4) /* { dg-message "in expansion of macro 'TODO'" } */ +/* { dg-message "TODO - Okay 4" "test4.1" { target *-*-* } pragma_loc1 } */ +/* { dg-message "in expansion of macro 'DO_PRAGMA'" "test4.2" { target *-*-* } pragma_loc2 } */ #if 0 #pragma message ("Not printed") -- cgit v1.1 From b53ebbc5417d522b820c269aee0d080bb2b27212 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 11 Jul 2022 00:16:25 +0000 Subject: Daily bump. --- gcc/ChangeLog | 44 ++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/c/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 28 ++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fa3578e..d66115f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,47 @@ +2022-07-10 Aldy Hernandez + + * value-range.cc (irange::operator=): Call verify_range. + (irange::irange_set): Normalize kind after everything else has + been set. + (irange::irange_set_anti_range): Same. + (irange::set): Same. + (irange::verify_range): Disallow nonzero masks for VARYING. + (irange::irange_union): Call verify_range. + Handle nonzero masks better. + (irange::irange_intersect): Same. + (irange::set_nonzero_bits): Calculate mask if either range has an + explicit mask. + (irange::intersect_nonzero_bits): Same. + (irange::union_nonzero_bits): Same. + (range_tests_nonzero_bits): New. + (range_tests): Call range_tests_nonzero_bits. + * value-range.h (class irange): Remove set_nonzero_bits method + with trees. + (irange::varying_compatible_p): Set nonzero mask. + +2022-07-10 Xi Ruoyao + + * config/loongarch/loongarch.md (di3_fake): Describe + the sign-extend of result in the RTL template. + (3): Adjust for di3_fake change. + +2022-07-10 Xi Ruoyao + + * config/loongarch/loongarch.cc (loongarch_check_zero_div_p): + Remove static, for use in the machine description file. + * config/loongarch/loongarch-protos.h: + (loongarch_check_zero_div_p): Add prototype. + * config/loongarch/loongarch.md (enabled): New attr. + (*3): Add (=r,r,r) and (=&r,0,r) alternatives for + idiv. Conditionally enable the alternatives using + loongarch_check_zero_div_p. + (di3_fake): Likewise. + +2022-07-10 Xi Ruoyao + + * config/loongarch/loongarch.md (mulsidi3_64bit): Use mulw.d.w + instead of mul.d. + 2022-07-09 Aldy Hernandez * value-range.cc (irange::irange_single_pair_union): Set diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6de1e01..691f2ec 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20220710 +20220711 diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 989f293..3aa672b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2022-07-10 Lewis Hyatt + + PR preprocessor/97498 + * c-parser.cc (c_parser_pragma): Set input_location to the + location of the pragma, rather than the start of the line. + 2022-07-04 Tobias Burnus Chung-Lin Tang Thomas Schwinge diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2030900..d156840 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,31 @@ +2022-07-10 Lewis Hyatt + + PR preprocessor/97498 + * c-c++-common/pr97498.c: New test. + * c-c++-common/gomp/pragma-3.c: Adapt for improved warning locations. + * c-c++-common/gomp/pragma-5.c: Likewise. + * gcc.dg/pragma-message.c: Likewise. + +2022-07-10 Dimitar Dimitrov + + PR tree-optimization/106063 + * gcc.dg/pr106063.c: Require effective target int128. + +2022-07-10 Xi Ruoyao + + * gcc.target/loongarch/div-4.c: New test. + +2022-07-10 Xi Ruoyao + + * gcc.target/loongarch/div-1.c: New test. + * gcc.target/loongarch/div-2.c: New test. + * gcc.target/loongarch/div-3.c: New test. + +2022-07-10 Xi Ruoyao + + * gcc.target/loongarch/mulw_d_w.c: New test. + * gcc.c-torture/execute/mul-sext.c: New test. + 2022-07-09 Vit Kabele * c-c++-common/Wpadded.c: New test. -- cgit v1.1 From 0a7e721a6499a42f04361caf24772547afdeed57 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Fri, 10 Jun 2022 15:11:06 +0200 Subject: Implement global ranges for all vrange types (SSA_NAME_RANGE_INFO). Currently SSA_NAME_RANGE_INFO only handles integer ranges, and loses half the precision in the process because its use of legacy value_range's. This patch rewrites all the SSA_NAME_RANGE_INFO (nonzero bits included) to use the recently contributed vrange_storage. With it, we'll be able to efficiently save any ranges supported by ranger in GC memory. Presently this will only be irange's, but shortly we'll add floating ranges and others to the mix. As per the discussion with the trailing_wide_ints adjustments and vrange_storage, we'll be able to save integer ranges with a maximum of 5 sub-ranges. This could be adjusted later if more sub-ranges are needed (unlikely). Since this is a behavior changing patch, I would like to take a few days for discussion, and commit early next week if all goes well. A few notes. First, we get rid of the SSA_NAME_ANTI_RANGE_P bit in the SSA_NAME since we store full resolution ranges. Perhaps it could be re-used for something else. The range_info_def struct is gone in favor of an opaque type handled by vrange_storage. It currently supports irange, but will support frange, prange, etc, in due time. From the looks of it, set_range_info was an update operation despite its name, as we improved the nonzero bits with each call, even though we clobbered the ranges. Presumably this was because doing a proper intersect of ranges lost information with the anti-range hack. We no longer have this limitation so now we formalize both set_range_info and set_nonzero_bits to an update operation. After all, we should never be losing information, but enhancing it whenever possible. This means, that if folks' finger-memory is not offended, as a follow-up, I'd like to rename set_nonzero_bits and set_range_info to update_*. I have kept the same global API we had in tree-ssanames.h, with the caveat that all set operations are now update as discussed above. There is a 2% performance penalty for evrp and a 3% penalty for VRP that is coincidentally in line with a previous improvement of the same amount in the vrange abstraction patchset. Interestingly, this penalty is mostly due to the wide int to tree dance we keep doing with irange and legacy. In a first draft of this patch where I was streaming trees directly, there was actually a small improvement instead. I hope to get some of the gain back when we move irange's to wide-ints, though I'm not in a hurry ;-). Tested and benchmarked on x86-64 Linux. Tested on ppc64le Linux. Comments welcome. gcc/ChangeLog: * gimple-range.cc (gimple_ranger::export_global_ranges): Remove verification against legacy value_range. (gimple_ranger::register_inferred_ranges): Same. (gimple_ranger::export_global_ranges): Rename update_global_range to set_range_info. * tree-core.h (struct range_info_def): Remove. (struct irange_storage_slot): New. (struct tree_base): Remove SSA_NAME_ANTI_RANGE_P documentation. (struct tree_ssa_name): Add vrange_storage support. * tree-ssanames.cc (range_info_p): New. (range_info_fits_p): New. (range_info_alloc): New. (range_info_free): New. (range_info_get_range): New. (range_info_set_range): New. (set_range_info_raw): Remove. (set_range_info): Adjust to use vrange_storage. (set_nonzero_bits): Same. (get_nonzero_bits): Same. (duplicate_ssa_name_range_info): Remove overload taking value_range_kind. Rewrite tree overload to use vrange_storage. (duplicate_ssa_name_fn): Adjust to use vrange_storage. * tree-ssanames.h (struct range_info_def): Remove. (set_range_info): Adjust prototype to take vrange. * tree-vrp.cc (vrp_asserts::remove_range_assertions): Call duplicate_ssa_name_range_info. * tree.h (SSA_NAME_ANTI_RANGE_P): Remove. (SSA_NAME_RANGE_TYPE): Remove. * value-query.cc (get_ssa_name_range_info): Adjust to use vrange_storage. (update_global_range): Remove. (get_range_global): Remove as_a. * value-query.h (update_global_range): Remove. * tree-ssa-dom.cc (set_global_ranges_from_unreachable_edges): Rename update_global_range to set_range_info. * value-range-storage.cc (vrange_storage::alloc_slot): Remove gcc_unreachable. --- gcc/gimple-range.cc | 30 +----- gcc/tree-core.h | 13 +-- gcc/tree-ssa-dom.cc | 2 +- gcc/tree-ssanames.cc | 240 +++++++++++++++++++++------------------------ gcc/tree-ssanames.h | 12 +-- gcc/tree-vrp.cc | 22 +++-- gcc/tree.h | 8 -- gcc/value-query.cc | 54 ++-------- gcc/value-query.h | 1 - gcc/value-range-storage.cc | 4 +- 10 files changed, 149 insertions(+), 237 deletions(-) (limited to 'gcc') diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 3a9f0b0..7ac4830 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -468,22 +468,12 @@ gimple_ranger::register_inferred_ranges (gimple *s) { Value_Range tmp (TREE_TYPE (lhs)); if (range_of_stmt (tmp, s, lhs) && !tmp.varying_p () - && update_global_range (tmp, lhs) && dump_file) + && set_range_info (lhs, tmp) && dump_file) { - // ?? This section should be adjusted when non-iranges can - // be exported. For now, the only way update_global_range - // above can succeed is with an irange so this is safe. - value_range vr = as_a (tmp); fprintf (dump_file, "Global Exported: "); print_generic_expr (dump_file, lhs, TDF_SLIM); fprintf (dump_file, " = "); - vr.dump (dump_file); - int_range_max same = vr; - if (same != as_a (tmp)) - { - fprintf (dump_file, " ... irange was : "); - tmp.dump (dump_file); - } + tmp.dump (dump_file); fputc ('\n', dump_file); } } @@ -509,7 +499,7 @@ gimple_ranger::export_global_ranges () && m_cache.get_global_range (r, name) && !r.varying_p()) { - bool updated = update_global_range (r, name); + bool updated = set_range_info (name, r); if (!updated || !dump_file) continue; @@ -522,22 +512,10 @@ gimple_ranger::export_global_ranges () print_header = false; } - if (!irange::supports_p (TREE_TYPE (name))) - continue; - - vrange &v = r; - value_range vr = as_a (v); print_generic_expr (dump_file, name , TDF_SLIM); fprintf (dump_file, " : "); - vr.dump (dump_file); + r.dump (dump_file); fprintf (dump_file, "\n"); - int_range_max same = vr; - if (same != as_a (v)) - { - fprintf (dump_file, " irange : "); - r.dump (dump_file); - fprintf (dump_file, "\n"); - } } } } diff --git a/gcc/tree-core.h b/gcc/tree-core.h index ab5fa01..ea9f281 100644 --- a/gcc/tree-core.h +++ b/gcc/tree-core.h @@ -33,7 +33,7 @@ struct function; struct real_value; struct fixed_value; struct ptr_info_def; -struct range_info_def; +struct irange_storage_slot; struct die_struct; @@ -1194,9 +1194,6 @@ struct GTY(()) tree_base { TRANSACTION_EXPR_OUTER in TRANSACTION_EXPR - SSA_NAME_ANTI_RANGE_P in - SSA_NAME - MUST_TAIL_CALL in CALL_EXPR @@ -1594,8 +1591,12 @@ struct GTY(()) tree_ssa_name { union ssa_name_info_type { /* Pointer attributes used for alias analysis. */ struct GTY ((tag ("0"))) ptr_info_def *ptr_info; - /* Value range attributes used for zero/sign extension elimination. */ - struct GTY ((tag ("1"))) range_info_def *range_info; + /* This holds any range info supported by ranger (except ptr_info + above) and is managed by vrange_storage. */ + void * GTY ((skip)) range_info; + /* GTY tag when the range in the range_info slot above satisfies + irange::supports_type_p. */ + struct GTY ((tag ("1"))) irange_storage_slot *irange_info; } GTY ((desc ("%1.typed.type ?" \ "!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info; diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc index 2bc2c3d..43acc75 100644 --- a/gcc/tree-ssa-dom.cc +++ b/gcc/tree-ssa-dom.cc @@ -1255,7 +1255,7 @@ dom_opt_dom_walker::set_global_ranges_from_unreachable_edges (basic_block bb) && !r.varying_p () && !r.undefined_p ()) { - update_global_range (r, name); + set_range_info (name, r); maybe_set_nonzero_bits (pred_e, name); } } diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index bc22ece..9389454 100644 --- a/gcc/tree-ssanames.cc +++ b/gcc/tree-ssanames.cc @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "cfgloop.h" #include "tree-scalar-evolution.h" #include "value-query.h" +#include "value-range-storage.h" /* Rewriting a function into SSA form can create a huge number of SSA_NAMEs, many of which may be thrown away shortly after their creation if jumps @@ -71,6 +72,74 @@ unsigned int ssa_name_nodes_created; #define FREE_SSANAMES(fun) (fun)->gimple_df->free_ssanames #define FREE_SSANAMES_QUEUE(fun) (fun)->gimple_df->free_ssanames_queue +static ggc_vrange_allocator ggc_allocator; +static vrange_storage vstore (&ggc_allocator); + +/* Return TRUE if NAME has global range info. */ + +inline bool +range_info_p (const_tree name) +{ + return SSA_NAME_RANGE_INFO (name); +} + +/* Return TRUE if R fits in the global range of NAME. */ + +inline bool +range_info_fits_p (tree name, const vrange &r) +{ + gcc_checking_assert (range_info_p (name)); + void *mem = SSA_NAME_RANGE_INFO (name); + return vrange_storage::fits_p (mem, r); +} + +/* Allocate a new global range for NAME and set it to R. Return the + allocation slot. */ + +inline void * +range_info_alloc (tree name, const vrange &r) +{ + void *mem = vstore.alloc_slot (r); + SSA_NAME_RANGE_INFO (name) = mem; + return mem; +} + +/* Free storage allocated for the global range for NAME. */ + +inline void +range_info_free (tree name) +{ + void *mem = SSA_NAME_RANGE_INFO (name); + vstore.free (mem); +} + +/* Return the global range for NAME in R. */ + +inline void +range_info_get_range (tree name, vrange &r) +{ + vstore.get_vrange (SSA_NAME_RANGE_INFO (name), r, TREE_TYPE (name)); +} + +/* Set the global range for NAME from R. Return TRUE if successfull, + or FALSE if we can't set a range of NAME's type. */ + +inline bool +range_info_set_range (tree name, const vrange &r) +{ + if (!range_info_p (name) || !range_info_fits_p (name, r)) + { + if (range_info_p (name)) + range_info_free (name); + + return range_info_alloc (name, r); + } + else + { + vstore.set_vrange (SSA_NAME_RANGE_INFO (name), r); + return true; + } +} /* Initialize management of SSA_NAMEs to default SIZE. If SIZE is zero use default. */ @@ -343,94 +412,38 @@ make_ssa_name_fn (struct function *fn, tree var, gimple *stmt, return t; } -/* Helper function for set_range_info. - - Store range information RANGE_TYPE, MIN, and MAX to tree ssa_name - NAME. */ - -void -set_range_info_raw (tree name, enum value_range_kind range_type, - const wide_int_ref &min, const wide_int_ref &max) -{ - gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); - gcc_assert (range_type == VR_RANGE || range_type == VR_ANTI_RANGE); - range_info_def *ri = SSA_NAME_RANGE_INFO (name); - unsigned int precision = TYPE_PRECISION (TREE_TYPE (name)); - - /* Allocate if not available. */ - if (ri == NULL) - { - size_t size = (sizeof (range_info_def) - + trailing_wide_ints <3>::extra_size (precision)); - ri = static_cast (ggc_internal_alloc (size)); - ri->ints.set_precision (precision); - SSA_NAME_RANGE_INFO (name) = ri; - ri->set_nonzero_bits (wi::shwi (-1, precision)); - } - - /* Record the range type. */ - if (SSA_NAME_RANGE_TYPE (name) != range_type) - SSA_NAME_ANTI_RANGE_P (name) = (range_type == VR_ANTI_RANGE); +/* Update the range information for NAME, intersecting into an existing + range if applicable. Return TRUE if the range was updated. */ - /* Set the values. */ - ri->set_min (min); - ri->set_max (max); - - /* If it is a range, try to improve nonzero_bits from the min/max. */ - if (range_type == VR_RANGE) - { - wide_int xorv = ri->get_min () ^ ri->get_max (); - if (xorv != 0) - xorv = wi::mask (precision - wi::clz (xorv), false, precision); - ri->set_nonzero_bits (ri->get_nonzero_bits () & (ri->get_min () | xorv)); - } -} - -/* Store range information RANGE_TYPE, MIN, and MAX to tree ssa_name - NAME while making sure we don't store useless range info. */ - -static void -set_range_info (tree name, enum value_range_kind range_type, - const wide_int_ref &min, const wide_int_ref &max) +bool +set_range_info (tree name, const vrange &r) { - gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); + if (r.undefined_p () || r.varying_p ()) + return false; tree type = TREE_TYPE (name); - if (range_type == VR_VARYING) + if (POINTER_TYPE_P (type)) { - /* SSA_NAME_RANGE_TYPE can only hold a VR_RANGE or - VR_ANTI_RANGE. Denormalize VR_VARYING to VR_RANGE. */ - range_type = VR_RANGE; - gcc_checking_assert (min == wi::min_value (type)); - gcc_checking_assert (max == wi::max_value (type)); - } - - /* A range of the entire domain is really no range at all. */ - if (min == wi::min_value (TYPE_PRECISION (type), TYPE_SIGN (type)) - && max == wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type))) - { - range_info_def *ri = SSA_NAME_RANGE_INFO (name); - if (ri == NULL) - return; - if (ri->get_nonzero_bits () == -1) + if (r.nonzero_p ()) { - ggc_free (ri); - SSA_NAME_RANGE_INFO (name) = NULL; - return; + set_ptr_nonnull (name); + return true; } + return false; } - set_range_info_raw (name, range_type, min, max); -} - -/* Store range information for NAME from a value_range. */ + /* If a global range already exists, incorporate it. */ + if (range_info_p (name)) + { + Value_Range tmp (type); + range_info_get_range (name, tmp); + tmp.intersect (r); + if (tmp.undefined_p ()) + return false; -void -set_range_info (tree name, const value_range &vr) -{ - wide_int min = wi::to_wide (vr.min ()); - wide_int max = wi::to_wide (vr.max ()); - set_range_info (name, vr.kind (), min, max); + return range_info_set_range (name, tmp); + } + return range_info_set_range (name, r); } /* Set nonnull attribute to pointer NAME. */ @@ -443,22 +456,16 @@ set_ptr_nonnull (tree name) pi->pt.null = 0; } -/* Change non-zero bits bitmask of NAME. */ +/* Update the non-zero bits bitmask of NAME. */ void set_nonzero_bits (tree name, const wide_int_ref &mask) { gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); - if (SSA_NAME_RANGE_INFO (name) == NULL) - { - if (mask == -1) - return; - set_range_info_raw (name, VR_RANGE, - wi::to_wide (TYPE_MIN_VALUE (TREE_TYPE (name))), - wi::to_wide (TYPE_MAX_VALUE (TREE_TYPE (name)))); - } - range_info_def *ri = SSA_NAME_RANGE_INFO (name); - ri->set_nonzero_bits (mask); + + int_range<2> r (TREE_TYPE (name)); + r.set_nonzero_bits (mask); + set_range_info (name, r); } /* Return a widest_int with potentially non-zero bits in SSA_NAME @@ -482,10 +489,15 @@ get_nonzero_bits (const_tree name) return wi::shwi (-1, precision); } - range_info_def *ri = SSA_NAME_RANGE_INFO (name); - if (!ri) + if (!range_info_p (name)) return wi::shwi (-1, precision); + /* Optimization to get at the nonzero bits because we know the + storage type. This saves us measurable time compared to going + through vrange_storage. */ + gcc_checking_assert (irange::supports_p (TREE_TYPE (name))); + irange_storage_slot *ri + = static_cast (SSA_NAME_RANGE_INFO (name)); return ri->get_nonzero_bits (); } @@ -727,38 +739,18 @@ duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info) SSA_NAME_PTR_INFO (name) = new_ptr_info; } -/* Creates a duplicate of the range_info_def at RANGE_INFO of type - RANGE_TYPE for use by the SSA name NAME. */ -static void -duplicate_ssa_name_range_info (tree name, enum value_range_kind range_type, - struct range_info_def *range_info) -{ - struct range_info_def *new_range_info; - - gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name))); - gcc_assert (!SSA_NAME_RANGE_INFO (name)); - - if (!range_info) - return; - - unsigned int precision = TYPE_PRECISION (TREE_TYPE (name)); - size_t size = (sizeof (range_info_def) - + trailing_wide_ints <3>::extra_size (precision)); - new_range_info = static_cast (ggc_internal_alloc (size)); - memcpy (new_range_info, range_info, size); - - gcc_assert (range_type == VR_RANGE || range_type == VR_ANTI_RANGE); - SSA_NAME_ANTI_RANGE_P (name) = (range_type == VR_ANTI_RANGE); - SSA_NAME_RANGE_INFO (name) = new_range_info; -} - void duplicate_ssa_name_range_info (tree name, tree src) { gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (src))); - duplicate_ssa_name_range_info (name, - SSA_NAME_RANGE_TYPE (src), - SSA_NAME_RANGE_INFO (src)); + gcc_checking_assert (!range_info_p (name)); + + if (range_info_p (src)) + { + Value_Range src_range (TREE_TYPE (src)); + range_info_get_range (src, src_range); + range_info_set_range (name, src_range); + } } @@ -776,14 +768,8 @@ duplicate_ssa_name_fn (struct function *fn, tree name, gimple *stmt) if (old_ptr_info) duplicate_ssa_name_ptr_info (new_name, old_ptr_info); } - else - { - struct range_info_def *old_range_info = SSA_NAME_RANGE_INFO (name); - - if (old_range_info) - duplicate_ssa_name_range_info (new_name, SSA_NAME_RANGE_TYPE (name), - old_range_info); - } + else if (range_info_p (name)) + duplicate_ssa_name_range_info (new_name, name); return new_name; } diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h index 8c419b1..ce10af9 100644 --- a/gcc/tree-ssanames.h +++ b/gcc/tree-ssanames.h @@ -45,16 +45,6 @@ struct GTY(()) ptr_info_def unsigned int misalign; }; -/* Value range information for SSA_NAMEs representing non-pointer variables. */ - -struct GTY ((variable_size)) range_info_def { - /* Minimum, maximum and nonzero bits. */ - TRAILING_WIDE_INT_ACCESSOR (min, ints, 0) - TRAILING_WIDE_INT_ACCESSOR (max, ints, 1) - TRAILING_WIDE_INT_ACCESSOR (nonzero_bits, ints, 2) - trailing_wide_ints <3> ints; -}; - #define SSANAMES(fun) (fun)->gimple_df->ssa_names #define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs @@ -67,7 +57,7 @@ struct GTY ((variable_size)) range_info_def { if (VAR) /* Sets the value range to SSA. */ -extern void set_range_info (tree, const value_range &); +extern bool set_range_info (tree, const vrange &); extern void set_nonzero_bits (tree, const wide_int_ref &); extern wide_int get_nonzero_bits (const_tree); extern bool ssa_name_has_boolean_range (tree); diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc index ed881be..c3030a1 100644 --- a/gcc/tree-vrp.cc +++ b/gcc/tree-vrp.cc @@ -3739,16 +3739,18 @@ vrp_asserts::remove_range_assertions () && all_imm_uses_in_stmt_or_feed_cond (var, stmt, single_pred (bb))) { - /* We could use duplicate_ssa_name_range_info here - instead of peeking inside SSA_NAME_RANGE_INFO, - but the aforementioned asserts that the - destination has no global range. This is - slated for removal anyhow. */ - value_range r (TREE_TYPE (lhs), - SSA_NAME_RANGE_INFO (lhs)->get_min (), - SSA_NAME_RANGE_INFO (lhs)->get_max (), - SSA_NAME_RANGE_TYPE (lhs)); - set_range_info (var, r); + if (SSA_NAME_RANGE_INFO (var)) + { + /* ?? This is a minor wart exposing the + internals of SSA_NAME_RANGE_INFO in order + to maintain existing behavior. This is + because duplicate_ssa_name_range_info below + needs a NULL destination range. This is + all slated for removal... */ + ggc_free (SSA_NAME_RANGE_INFO (var)); + SSA_NAME_RANGE_INFO (var) = NULL; + } + duplicate_ssa_name_range_info (var, lhs); maybe_set_nonzero_bits (single_pred_edge (bb), var); } } diff --git a/gcc/tree.h b/gcc/tree.h index 6f6ad5a..e6564aa 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2030,14 +2030,6 @@ class auto_suppress_location_wrappers #define SSA_NAME_PTR_INFO(N) \ SSA_NAME_CHECK (N)->ssa_name.info.ptr_info -/* True if SSA_NAME_RANGE_INFO describes an anti-range. */ -#define SSA_NAME_ANTI_RANGE_P(N) \ - SSA_NAME_CHECK (N)->base.static_flag - -/* The type of range described by SSA_NAME_RANGE_INFO. */ -#define SSA_NAME_RANGE_TYPE(N) \ - (SSA_NAME_ANTI_RANGE_P (N) ? VR_ANTI_RANGE : VR_RANGE) - /* Value range info attributes for SSA_NAMEs of non pointer-type variables. */ #define SSA_NAME_RANGE_INFO(N) \ SSA_NAME_CHECK (N)->ssa_name.info.range_info diff --git a/gcc/value-query.cc b/gcc/value-query.cc index 1d7541c..51911bd 100644 --- a/gcc/value-query.cc +++ b/gcc/value-query.cc @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "value-query.h" #include "alloc-pool.h" #include "gimple-range.h" +#include "value-range-storage.h" // value_query default methods. @@ -271,13 +272,13 @@ range_query::get_tree_range (vrange &r, tree expr, gimple *stmt) // Return the range for NAME from SSA_NAME_RANGE_INFO. static inline void -get_ssa_name_range_info (irange &r, const_tree name) +get_ssa_name_range_info (vrange &r, const_tree name) { tree type = TREE_TYPE (name); gcc_checking_assert (!POINTER_TYPE_P (type)); gcc_checking_assert (TREE_CODE (name) == SSA_NAME); - range_info_def *ri = SSA_NAME_RANGE_INFO (name); + void *ri = SSA_NAME_RANGE_INFO (name); // Return VR_VARYING for SSA_NAMEs with NULL RANGE_INFO or SSA_NAMEs // with integral types width > 2 * HOST_BITS_PER_WIDE_INT precision. @@ -285,9 +286,10 @@ get_ssa_name_range_info (irange &r, const_tree name) > 2 * HOST_BITS_PER_WIDE_INT)) r.set_varying (type); else - r.set (wide_int_to_tree (type, ri->get_min ()), - wide_int_to_tree (type, ri->get_max ()), - SSA_NAME_RANGE_TYPE (name)); + { + vrange_storage vstore (NULL); + vstore.get_vrange (ri, r, TREE_TYPE (name)); + } } // Return nonnull attribute of pointer NAME from SSA_NAME_PTR_INFO. @@ -311,43 +313,6 @@ get_ssa_name_ptr_info_nonnull (const_tree name) } // Update the global range for NAME into the SSA_RANGE_NAME_INFO and -// SSA_NAME_PTR_INFO fields. Return TRUE if the range for NAME was -// updated. - -bool -update_global_range (vrange &r, tree name) -{ - tree type = TREE_TYPE (name); - - if (r.undefined_p () || r.varying_p ()) - return false; - - if (INTEGRAL_TYPE_P (type)) - { - // If a global range already exists, incorporate it. - if (SSA_NAME_RANGE_INFO (name)) - { - value_range glob; - get_ssa_name_range_info (glob, name); - r.intersect (glob); - } - if (r.undefined_p ()) - return false; - - set_range_info (name, as_a (r)); - return true; - } - else if (POINTER_TYPE_P (type)) - { - if (r.nonzero_p ()) - { - set_ptr_nonnull (name); - return true; - } - } - return false; -} - // Return the legacy global range for NAME if it has one, otherwise // return VARYING. @@ -372,7 +337,7 @@ get_range_global (vrange &r, tree name) r.set_nonzero (type); else if (INTEGRAL_TYPE_P (type)) { - get_ssa_name_range_info (as_a (r), name); + get_ssa_name_range_info (r, name); if (r.undefined_p ()) r.set_varying (type); } @@ -387,8 +352,7 @@ get_range_global (vrange &r, tree name) } else if (!POINTER_TYPE_P (type) && SSA_NAME_RANGE_INFO (name)) { - gcc_checking_assert (irange::supports_p (TREE_TYPE (name))); - get_ssa_name_range_info (as_a (r), name); + get_ssa_name_range_info (r, name); if (r.undefined_p ()) r.set_varying (type); } diff --git a/gcc/value-query.h b/gcc/value-query.h index 280e47e..fc638eb 100644 --- a/gcc/value-query.h +++ b/gcc/value-query.h @@ -144,6 +144,5 @@ get_range_query (const struct function *fun) } extern void gimple_range_global (vrange &v, tree name); -extern bool update_global_range (vrange &v, tree name); #endif // GCC_QUERY_H diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc index ac62bfa..8b5ab54 100644 --- a/gcc/value-range-storage.cc +++ b/gcc/value-range-storage.cc @@ -30,7 +30,8 @@ along with GCC; see the file COPYING3. If not see #include "gimple-range.h" #include "value-range-storage.h" -// Return a newly allocated slot holding R. +// Return a newly allocated slot holding R, or NULL if storing a range +// of R's type is not supported. void * vrange_storage::alloc_slot (const vrange &r) @@ -40,7 +41,6 @@ vrange_storage::alloc_slot (const vrange &r) if (is_a (r)) return irange_storage_slot::alloc_slot (*m_alloc, as_a (r)); - gcc_unreachable (); return NULL; } -- cgit v1.1 From 79f18ac6b7ab7744fcf8937ea4bc0c40f3efc629 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 11 Jul 2022 09:23:50 +0200 Subject: tree-optimization/106228 - fix vect_setup_realignment virtual SSA handling The following adds missing assignment of a virtual use operand to a created load to vect_setup_realignment which shows as bootstrap failure on powerpc64-linux and extra testsuite fails for targets when misaligned loads are not supported or not optimal. PR tree-optimization/106228 * tree-vect-data-refs.cc (vect_setup_realignment): Properly set a VUSE operand on the emitted load. --- gcc/tree-vect-data-refs.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc') diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index d20a10a..53e52cb 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -5780,6 +5780,13 @@ vect_setup_realignment (vec_info *vinfo, stmt_vec_info stmt_info, if (loop_for_initial_load) pe = loop_preheader_edge (loop_for_initial_load); + tree vuse; + gphi *vphi = get_virtual_phi (loop_for_initial_load->header); + if (vphi) + vuse = PHI_ARG_DEF_FROM_EDGE (vphi, pe); + else + vuse = gimple_vuse (gsi_stmt (*gsi)); + /* 3. For the case of the optimized realignment, create the first vector load at the loop preheader. */ @@ -5813,6 +5820,7 @@ vect_setup_realignment (vec_info *vinfo, stmt_vec_info stmt_info, new_stmt = gimple_build_assign (vec_dest, data_ref); new_temp = make_ssa_name (vec_dest, new_stmt); gimple_assign_set_lhs (new_stmt, new_temp); + gimple_set_vuse (new_stmt, vuse); if (pe) { new_bb = gsi_insert_on_edge_immediate (pe, new_stmt); -- cgit v1.1 From 4c94382a132a4b2b9d020806549a006fa6764d1b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 1 Jul 2022 14:11:35 +0200 Subject: target/105459 - allow delayed target option node fixup The following avoids the need to massage the target optimization node at WPA time when we fixup the optimization node, copying FP related flags from callee to caller. The target is already set up to fixup, but that only works when not switching between functions. After fixing that the fixup is then done at LTRANS time when materializing the function. 2022-07-01 Richard Biener PR target/105459 * config/i386/i386-options.cc (ix86_set_current_function): Rebuild the target optimization node whenever necessary, not only when the optimization node didn't change. * gcc.dg/lto/pr105459_0.c: New testcase. --- gcc/config/i386/i386-options.cc | 32 +++++++++++++------------------- gcc/testsuite/gcc.dg/lto/pr105459_0.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr105459_0.c (limited to 'gcc') diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index e11f681..acb2291 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -3232,28 +3232,22 @@ ix86_set_current_function (tree fndecl) if (new_tree == NULL_TREE) new_tree = target_option_default_node; - if (old_tree != new_tree) + bool fp_flag_change + = (flag_unsafe_math_optimizations + != TREE_TARGET_OPTION (new_tree)->x_ix86_unsafe_math_optimizations + || (flag_excess_precision + != TREE_TARGET_OPTION (new_tree)->x_ix86_excess_precision)); + if (old_tree != new_tree || fp_flag_change) { cl_target_option_restore (&global_options, &global_options_set, TREE_TARGET_OPTION (new_tree)); - if (TREE_TARGET_GLOBALS (new_tree)) - restore_target_globals (TREE_TARGET_GLOBALS (new_tree)); - else if (new_tree == target_option_default_node) - restore_target_globals (&default_target_globals); - else - TREE_TARGET_GLOBALS (new_tree) = save_target_globals_default_opts (); - } - else if (flag_unsafe_math_optimizations - != TREE_TARGET_OPTION (new_tree)->x_ix86_unsafe_math_optimizations - || (flag_excess_precision - != TREE_TARGET_OPTION (new_tree)->x_ix86_excess_precision)) - { - cl_target_option_restore (&global_options, &global_options_set, - TREE_TARGET_OPTION (new_tree)); - ix86_excess_precision = flag_excess_precision; - ix86_unsafe_math_optimizations = flag_unsafe_math_optimizations; - DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = new_tree - = build_target_option_node (&global_options, &global_options_set); + if (fp_flag_change) + { + ix86_excess_precision = flag_excess_precision; + ix86_unsafe_math_optimizations = flag_unsafe_math_optimizations; + DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = new_tree + = build_target_option_node (&global_options, &global_options_set); + } if (TREE_TARGET_GLOBALS (new_tree)) restore_target_globals (TREE_TARGET_GLOBALS (new_tree)); else if (new_tree == target_option_default_node) diff --git a/gcc/testsuite/gcc.dg/lto/pr105459_0.c b/gcc/testsuite/gcc.dg/lto/pr105459_0.c new file mode 100644 index 0000000..c799e6e --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr105459_0.c @@ -0,0 +1,35 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -flto -O1 } } } */ + +double m; +int n; + +__attribute__ ((optimize ("-funsafe-math-optimizations"))) +void +bar (int x) +{ + n = x; + m = n; +} + +__attribute__ ((flatten)) +void +foo (int x) +{ + bar (x); +} + +void +quux (void) +{ + ++n; +} + +int +main (void) +{ + foo (0); + quux (); + + return 0; +} -- cgit v1.1 From 06b2a2abe26554c6f9365676683d67368cbba206 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 11 Jul 2022 09:33:19 +0200 Subject: Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases Follow-up to recent commit 0587cef3d7962a8b0f44779589ba2920dd3d71e5 "c: Fix location for _Pragma tokens [PR97498]". gcc/testsuite/ * c-c++-common/gomp/pragma-3.c: Enhance '_Pragma' diagnostics verification. * c-c++-common/gomp/pragma-5.c: Likewise. libgomp/ * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Enhance '_Pragma' diagnostics verification. --- gcc/testsuite/c-c++-common/gomp/pragma-3.c | 8 +++++--- gcc/testsuite/c-c++-common/gomp/pragma-5.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/c-c++-common/gomp/pragma-3.c b/gcc/testsuite/c-c++-common/gomp/pragma-3.c index ae18e9b..3e1b211 100644 --- a/gcc/testsuite/c-c++-common/gomp/pragma-3.c +++ b/gcc/testsuite/c-c++-common/gomp/pragma-3.c @@ -2,13 +2,15 @@ /* PR preprocessor/103165 */ #define inner(...) #__VA_ARGS__ ; _Pragma("omp error severity(warning) message (\"Test\") at(compilation)") /* { dg-line inner_location } */ -#define outer(...) inner(__VA_ARGS__) +#define outer(...) inner(__VA_ARGS__) /* { dg-line outer_location } */ void f (void) { - const char *str = outer(inner(1,2)); - /* { dg-warning "'pragma omp error' encountered: Test" "inner expansion" { target *-*-* } inner_location } */ + const char *str = outer(inner(1,2)); /* { dg-line str_location } */ + /* { dg-warning "35:'pragma omp error' encountered: Test" "" { target *-*-* } inner_location } + { dg-note "20:in expansion of macro 'inner'" "" { target *-*-* } outer_location } + { dg-note "21:in expansion of macro 'outer'" "" { target *-*-* } str_location } */ } #if 0 diff --git a/gcc/testsuite/c-c++-common/gomp/pragma-5.c b/gcc/testsuite/c-c++-common/gomp/pragma-5.c index 8124f70..173c25e 100644 --- a/gcc/testsuite/c-c++-common/gomp/pragma-5.c +++ b/gcc/testsuite/c-c++-common/gomp/pragma-5.c @@ -2,13 +2,15 @@ /* PR preprocessor/103165 */ #define inner(...) #__VA_ARGS__ ; _Pragma ( " omp error severity (warning) message (\"Test\") at(compilation)" ) /* { dg-line inner_location } */ -#define outer(...) inner(__VA_ARGS__) +#define outer(...) inner(__VA_ARGS__) /* { dg-line outer_location } */ void f (void) { - const char *str = outer(inner(1,2)); - /* { dg-warning "'pragma omp error' encountered: Test" "inner expansion" { target *-*-* } inner_location } */ + const char *str = outer(inner(1,2)); /* { dg-line str_location } */ + /* { dg-warning "35:'pragma omp error' encountered: Test" "" { target *-*-* } inner_location } + { dg-note "20:in expansion of macro 'inner'" "" { target *-*-* } outer_location } + { dg-note "21:in expansion of macro 'outer'" "" { target *-*-* } str_location } */ } #if 0 -- cgit v1.1 From 74526710f7f78914e51d4748527cda2d30bbac5c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 7 Jul 2022 15:23:28 +0200 Subject: More update-ssa speedup When we do TODO_update_ssa_no_phi we already avoid computing dominance frontiers for all blocks - it is worth to also avoid walking all dominated blocks in the update domwalk and restrict the walk to the SEME region with the affected blocks. We can do that by walking the CFG in reverse from blocks_to_update to the common immediate dominator, marking blocks in the region and telling the domwalk to STOP when leaving it. For an artificial testcase with N adjacent loops with one unswitching opportunity that takes the incremental SSA updating off the -ftime-report radar: tree loop unswitching : 11.25 ( 3%) 0.09 ( 5%) 11.53 ( 3%) 36M ( 9%) `- tree SSA incremental : 35.74 ( 9%) 0.07 ( 4%) 36.65 ( 9%) 2734k ( 1%) improves to tree loop unswitching : 10.21 ( 3%) 0.05 ( 3%) 11.50 ( 3%) 36M ( 9%) `- tree SSA incremental : 0.66 ( 0%) 0.02 ( 1%) 0.49 ( 0%) 2734k ( 1%) for less localized updates the SEME region isn't likely constrained enough so I've restricted the extra work to TODO_update_ssa_no_phi callers. * tree-into-ssa.cc (rewrite_mode::REWRITE_UPDATE_REGION): New. (rewrite_update_dom_walker::rewrite_update_dom_walker): Update. (rewrite_update_dom_walker::m_in_region_flag): New. (rewrite_update_dom_walker::before_dom_children): If the region to update is marked, STOP at exits. (rewrite_blocks): For REWRITE_UPDATE_REGION mark the region to be updated. (dump_update_ssa): Use bitmap_empty_p. (update_ssa): Likewise. Use REWRITE_UPDATE_REGION when TODO_update_ssa_no_phi. * tree-cfgcleanup.cc (cleanup_tree_cfg_noloop): Account pending update_ssa to the caller. --- gcc/tree-cfgcleanup.cc | 6 +++- gcc/tree-into-ssa.cc | 97 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 90 insertions(+), 13 deletions(-) (limited to 'gcc') diff --git a/gcc/tree-cfgcleanup.cc b/gcc/tree-cfgcleanup.cc index b9ff689..3535a7e 100644 --- a/gcc/tree-cfgcleanup.cc +++ b/gcc/tree-cfgcleanup.cc @@ -1095,7 +1095,11 @@ cleanup_tree_cfg_noloop (unsigned ssa_update_flags) /* After doing the above SSA form should be valid (or an update SSA should be required). */ if (ssa_update_flags) - update_ssa (ssa_update_flags); + { + timevar_pop (TV_TREE_CLEANUP_CFG); + update_ssa (ssa_update_flags); + timevar_push (TV_TREE_CLEANUP_CFG); + } /* Compute dominator info which we need for the iterative process below. */ if (!dom_info_available_p (CDI_DOMINATORS)) diff --git a/gcc/tree-into-ssa.cc b/gcc/tree-into-ssa.cc index 9f45e62..be71b62 100644 --- a/gcc/tree-into-ssa.cc +++ b/gcc/tree-into-ssa.cc @@ -240,7 +240,8 @@ enum rewrite_mode { /* Incrementally update the SSA web by replacing existing SSA names with new ones. See update_ssa for details. */ - REWRITE_UPDATE + REWRITE_UPDATE, + REWRITE_UPDATE_REGION }; /* The set of symbols we ought to re-write into SSA form in update_ssa. */ @@ -2155,11 +2156,14 @@ rewrite_update_phi_arguments (basic_block bb) class rewrite_update_dom_walker : public dom_walker { public: - rewrite_update_dom_walker (cdi_direction direction) - : dom_walker (direction, ALL_BLOCKS, (int *)(uintptr_t)-1) {} + rewrite_update_dom_walker (cdi_direction direction, int in_region_flag = -1) + : dom_walker (direction, ALL_BLOCKS, (int *)(uintptr_t)-1), + m_in_region_flag (in_region_flag) {} edge before_dom_children (basic_block) final override; void after_dom_children (basic_block) final override; + + int m_in_region_flag; }; /* Initialization of block data structures for the incremental SSA @@ -2179,6 +2183,10 @@ rewrite_update_dom_walker::before_dom_children (basic_block bb) /* Mark the unwind point for this block. */ block_defs_stack.safe_push (NULL_TREE); + if (m_in_region_flag != -1 + && !(bb->flags & m_in_region_flag)) + return STOP; + if (!bitmap_bit_p (blocks_to_update, bb->index)) return NULL; @@ -2270,8 +2278,8 @@ rewrite_update_dom_walker::after_dom_children (basic_block bb ATTRIBUTE_UNUSED) WHAT indicates what actions will be taken by the renamer (see enum rewrite_mode). - BLOCKS are the set of interesting blocks for the dominator walker - to process. If this set is NULL, then all the nodes dominated + REGION is a SEME region of interesting blocks for the dominator walker + to process. If this set is invalid, then all the nodes dominated by ENTRY are walked. Otherwise, blocks dominated by ENTRY that are not present in BLOCKS are ignored. */ @@ -2283,9 +2291,71 @@ rewrite_blocks (basic_block entry, enum rewrite_mode what) /* Recursively walk the dominator tree rewriting each statement in each basic block. */ if (what == REWRITE_ALL) - rewrite_dom_walker (CDI_DOMINATORS).walk (entry); + rewrite_dom_walker (CDI_DOMINATORS).walk (entry); else if (what == REWRITE_UPDATE) - rewrite_update_dom_walker (CDI_DOMINATORS).walk (entry); + rewrite_update_dom_walker (CDI_DOMINATORS).walk (entry); + else if (what == REWRITE_UPDATE_REGION) + { + /* First mark all blocks in the SEME region dominated by + entry and exited by blocks not backwards reachable from + blocks_to_update. Optimize for dense blocks_to_update + so instead of seeding the worklist with a copy of + blocks_to_update treat those blocks explicit. */ + auto_bb_flag in_region (cfun); + auto_vec extra_rgn; + bitmap_iterator bi; + unsigned int idx; + EXECUTE_IF_SET_IN_BITMAP (blocks_to_update, 0, idx, bi) + { + basic_block bb = BASIC_BLOCK_FOR_FN (cfun, idx); + bb->flags |= in_region; + } + auto_bitmap worklist; + EXECUTE_IF_SET_IN_BITMAP (blocks_to_update, 0, idx, bi) + { + basic_block bb = BASIC_BLOCK_FOR_FN (cfun, idx); + if (bb != entry) + { + edge_iterator ei; + edge e; + FOR_EACH_EDGE (e, ei, bb->preds) + { + if ((e->src->flags & in_region) + || dominated_by_p (CDI_DOMINATORS, e->src, bb)) + continue; + bitmap_set_bit (worklist, e->src->index); + } + } + } + while (!bitmap_empty_p (worklist)) + { + int idx = bitmap_first_set_bit (worklist); + bitmap_clear_bit (worklist, idx); + basic_block bb = BASIC_BLOCK_FOR_FN (cfun, idx); + bb->flags |= in_region; + extra_rgn.safe_push (bb); + if (bb != entry) + { + edge_iterator ei; + edge e; + FOR_EACH_EDGE (e, ei, bb->preds) + { + if ((e->src->flags & in_region) + || dominated_by_p (CDI_DOMINATORS, e->src, bb)) + continue; + bitmap_set_bit (worklist, e->src->index); + } + } + } + rewrite_update_dom_walker (CDI_DOMINATORS, in_region).walk (entry); + EXECUTE_IF_SET_IN_BITMAP (blocks_to_update, 0, idx, bi) + { + basic_block bb = BASIC_BLOCK_FOR_FN (cfun, idx); + bb->flags &= ~in_region; + } + for (auto bb : extra_rgn) + bb->flags &= ~in_region; + } else gcc_unreachable (); @@ -2879,7 +2949,7 @@ dump_update_ssa (FILE *file) if (!need_ssa_update_p (cfun)) return; - if (new_ssa_names && bitmap_first_set_bit (new_ssa_names) >= 0) + if (new_ssa_names && !bitmap_empty_p (new_ssa_names)) { sbitmap_iterator sbi; @@ -3389,7 +3459,7 @@ update_ssa (unsigned update_flags) /* If there are names defined in the replacement table, prepare definition and use sites for all the names in NEW_SSA_NAMES and OLD_SSA_NAMES. */ - if (bitmap_first_set_bit (new_ssa_names) >= 0) + if (!bitmap_empty_p (new_ssa_names)) { statistics_counter_event (cfun, "Incremental SSA update", 1); @@ -3398,7 +3468,7 @@ update_ssa (unsigned update_flags) /* If all the names in NEW_SSA_NAMES had been marked for removal, and there are no symbols to rename, then there's nothing else to do. */ - if (bitmap_first_set_bit (new_ssa_names) < 0 + if (bitmap_empty_p (new_ssa_names) && !cfun->gimple_df->ssa_renaming_needed) goto done; } @@ -3503,8 +3573,11 @@ update_ssa (unsigned update_flags) FOR_EACH_VEC_ELT (symbols_to_rename, i, sym) get_var_info (sym)->info.current_def = NULL_TREE; - /* Now start the renaming process at START_BB. */ - rewrite_blocks (start_bb, REWRITE_UPDATE); + /* Now start the renaming process at START_BB. When not inserting PHIs + and thus we are avoiding work on all blocks, try to confine the + rewriting domwalk to the affected region, otherwise it's not worth it. */ + rewrite_blocks (start_bb, + insert_phi_p ? REWRITE_UPDATE : REWRITE_UPDATE_REGION); /* Debugging dumps. */ if (dump_file) -- cgit v1.1 From 415d2c38edadf97950eb14b8d7e6b1491c98cdd5 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 11 Jul 2022 12:07:05 +0200 Subject: tree-optimization/106228 - fixup last change The following fixes the last commit to honor the case we are not vectorizing a loop. PR tree-optimization/106228 * tree-vect-data-refs.cc (vect_setup_realignment): Adjust VUSE compute for the non-loop case. --- gcc/tree-vect-data-refs.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index 53e52cb..609cacc 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -5777,14 +5777,14 @@ vect_setup_realignment (vec_info *vinfo, stmt_vec_info stmt_info, if (at_loop) *at_loop = loop_for_initial_load; + tree vuse = NULL_TREE; if (loop_for_initial_load) - pe = loop_preheader_edge (loop_for_initial_load); - - tree vuse; - gphi *vphi = get_virtual_phi (loop_for_initial_load->header); - if (vphi) - vuse = PHI_ARG_DEF_FROM_EDGE (vphi, pe); - else + { + pe = loop_preheader_edge (loop_for_initial_load); + if (gphi *vphi = get_virtual_phi (loop_for_initial_load->header)) + vuse = PHI_ARG_DEF_FROM_EDGE (vphi, pe); + } + if (!vuse) vuse = gimple_vuse (gsi_stmt (*gsi)); /* 3. For the case of the optimized realignment, create the first vector -- cgit v1.1 From f1782a0a8c46a8897923f8e7aaf3846e86434170 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 11 Jul 2022 12:17:40 +0200 Subject: More update-ssa speedup When working on a smaller region like a loop version copy the main time spent is now dominance fast query recompute which does a full function DFS walk. The dominance queries within the region of interest should be O(log n) without fast queries and we should do on the order of O(n) of them which overall means reasonable complexity. For the artificial testcase I'm looking at this shaves off considerable time again. * tree-into-ssa.cc (update_ssa): Do not forcefully re-compute dominance fast queries for TODO_update_ssa_no_phi. --- gcc/tree-into-ssa.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/tree-into-ssa.cc b/gcc/tree-into-ssa.cc index be71b62..d13fb72 100644 --- a/gcc/tree-into-ssa.cc +++ b/gcc/tree-into-ssa.cc @@ -3451,11 +3451,13 @@ update_ssa (unsigned update_flags) phis_to_rewrite.create (last_basic_block_for_fn (cfun) + 1); blocks_to_update = BITMAP_ALLOC (NULL); - /* Ensure that the dominance information is up-to-date. */ - calculate_dominance_info (CDI_DOMINATORS); - insert_phi_p = (update_flags != TODO_update_ssa_no_phi); + /* Ensure that the dominance information is up-to-date and when we + are going to compute dominance frontiers fast queries are possible. */ + if (insert_phi_p || dom_info_state (CDI_DOMINATORS) == DOM_NONE) + calculate_dominance_info (CDI_DOMINATORS); + /* If there are names defined in the replacement table, prepare definition and use sites for all the names in NEW_SSA_NAMES and OLD_SSA_NAMES. */ -- cgit v1.1 From cb7b01db7a1979a45fd1dce87a8738e80568520e Mon Sep 17 00:00:00 2001 From: Lewis Hyatt Date: Mon, 11 Jul 2022 08:12:33 -0400 Subject: c-family: Fix option check in handle_pragma_diagnostic [PR106252] In r13-1544, handle_pragma_diagnostic was refactored to support processing early pragmas. During that process the part looking up option arguments was inadvertenly moved too early, prior to checking the option was valid, causing PR106252. Fixed by moving the check back where it goes. gcc/c-family/ChangeLog: PR preprocessor/106252 * c-pragma.cc (handle_pragma_diagnostic_impl): Don't look up the option argument prior to verifying the option was found. --- gcc/c-family/c-pragma.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc index 62bce2e..789719e 100644 --- a/gcc/c-family/c-pragma.cc +++ b/gcc/c-family/c-pragma.cc @@ -1009,10 +1009,6 @@ handle_pragma_diagnostic_impl () if (early && !c_option_is_from_cpp_diagnostics (option_index)) return; - const char *arg = NULL; - if (cl_options[option_index].flags & CL_JOINED) - arg = data.option_str + 1 + cl_options[option_index].opt_len; - if (option_index == OPT_SPECIAL_unknown) { if (want_diagnostics) @@ -1052,6 +1048,10 @@ handle_pragma_diagnostic_impl () return; } + const char *arg = NULL; + if (cl_options[option_index].flags & CL_JOINED) + arg = data.option_str + 1 + cl_options[option_index].opt_len; + struct cl_option_handlers handlers; set_default_handlers (&handlers, NULL); /* FIXME: input_location isn't the best location here, but it is -- cgit v1.1 From e7a7fed818d238d45b18dfd927cde93b4711052d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 11 Jul 2022 15:59:00 +0100 Subject: vect: Restore optab_vector argument [PR106250] In g:76c3041b856cb0 I'd removed a "C ? optab_vector : optab_mixed_sign" argument from a call to directly_supported_p, thinking that the argument only existed because of the condition (which I was removing). But the difference between the scalar and vector forms matters for shifts, so we do still need the argument. gcc/ PR tree-optimization/106250 * tree-vect-loop.cc (vectorizable_reduction): Reinstate final argument to directly_supported_p. --- gcc/testsuite/gcc.dg/vect/pr106250.c | 17 +++++++++++++++++ gcc/tree-vect-loop.cc | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr106250.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/vect/pr106250.c b/gcc/testsuite/gcc.dg/vect/pr106250.c new file mode 100644 index 0000000..7f25f55 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr106250.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +int +foo (unsigned long int x, int y, int z) +{ + int ret = 0; + + while (y < 1) + { + x *= 2; + ret = x == z; + z = y; + ++y; + } + + return ret; +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 3a70c15..2257b29 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -7369,7 +7369,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, dot-products. */ machine_mode vec_mode = TYPE_MODE (vectype_in); if (!lane_reduc_code_p - && !directly_supported_p (op.code, vectype_in)) + && !directly_supported_p (op.code, vectype_in, optab_vector)) { if (dump_enabled_p ()) dump_printf (MSG_NOTE, "op not supported by target.\n"); -- cgit v1.1 From c3ed9e0d6e96d8697e4bab994f8acbc5506240ee Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Mon, 11 Jul 2022 16:04:46 +0100 Subject: Improved Scalar-To-Vector (STV) support for TImode to V1TImode on x86_64. This patch upgrades x86_64's scalar-to-vector (STV) pass to more aggressively transform 128-bit scalar TImode operations into vector V1TImode operations performed on SSE registers. TImode functionality already exists in STV, but only for move operations. This change brings support for logical operations (AND, IOR, XOR, NOT and ANDN) and comparisons. The effect of these changes are conveniently demonstrated by the new sse4_1-stv-5.c test case: __int128 a[16]; __int128 b[16]; __int128 c[16]; void foo() { for (unsigned int i=0; i<16; i++) a[i] = b[i] & ~c[i]; } which when currently compiled on mainline wtih -O2 -msse4 produces: foo: xorl %eax, %eax .L2: movq c(%rax), %rsi movq c+8(%rax), %rdi addq $16, %rax notq %rsi notq %rdi andq b-16(%rax), %rsi andq b-8(%rax), %rdi movq %rsi, a-16(%rax) movq %rdi, a-8(%rax) cmpq $256, %rax jne .L2 ret but with this patch now produces: foo: xorl %eax, %eax .L2: movdqa c(%rax), %xmm0 pandn b(%rax), %xmm0 addq $16, %rax movaps %xmm0, a-16(%rax) cmpq $256, %rax jne .L2 ret Technically, the STV pass is implemented by three C++ classes, a common abstract base class "scalar_chain" that contains common functionality, and two derived classes: general_scalar_chain (which handles SI and DI modes) and timode_scalar_chain (which handles TI modes). As mentioned previously, because only TI mode moves were handled the two worker classes behaved significantly differently. These changes bring the functionality of these two classes closer together, which is reflected by refactoring more shared code from general_scalar_chain to the parent scalar_chain and reusing it from timode_scalar_chain. There still remain significant differences (and simplifications) so the existing division of classes (as specializations) continues to make sense. 2022-07-11 Roger Sayle gcc/ChangeLog * config/i386/i386-features.h (scalar_chain): Add fields insns_conv, n_sse_to_integer and n_integer_to_sse to this parent class, moved from general_scalar_chain. (scalar_chain::convert_compare): Protected method moved from general_scalar_chain. (mark_dual_mode_def): Make protected, not private virtual. (scalar_chain:convert_op): New private virtual method. (general_scalar_chain::general_scalar_chain): Simplify constructor. (general_scalar_chain::~general_scalar_chain): Delete destructor. (general_scalar_chain): Move insns_conv, n_sse_to_integer and n_integer_to_sse fields to parent class, scalar_chain. (general_scalar_chain::mark_dual_mode_def): Delete prototype. (general_scalar_chain::convert_compare): Delete prototype. (timode_scalar_chain::compute_convert_gain): Remove simplistic implementation, convert to a method prototype. (timode_scalar_chain::mark_dual_mode_def): Delete prototype. (timode_scalar_chain::convert_op): Prototype new virtual method. * config/i386/i386-features.cc (scalar_chain::scalar_chain): Allocate insns_conv and initialize n_sse_to_integer and n_integer_to_sse fields in constructor. (scalar_chain::scalar_chain): Free insns_conv in destructor. (general_scalar_chain::general_scalar_chain): Delete constructor, now defined in the class declaration. (general_scalar_chain::~general_scalar_chain): Delete destructor. (scalar_chain::mark_dual_mode_def): Renamed from general_scalar_chain::mark_dual_mode_def. (timode_scalar_chain::mark_dual_mode_def): Delete. (scalar_chain::convert_compare): Renamed from general_scalar_chain::convert_compare. (timode_scalar_chain::compute_convert_gain): New method to determine the gain from converting a TImode chain to V1TImode. (timode_scalar_chain::convert_op): New method to convert an operand from TImode to V1TImode. (timode_scalar_chain::convert_insn) : Only PUT_MODE on REG_EQUAL notes that were originally TImode (not CONST_INT). Handle AND, ANDN, XOR, IOR, NOT and COMPARE. (timode_mem_p): Helper predicate to check where operand is memory reference with sufficient alignment for TImode STV. (timode_scalar_to_vector_candidate_p): Use convertible_comparison_p to check whether COMPARE is convertible. Handle SET_DESTs that that are REG_P or MEM_P and SET_SRCs that are REG, CONST_INT, CONST_WIDE_INT, MEM, AND, ANDN, IOR, XOR or NOT. gcc/testsuite/ChangeLog * gcc.target/i386/sse4_1-stv-2.c: New test case, pand. * gcc.target/i386/sse4_1-stv-3.c: New test case, por. * gcc.target/i386/sse4_1-stv-4.c: New test case, pxor. * gcc.target/i386/sse4_1-stv-5.c: New test case, pandn. * gcc.target/i386/sse4_1-stv-6.c: New test case, ptest. --- gcc/config/i386/i386-features.cc | 330 +++++++++++++++++++++------ gcc/config/i386/i386-features.h | 31 +-- gcc/testsuite/gcc.target/i386/sse4_1-stv-2.c | 14 ++ gcc/testsuite/gcc.target/i386/sse4_1-stv-3.c | 14 ++ gcc/testsuite/gcc.target/i386/sse4_1-stv-4.c | 14 ++ gcc/testsuite/gcc.target/i386/sse4_1-stv-5.c | 14 ++ gcc/testsuite/gcc.target/i386/sse4_1-stv-6.c | 15 ++ 7 files changed, 347 insertions(+), 85 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/sse4_1-stv-2.c create mode 100644 gcc/testsuite/gcc.target/i386/sse4_1-stv-3.c create mode 100644 gcc/testsuite/gcc.target/i386/sse4_1-stv-4.c create mode 100644 gcc/testsuite/gcc.target/i386/sse4_1-stv-5.c create mode 100644 gcc/testsuite/gcc.target/i386/sse4_1-stv-6.c (limited to 'gcc') diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc index a7bd172..f1b03c3 100644 --- a/gcc/config/i386/i386-features.cc +++ b/gcc/config/i386/i386-features.cc @@ -291,7 +291,11 @@ scalar_chain::scalar_chain (enum machine_mode smode_, enum machine_mode vmode_) insns = BITMAP_ALLOC (NULL); defs = BITMAP_ALLOC (NULL); defs_conv = BITMAP_ALLOC (NULL); + insns_conv = BITMAP_ALLOC (NULL); queue = NULL; + + n_sse_to_integer = 0; + n_integer_to_sse = 0; } /* Free chain's data. */ @@ -301,6 +305,7 @@ scalar_chain::~scalar_chain () BITMAP_FREE (insns); BITMAP_FREE (defs); BITMAP_FREE (defs_conv); + BITMAP_FREE (insns_conv); bitmap_obstack_release (NULL); } @@ -319,25 +324,11 @@ scalar_chain::add_to_queue (unsigned insn_uid) bitmap_set_bit (queue, insn_uid); } -general_scalar_chain::general_scalar_chain (enum machine_mode smode_, - enum machine_mode vmode_) - : scalar_chain (smode_, vmode_) -{ - insns_conv = BITMAP_ALLOC (NULL); - n_sse_to_integer = 0; - n_integer_to_sse = 0; -} - -general_scalar_chain::~general_scalar_chain () -{ - BITMAP_FREE (insns_conv); -} - /* For DImode conversion, mark register defined by DEF as requiring conversion. */ void -general_scalar_chain::mark_dual_mode_def (df_ref def) +scalar_chain::mark_dual_mode_def (df_ref def) { gcc_assert (DF_REF_REG_DEF_P (def)); @@ -364,14 +355,6 @@ general_scalar_chain::mark_dual_mode_def (df_ref def) DF_REF_REGNO (def), DF_REF_INSN_UID (def), chain_id); } -/* For TImode conversion, it is unused. */ - -void -timode_scalar_chain::mark_dual_mode_def (df_ref) -{ - gcc_unreachable (); -} - /* Check REF's chain to add new insns into a queue and find registers requiring conversion. */ @@ -934,7 +917,7 @@ general_scalar_chain::convert_op (rtx *op, rtx_insn *insn) /* Convert COMPARE to vector mode. */ rtx -general_scalar_chain::convert_compare (rtx op1, rtx op2, rtx_insn *insn) +scalar_chain::convert_compare (rtx op1, rtx op2, rtx_insn *insn) { rtx tmp = gen_reg_rtx (vmode); rtx src; @@ -1068,7 +1051,7 @@ general_scalar_chain::convert_insn (rtx_insn *insn) emit_conversion_insns (gen_move_insn (dst, tmp), insn); dst = gen_rtx_SUBREG (vmode, tmp, 0); } - else if (REG_P (dst)) + else if (REG_P (dst) && GET_MODE (dst) == smode) { /* Replace the definition with a SUBREG to the definition we use inside the chain. */ @@ -1173,6 +1156,83 @@ general_scalar_chain::convert_insn (rtx_insn *insn) df_insn_rescan (insn); } +/* Compute a gain for chain conversion. */ + +int +timode_scalar_chain::compute_convert_gain () +{ + /* Assume that if we have to move TImode values between units, + then transforming this chain isn't worth it. */ + if (n_sse_to_integer || n_integer_to_sse) + return -1; + + bitmap_iterator bi; + unsigned insn_uid; + + /* Split ties to prefer V1TImode when not optimizing for size. */ + int gain = optimize_size ? 0 : 1; + + if (dump_file) + fprintf (dump_file, "Computing gain for chain #%d...\n", chain_id); + + EXECUTE_IF_SET_IN_BITMAP (insns, 0, insn_uid, bi) + { + rtx_insn *insn = DF_INSN_UID_GET (insn_uid)->insn; + rtx def_set = single_set (insn); + rtx src = SET_SRC (def_set); + rtx dst = SET_DEST (def_set); + int igain = 0; + + switch (GET_CODE (src)) + { + case REG: + if (optimize_insn_for_size_p ()) + igain = MEM_P (dst) ? COSTS_N_BYTES (6) : COSTS_N_BYTES (3); + else + igain = COSTS_N_INSNS (1); + break; + + case MEM: + igain = optimize_insn_for_size_p () ? COSTS_N_BYTES (7) + : COSTS_N_INSNS (1); + break; + + case CONST_INT: + if (MEM_P (dst) + && standard_sse_constant_p (src, V1TImode)) + igain = optimize_insn_for_size_p() ? COSTS_N_BYTES (11) : 1; + break; + + case NOT: + if (MEM_P (dst)) + igain = -COSTS_N_INSNS (1); + break; + + case AND: + case XOR: + case IOR: + if (!MEM_P (dst)) + igain = COSTS_N_INSNS (1); + break; + + default: + break; + } + + if (igain != 0 && dump_file) + { + fprintf (dump_file, " Instruction gain %d for ", igain); + dump_insn_slim (dump_file, insn); + } + gain += igain; + } + + if (dump_file) + fprintf (dump_file, " Total gain: %d\n", gain); + + return gain; +} + /* Fix uses of converted REG in debug insns. */ void @@ -1211,6 +1271,61 @@ timode_scalar_chain::fix_debug_reg_uses (rtx reg) } } +/* Convert operand OP in INSN from TImode to V1TImode. */ + +void +timode_scalar_chain::convert_op (rtx *op, rtx_insn *insn) +{ + *op = copy_rtx_if_shared (*op); + + if (REG_P (*op)) + *op = gen_rtx_SUBREG (V1TImode, *op, 0); + else if (MEM_P (*op)) + { + rtx tmp = gen_reg_rtx (V1TImode); + emit_insn_before (gen_rtx_SET (gen_rtx_SUBREG (V1TImode, tmp, 0), + gen_gpr_to_xmm_move_src (V1TImode, *op)), + insn); + *op = gen_rtx_SUBREG (V1TImode, tmp, 0); + + if (dump_file) + fprintf (dump_file, " Preloading operand for insn %d into r%d\n", + INSN_UID (insn), REGNO (tmp)); + } + else if (CONST_INT_P (*op)) + { + rtx vec_cst; + rtx tmp = gen_rtx_SUBREG (V1TImode, gen_reg_rtx (TImode), 0); + + /* Prefer all ones vector in case of -1. */ + if (constm1_operand (*op, TImode)) + vec_cst = CONSTM1_RTX (V1TImode); + else + { + rtx *v = XALLOCAVEC (rtx, 1); + v[0] = *op; + vec_cst = gen_rtx_CONST_VECTOR (V1TImode, gen_rtvec_v (1, v)); + } + + if (!standard_sse_constant_p (vec_cst, V1TImode)) + { + start_sequence (); + vec_cst = validize_mem (force_const_mem (V1TImode, vec_cst)); + rtx_insn *seq = get_insns (); + end_sequence (); + emit_insn_before (seq, insn); + } + + emit_insn_before (gen_move_insn (copy_rtx (tmp), vec_cst), insn); + *op = tmp; + } + else + { + gcc_assert (SUBREG_P (*op)); + gcc_assert (GET_MODE (*op) == vmode); + } +} + /* Convert INSN from TImode to V1T1mode. */ void @@ -1219,17 +1334,24 @@ timode_scalar_chain::convert_insn (rtx_insn *insn) rtx def_set = single_set (insn); rtx src = SET_SRC (def_set); rtx dst = SET_DEST (def_set); + rtx tmp; + if (MEM_P (dst) && !REG_P (src)) + { + /* There are no scalar integer instructions and therefore + temporary register usage is required. */ + } switch (GET_CODE (dst)) { case REG: - { - rtx tmp = find_reg_equal_equiv_note (insn); - if (tmp) - PUT_MODE (XEXP (tmp, 0), V1TImode); - PUT_MODE (dst, V1TImode); - fix_debug_reg_uses (dst); - } + if (GET_MODE (dst) == TImode) + { + tmp = find_reg_equal_equiv_note (insn); + if (tmp && GET_MODE (XEXP (tmp, 0)) == TImode) + PUT_MODE (XEXP (tmp, 0), V1TImode); + PUT_MODE (dst, V1TImode); + fix_debug_reg_uses (dst); + } break; case MEM: PUT_MODE (dst, V1TImode); @@ -1257,7 +1379,6 @@ timode_scalar_chain::convert_insn (rtx_insn *insn) { /* Since there are no instructions to store 128-bit constant, temporary register usage is required. */ - rtx tmp = gen_reg_rtx (V1TImode); start_sequence (); src = gen_rtx_CONST_VECTOR (V1TImode, gen_rtvec (1, src)); src = validize_mem (force_const_mem (V1TImode, src)); @@ -1265,8 +1386,12 @@ timode_scalar_chain::convert_insn (rtx_insn *insn) end_sequence (); if (seq) emit_insn_before (seq, insn); - emit_conversion_insns (gen_rtx_SET (dst, tmp), insn); - dst = tmp; + if (MEM_P (dst)) + { + tmp = gen_reg_rtx (V1TImode); + emit_insn_before (gen_rtx_SET (tmp, src), insn); + src = tmp; + } } break; @@ -1282,16 +1407,57 @@ timode_scalar_chain::convert_insn (rtx_insn *insn) default: gcc_unreachable (); } - if (NONDEBUG_INSN_P (insn)) + if (MEM_P (dst)) + { + tmp = gen_reg_rtx (V1TImode); + emit_insn_before (gen_rtx_SET (tmp, src), insn); + src = tmp; + } + break; + + case AND: + if (GET_CODE (XEXP (src, 0)) == NOT) + { + convert_op (&XEXP (XEXP (src, 0), 0), insn); + convert_op (&XEXP (src, 1), insn); + PUT_MODE (XEXP (src, 0), V1TImode); + PUT_MODE (src, V1TImode); + break; + } + /* FALLTHRU */ + + case XOR: + case IOR: + convert_op (&XEXP (src, 0), insn); + convert_op (&XEXP (src, 1), insn); + PUT_MODE (src, V1TImode); + if (MEM_P (dst)) { - rtx tmp = gen_reg_rtx (V1TImode); - /* Since there are no instructions to store standard SSE - constant, temporary register usage is required. */ - emit_conversion_insns (gen_rtx_SET (dst, tmp), insn); - dst = tmp; + tmp = gen_reg_rtx (V1TImode); + emit_insn_before (gen_rtx_SET (tmp, src), insn); + src = tmp; } break; + case NOT: + src = XEXP (src, 0); + convert_op (&src, insn); + tmp = gen_reg_rtx (V1TImode); + emit_insn_before (gen_move_insn (tmp, CONSTM1_RTX (V1TImode)), insn); + src = gen_rtx_XOR (V1TImode, src, tmp); + if (MEM_P (dst)) + { + tmp = gen_reg_rtx (V1TImode); + emit_insn_before (gen_rtx_SET (tmp, src), insn); + src = tmp; + } + break; + + case COMPARE: + dst = gen_rtx_REG (CCmode, FLAGS_REG); + src = convert_compare (XEXP (src, 0), XEXP (src, 1), insn); + break; + default: gcc_unreachable (); } @@ -1551,6 +1717,16 @@ general_scalar_to_vector_candidate_p (rtx_insn *insn, enum machine_mode mode) return true; } +/* Check for a suitable TImode memory operand. */ + +static bool +timode_mem_p (rtx x) +{ + return MEM_P (x) + && (TARGET_SSE_UNALIGNED_LOAD_OPTIMAL + || !misaligned_operand (x, TImode)); +} + /* The TImode version of scalar_to_vector_candidate_p. */ static bool @@ -1564,45 +1740,59 @@ timode_scalar_to_vector_candidate_p (rtx_insn *insn) rtx src = SET_SRC (def_set); rtx dst = SET_DEST (def_set); - /* Only TImode load and store are allowed. */ - if (GET_MODE (dst) != TImode) + if (GET_CODE (src) == COMPARE) + return convertible_comparison_p (insn, TImode); + + if (GET_MODE (dst) != TImode + || (GET_MODE (src) != TImode + && !CONST_SCALAR_INT_P (src))) return false; - if (MEM_P (dst)) - { - /* Check for store. Memory must be aligned or unaligned store - is optimal. Only support store from register, standard SSE - constant or CONST_WIDE_INT generated from piecewise store. + if (!REG_P (dst) && !MEM_P (dst)) + return false; - ??? Verify performance impact before enabling CONST_INT for - __int128 store. */ - if (misaligned_operand (dst, TImode) - && !TARGET_SSE_UNALIGNED_STORE_OPTIMAL) - return false; + if (MEM_P (dst) + && misaligned_operand (dst, TImode) + && !TARGET_SSE_UNALIGNED_STORE_OPTIMAL) + return false; - switch (GET_CODE (src)) - { - default: - return false; + switch (GET_CODE (src)) + { + case REG: + case CONST_WIDE_INT: + return true; - case REG: - case CONST_WIDE_INT: - return true; + case CONST_INT: + /* ??? Verify performance impact before enabling CONST_INT for + __int128 store. */ + return standard_sse_constant_p (src, TImode); - case CONST_INT: - return standard_sse_constant_p (src, TImode); - } - } - else if (MEM_P (src)) - { - /* Check for load. Memory must be aligned or unaligned load is - optimal. */ + case MEM: + /* Memory must be aligned or unaligned load is optimal. */ return (REG_P (dst) && (!misaligned_operand (src, TImode) || TARGET_SSE_UNALIGNED_LOAD_OPTIMAL)); - } - return false; + case AND: + if (!MEM_P (dst) + && GET_CODE (XEXP (src, 0)) == NOT + && REG_P (XEXP (XEXP (src, 0), 0)) + && (REG_P (XEXP (src, 1)) || timode_mem_p (XEXP (src, 1)))) + return true; + return REG_P (XEXP (src, 0)) + && (REG_P (XEXP (src, 1)) || timode_mem_p (XEXP (src, 1))); + + case IOR: + case XOR: + return REG_P (XEXP (src, 0)) + && (REG_P (XEXP (src, 1)) || timode_mem_p (XEXP (src, 1))); + + case NOT: + return REG_P (XEXP (src, 0)) || timode_mem_p (XEXP (src, 0)); + + default: + return false; + } } /* For a register REGNO, scan instructions for its defs and uses. diff --git a/gcc/config/i386/i386-features.h b/gcc/config/i386/i386-features.h index 839b63c..88b222d 100644 --- a/gcc/config/i386/i386-features.h +++ b/gcc/config/i386/i386-features.h @@ -148,6 +148,10 @@ class scalar_chain /* Registers used in both vector and sclar modes. */ bitmap defs_conv; + bitmap insns_conv; + unsigned n_sse_to_integer; + unsigned n_integer_to_sse; + void build (bitmap candidates, unsigned insn_uid); virtual int compute_convert_gain () = 0; int convert (); @@ -155,33 +159,31 @@ class scalar_chain protected: void add_to_queue (unsigned insn_uid); void emit_conversion_insns (rtx insns, rtx_insn *pos); + rtx convert_compare (rtx op1, rtx op2, rtx_insn *insn); + void mark_dual_mode_def (df_ref def); private: void add_insn (bitmap candidates, unsigned insn_uid); void analyze_register_chain (bitmap candidates, df_ref ref); - virtual void mark_dual_mode_def (df_ref def) = 0; virtual void convert_insn (rtx_insn *insn) = 0; virtual void convert_registers () = 0; + virtual void convert_op (rtx *op, rtx_insn *insn) = 0; }; class general_scalar_chain : public scalar_chain { public: - general_scalar_chain (enum machine_mode smode_, enum machine_mode vmode_); - ~general_scalar_chain (); + general_scalar_chain (enum machine_mode smode_, enum machine_mode vmode_) + : scalar_chain (smode_, vmode_) {} int compute_convert_gain () final override; + private: hash_map defs_map; - bitmap insns_conv; - unsigned n_sse_to_integer; - unsigned n_integer_to_sse; - void mark_dual_mode_def (df_ref def) final override; void convert_insn (rtx_insn *insn) final override; - void convert_op (rtx *op, rtx_insn *insn); void convert_reg (rtx_insn *insn, rtx dst, rtx src); + void convert_op (rtx *op, rtx_insn *insn); void make_vector_copies (rtx_insn *, rtx); void convert_registers () final override; - rtx convert_compare (rtx op1, rtx op2, rtx_insn *insn); int vector_const_cost (rtx exp); }; @@ -189,21 +191,20 @@ class timode_scalar_chain : public scalar_chain { public: timode_scalar_chain () : scalar_chain (TImode, V1TImode) {} - - /* Convert from TImode to V1TImode is always faster. */ - int compute_convert_gain () final override { return 1; } + int compute_convert_gain () final override; private: - void mark_dual_mode_def (df_ref def) final override; void fix_debug_reg_uses (rtx reg); void convert_insn (rtx_insn *insn) final override; - /* We don't convert registers to difference size. */ + void convert_op (rtx *op, rtx_insn *insn); + /* We don't convert registers to different size. */ void convert_registers () final override {} }; } // anon namespace -bool ix86_save_reg (unsigned int regno, bool maybe_eh_return, bool ignore_outlined); +bool ix86_save_reg (unsigned int regno, bool maybe_eh_return, + bool ignore_outlined); int ix86_compare_version_priority (tree decl1, tree decl2); tree ix86_generate_version_dispatcher_body (void *node_p); tree ix86_get_function_versions_dispatcher (void *decl); diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-stv-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-stv-2.c new file mode 100644 index 0000000..e637927 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_1-stv-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -msse4.1 -mstv -mno-stackrealign" } */ + +__int128 a[16]; +__int128 b[16]; +__int128 c[16]; + +void foo() +{ + for (unsigned int i=0; i<16; i++) + a[i] = b[i] & c[i]; +} + +/* { dg-final { scan-assembler "pand" } } */ diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-stv-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-stv-3.c new file mode 100644 index 0000000..bdc0bac --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_1-stv-3.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -msse4.1 -mstv -mno-stackrealign" } */ + +__int128 a[16]; +__int128 b[16]; +__int128 c[16]; + +void foo() +{ + for (unsigned int i=0; i<16; i++) + a[i] = b[i] | c[i]; +} + +/* { dg-final { scan-assembler "por" } } */ diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-stv-4.c b/gcc/testsuite/gcc.target/i386/sse4_1-stv-4.c new file mode 100644 index 0000000..a9ef619 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_1-stv-4.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -msse4.1 -mstv -mno-stackrealign" } */ + +__int128 a[16]; +__int128 b[16]; +__int128 c[16]; + +void foo() +{ + for (unsigned int i=0; i<16; i++) + a[i] = b[i] ^ c[i]; +} + +/* { dg-final { scan-assembler "pxor" } } */ diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-stv-5.c b/gcc/testsuite/gcc.target/i386/sse4_1-stv-5.c new file mode 100644 index 0000000..7eff3c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_1-stv-5.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -msse4.1 -mstv -mno-stackrealign" } */ + +__int128 a[16]; +__int128 b[16]; +__int128 c[16]; + +void foo() +{ + for (unsigned int i=0; i<16; i++) + a[i] = b[i] & ~c[i]; +} + +/* { dg-final { scan-assembler "pandn" } } */ diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-stv-6.c b/gcc/testsuite/gcc.target/i386/sse4_1-stv-6.c new file mode 100644 index 0000000..407bc55 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_1-stv-6.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -msse4.1 -mstv -mno-stackrealign" } */ + +__int128 a[16]; +__int128 b[16]; + +int foo() +{ + for (unsigned int i=0; i<16; i++) + if (a[i] == b[i]) + return i; + return -1; +} + +/* { dg-final { scan-assembler "ptest" } } */ -- cgit v1.1 From 12a9b98ac574bc8092a75849b5c462135d35c31d Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Fri, 8 Jul 2022 13:30:49 -0400 Subject: Avoid calling range_from_dom when dominator is already resolved. range_from_dom makes a recursive call to resolve the immediate dominator when there are multiple incoming edges to a block. This is not necessary when the dominator already has an on-entry cache value. PR tree-optimization/106234 * gimple-range-cache.cc (ranger_cache::range_from_dom): Check dominator cache value before recursively resolving it. --- gcc/gimple-range-cache.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 9be8bc6..da7b805 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -1359,10 +1359,11 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb, m_workback.quick_push (prev_bb); else if (mode == RFD_FILL) { - // Multiple incoming edges, so recursively satisfy this block, - // store the range, then calculate the incoming range for PREV_BB. - if (def_bb != bb) + // Multiple incoming edges, so recursively satisfy this block + // if it doesn't already have a value, and store the range. + if (!m_on_entry.bb_range_p (name, bb) && def_bb != bb) { + // If the dominator has not been set, look it up. range_from_dom (r, name, bb, RFD_FILL); // If the range can't be store, don't try to accumulate // the range in PREV_BB due to excessive recalculations. -- cgit v1.1 From c72d471469456d75af95621fb2234f8706adf1c8 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 12 Jul 2022 00:16:27 +0000 Subject: Daily bump. --- gcc/ChangeLog | 137 ++++++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/c-family/ChangeLog | 6 +++ gcc/testsuite/ChangeLog | 24 +++++++++ 4 files changed, 168 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d66115f..3db624b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,140 @@ +2022-07-11 Andrew MacLeod + + PR tree-optimization/106234 + * gimple-range-cache.cc (ranger_cache::range_from_dom): Check dominator + cache value before recursively resolving it. + +2022-07-11 Roger Sayle + + * config/i386/i386-features.h (scalar_chain): Add fields + insns_conv, n_sse_to_integer and n_integer_to_sse to this + parent class, moved from general_scalar_chain. + (scalar_chain::convert_compare): Protected method moved + from general_scalar_chain. + (mark_dual_mode_def): Make protected, not private virtual. + (scalar_chain:convert_op): New private virtual method. + (general_scalar_chain::general_scalar_chain): Simplify constructor. + (general_scalar_chain::~general_scalar_chain): Delete destructor. + (general_scalar_chain): Move insns_conv, n_sse_to_integer and + n_integer_to_sse fields to parent class, scalar_chain. + (general_scalar_chain::mark_dual_mode_def): Delete prototype. + (general_scalar_chain::convert_compare): Delete prototype. + (timode_scalar_chain::compute_convert_gain): Remove simplistic + implementation, convert to a method prototype. + (timode_scalar_chain::mark_dual_mode_def): Delete prototype. + (timode_scalar_chain::convert_op): Prototype new virtual method. + * config/i386/i386-features.cc (scalar_chain::scalar_chain): + Allocate insns_conv and initialize n_sse_to_integer and + n_integer_to_sse fields in constructor. + (scalar_chain::scalar_chain): Free insns_conv in destructor. + (general_scalar_chain::general_scalar_chain): Delete + constructor, now defined in the class declaration. + (general_scalar_chain::~general_scalar_chain): Delete destructor. + (scalar_chain::mark_dual_mode_def): Renamed from + general_scalar_chain::mark_dual_mode_def. + (timode_scalar_chain::mark_dual_mode_def): Delete. + (scalar_chain::convert_compare): Renamed from + general_scalar_chain::convert_compare. + (timode_scalar_chain::compute_convert_gain): New method to + determine the gain from converting a TImode chain to V1TImode. + (timode_scalar_chain::convert_op): New method to convert an + operand from TImode to V1TImode. + (timode_scalar_chain::convert_insn) : Only PUT_MODE + on REG_EQUAL notes that were originally TImode (not CONST_INT). + Handle AND, ANDN, XOR, IOR, NOT and COMPARE. + (timode_mem_p): Helper predicate to check where operand is + memory reference with sufficient alignment for TImode STV. + (timode_scalar_to_vector_candidate_p): Use convertible_comparison_p + to check whether COMPARE is convertible. Handle SET_DESTs that + that are REG_P or MEM_P and SET_SRCs that are REG, CONST_INT, + CONST_WIDE_INT, MEM, AND, ANDN, IOR, XOR or NOT. + +2022-07-11 Richard Sandiford + + PR tree-optimization/106250 + * tree-vect-loop.cc (vectorizable_reduction): Reinstate final + argument to directly_supported_p. + +2022-07-11 Richard Biener + + * tree-into-ssa.cc (update_ssa): Do not forcefully + re-compute dominance fast queries for TODO_update_ssa_no_phi. + +2022-07-11 Richard Biener + + PR tree-optimization/106228 + * tree-vect-data-refs.cc (vect_setup_realignment): Adjust + VUSE compute for the non-loop case. + +2022-07-11 Richard Biener + + * tree-into-ssa.cc (rewrite_mode::REWRITE_UPDATE_REGION): New. + (rewrite_update_dom_walker::rewrite_update_dom_walker): Update. + (rewrite_update_dom_walker::m_in_region_flag): New. + (rewrite_update_dom_walker::before_dom_children): If the region + to update is marked, STOP at exits. + (rewrite_blocks): For REWRITE_UPDATE_REGION mark the region + to be updated. + (dump_update_ssa): Use bitmap_empty_p. + (update_ssa): Likewise. Use REWRITE_UPDATE_REGION when + TODO_update_ssa_no_phi. + * tree-cfgcleanup.cc (cleanup_tree_cfg_noloop): Account + pending update_ssa to the caller. + +2022-07-11 Richard Biener + + PR target/105459 + * config/i386/i386-options.cc (ix86_set_current_function): + Rebuild the target optimization node whenever necessary, + not only when the optimization node didn't change. + +2022-07-11 Richard Biener + + PR tree-optimization/106228 + * tree-vect-data-refs.cc (vect_setup_realignment): Properly + set a VUSE operand on the emitted load. + +2022-07-11 Aldy Hernandez + + * gimple-range.cc (gimple_ranger::export_global_ranges): Remove + verification against legacy value_range. + (gimple_ranger::register_inferred_ranges): Same. + (gimple_ranger::export_global_ranges): Rename update_global_range + to set_range_info. + * tree-core.h (struct range_info_def): Remove. + (struct irange_storage_slot): New. + (struct tree_base): Remove SSA_NAME_ANTI_RANGE_P documentation. + (struct tree_ssa_name): Add vrange_storage support. + * tree-ssanames.cc (range_info_p): New. + (range_info_fits_p): New. + (range_info_alloc): New. + (range_info_free): New. + (range_info_get_range): New. + (range_info_set_range): New. + (set_range_info_raw): Remove. + (set_range_info): Adjust to use vrange_storage. + (set_nonzero_bits): Same. + (get_nonzero_bits): Same. + (duplicate_ssa_name_range_info): Remove overload taking + value_range_kind. + Rewrite tree overload to use vrange_storage. + (duplicate_ssa_name_fn): Adjust to use vrange_storage. + * tree-ssanames.h (struct range_info_def): Remove. + (set_range_info): Adjust prototype to take vrange. + * tree-vrp.cc (vrp_asserts::remove_range_assertions): Call + duplicate_ssa_name_range_info. + * tree.h (SSA_NAME_ANTI_RANGE_P): Remove. + (SSA_NAME_RANGE_TYPE): Remove. + * value-query.cc (get_ssa_name_range_info): Adjust to use + vrange_storage. + (update_global_range): Remove. + (get_range_global): Remove as_a. + * value-query.h (update_global_range): Remove. + * tree-ssa-dom.cc (set_global_ranges_from_unreachable_edges): + Rename update_global_range to set_range_info. + * value-range-storage.cc (vrange_storage::alloc_slot): Remove + gcc_unreachable. + 2022-07-10 Aldy Hernandez * value-range.cc (irange::operator=): Call verify_range. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 691f2ec..40dba6d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20220711 +20220712 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index e16014f..d46eb18 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2022-07-11 Lewis Hyatt + + PR preprocessor/106252 + * c-pragma.cc (handle_pragma_diagnostic_impl): Don't look up the + option argument prior to verifying the option was found. + 2022-07-07 David Malcolm * c-format.cc (range_label_for_format_type_mismatch::get_text): diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d156840..7b95680 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,27 @@ +2022-07-11 Roger Sayle + + * gcc.target/i386/sse4_1-stv-2.c: New test case, pand. + * gcc.target/i386/sse4_1-stv-3.c: New test case, por. + * gcc.target/i386/sse4_1-stv-4.c: New test case, pxor. + * gcc.target/i386/sse4_1-stv-5.c: New test case, pandn. + * gcc.target/i386/sse4_1-stv-6.c: New test case, ptest. + +2022-07-11 Richard Sandiford + + PR tree-optimization/106250 + * gcc.dg/vect/pr106250.c: New file. + +2022-07-11 Thomas Schwinge + + * c-c++-common/gomp/pragma-3.c: Enhance '_Pragma' diagnostics + verification. + * c-c++-common/gomp/pragma-5.c: Likewise. + +2022-07-11 Richard Biener + + PR target/105459 + * gcc.dg/lto/pr105459_0.c: New testcase. + 2022-07-10 Lewis Hyatt PR preprocessor/97498 -- cgit v1.1