Re: [[C++ PATCH]] Implement C++2a P0330R2 - Literal Suffixes for ptrdiff_t and size_t
On 1/27/21 3:32 PM, Jakub Jelinek wrote: On Sun, Oct 21, 2018 at 04:39:30PM -0400, Ed Smith-Rowland wrote: This patch implements C++2a proposal P0330R2 Literal Suffixes for ptrdiff_t and size_t*. It's not official yet but looks very likely to pass. It is incomplete because I'm looking for some opinions. 9We also might wait 'till it actually passes). This paper takes the direction of a language change rather than a library change through C++11 literal operators. This was after feedback on that paper after a few iterations. As coded in this patch, integer suffixes involving 'z' are errors in C and warnings for C++ <= 17 (in addition to the usual warning about implementation suffixes shadowing user-defined ones). OTOH, the 'z' suffix is not currently legal - it can't break currently-correct code in any C/C++ dialect. furthermore, I suspect the language direction was chosen to accommodate a similar addition to C20. I'm thinking of making this feature available as an extension to all of C/C++ perhaps with appropriate pedwarn. GCC now supports -std=c++2b and -std=gnu++2b, are you going to update your patch against it (and change for z/Z standing for ssize_t rather than ptrdiff_t), plus incorporate the feedback from Joseph and Jason? Jakub Here is a rebased patch that is a bit leaner than the original. Since I chose to be conservative in applying this just to C++23 I'm not adding this to C or t earlier versions of C++ as extensions. We can add that if people really want, maybe in stage 1. The compat warning for C++ < 23 is not optional. since the suffixes are not preceded by '-' I don't hav much sympathy if people tried to make a literal 'z' operator. Which is the only reason I can see for a warning suppression. Built and tested on x86_64. Ok? diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index dca6815a876..48dec21d4b4 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -1025,6 +1025,11 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_aggregate_paren_init=201902L"); cpp_define (pfile, "__cpp_using_enum=201907L"); } + if (cxx_dialect > cxx20) + { + /* Set feature test macros for C++23. */ + cpp_define (pfile, "__cpp_size_t_suffix=202006L"); + } if (flag_concepts) { if (cxx_dialect >= cxx20) diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index fe40a0f728b..02e397bb0c0 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -834,6 +834,14 @@ interpret_integer (const cpp_token *token, unsigned int flags, type = ((flags & CPP_N_UNSIGNED) ? widest_unsigned_literal_type_node : widest_integer_literal_type_node); + else if (flags & CPP_N_SIZE_T) +{ + /* itk refers to fundamental types not aliased size types. */ + if (flags & CPP_N_UNSIGNED) + type = size_type_node; + else + type = ptrdiff_type_node; +} else { type = integer_types[itk]; diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C index f8d84ed..a30ec0f4f7e 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-shadow-neg.C @@ -17,6 +17,30 @@ unsigned long long int operator"" ull(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } { return k; } +unsigned long long int +operator"" z(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" uz(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" zu(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" Z(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" UZ(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" ZU(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + // Namespaces are no hiding place. namespace Long { @@ -37,13 +61,50 @@ unsigned long long int operator"" ull(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } { return k; } +unsigned long long int +operator"" z(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" uz(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{ return k; } + +unsigned long long int +operator"" zu(unsigned long long int k) // { dg-warning "integer suffix|shadowed by implementation" } +{
[PATCH] tree-optimization/98499 - fix modref analysis on RVO statements
From: Sergei Trofimovich Before the change RVO gimple statements were treated as local stores by modres analysis. But in practice RVO escapes target. 2021-01-30 Sergei Trofimovich gcc/ChangeLog: PR tree-optimization/98499 * ipa-modref.c: treat RVO conservatively and assume all possible side-effects. gcc/testsuite/ChangeLog: PR tree-optimization/98499 * g++.dg/pr98499.C: new test. --- gcc/ipa-modref.c | 14 -- gcc/testsuite/g++.dg/pr98499.C | 31 +++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pr98499.C diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index b362de77e74..7aaf53be8f4 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1621,9 +1621,19 @@ analyze_ssa_name_flags (tree name, vec , int depth, else if (gcall *call = dyn_cast (use_stmt)) { tree callee = gimple_call_fndecl (call); - + /* Return slot optiomization would require bit of propagation; +give up for now. */ + if (gimple_call_return_slot_opt_p (call) + && gimple_call_lhs (call) != NULL_TREE + && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (call + { + if (dump_file) + fprintf (dump_file, "%*s Unhandled return slot opt\n", +depth * 4, ""); + lattice[index].merge (0); + } /* Recursion would require bit of propagation; give up for now. */ - if (callee && !ipa && recursive_call_p (current_function_decl, + else if (callee && !ipa && recursive_call_p (current_function_decl, callee)) lattice[index].merge (0); else diff --git a/gcc/testsuite/g++.dg/pr98499.C b/gcc/testsuite/g++.dg/pr98499.C new file mode 100644 index 000..ace088aeed9 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr98499.C @@ -0,0 +1,31 @@ +/* PR tree-optimization/98499. */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +struct string { + // pointer to local store + char * _M_buf; + // local store + char _M_local_buf[16]; + + __attribute__((noinline)) string() : _M_buf(_M_local_buf) {} + + ~string() { +if (_M_buf != _M_local_buf) + __builtin_trap(); + } + + string(const string &__str); // no copies +}; + +__attribute__((noinline)) static string dir_name() { return string(); } +class Importer { + string base_path; + +public: + __attribute__((noinline)) Importer() : base_path (dir_name()) {} +}; + +int main() { + Importer imp; +} -- 2.30.0
[PATCH] Permit use of AIX Vector extended ABI mode
AIX only permits use of Altivec VSRs 20-31 in a Vector Extended ABI mode. This patch explicitly enables use of the VSRs using the new -mabi=vec-extabi command line option also implemented in LLVM for AIX. Bootstrapped on powerpc-ibm-aix7.2.3.0 and powerpc64le-linux-gnu. gcc/ChangeLog: * config/rs6000/rs6000.opt (mabi=vec-extabi): New. (mabi=vec-default): New. * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define __EXTABI__ for AIX Vector extended ABI. * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print AIX Vector extabi info. (conditional_register_usage): If AIX vec_extabi enabled, vs20-vs31 are non-volatile. * doc/invoke.texi (PowerPC mabi): Add AIX vec-extabi and vec-default. diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 656cdb39f3f..06b3bc0df33 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -483,6 +483,8 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags, /* Define this when supporting context-sensitive keywords. */ if (!flag_iso) rs6000_define_or_undefine_macro (define_p, "__APPLE_ALTIVEC__"); + if (rs6000_aix_extabi) + rs6000_define_or_undefine_macro (define_p, "__EXTABI__"); } /* Note that the OPTION_MASK_VSX flag is automatically turned on in the following conditions: diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fbaff289a40..0d5ef38bd82 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2512,6 +2512,9 @@ rs6000_debug_reg_global (void) if (rs6000_altivec_abi) fprintf (stderr, DEBUG_FMT_S, "altivec_abi", "true"); + if (rs6000_aix_extabi) +fprintf (stderr, DEBUG_FMT_S, "AIX vec-extabi", "true"); + if (rs6000_darwin64_abi) fprintf (stderr, DEBUG_FMT_S, "darwin64_abi", "true"); @@ -9815,7 +9818,7 @@ rs6000_conditional_register_usage (void) call_used_regs[i] = 1; /* AIX reserves VR20:31 in non-extended ABI mode. */ - if (TARGET_XCOFF) + if (TARGET_XCOFF && !rs6000_aix_extabi) for (i = FIRST_ALTIVEC_REGNO + 20; i < FIRST_ALTIVEC_REGNO + 32; ++i) fixed_regs[i] = call_used_regs[i] = 1; } diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 6240f779694..7aaabf39b25 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -352,6 +352,7 @@ mdebug= Target RejectNegative Joined -mdebug= Enable debug output. +; Altivec ABI mabi=altivec Target RejectNegative Var(rs6000_altivec_abi) Save Use the AltiVec ABI extensions. @@ -360,6 +361,16 @@ mabi=no-altivec Target RejectNegative Var(rs6000_altivec_abi, 0) Do not use the AltiVec ABI extensions. +; AIX Extended vector ABI +mabi=vec-extabi +Target RejectNegative Var(rs6000_aix_extabi, 1) Save +Use the AIX Vector Extended ABI + +mabi=vec-default +Target RejectNegative Var(rs6000_aix_extabi, 0) +Do not use the AIX Vector Extended ABI + +; PPC64 Linux ELF ABI mabi=elfv1 Target RejectNegative Var(rs6000_elf_abi, 1) Save Use the ELFv1 ABI. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a89d3859d6d..3751bc3ac7c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -27509,9 +27509,10 @@ SVR4 ABI)@. @item -mabi=@var{abi-type} @opindex mabi Extend the current ABI with a particular extension, or remove such extension. -Valid values are @samp{altivec}, @samp{no-altivec}, +Valid values are: @samp{altivec}, @samp{no-altivec}, @samp{ibmlongdouble}, @samp{ieeelongdouble}, -@samp{elfv1}, @samp{elfv2}@. +@samp{elfv1}, @samp{elfv2}, +and for AIX: @samp{vec-extabi}, @samp{vec-default}@. @item -mabi=ibmlongdouble @opindex mabi=ibmlongdouble
Re: [PATCH] i386, df: Fix up gcc.c-torture/compile/20051216-1.c -O1 -march=cascadelake
On January 30, 2021 11:52:20 AM GMT+01:00, Jakub Jelinek wrote: >On Sat, Jan 30, 2021 at 11:47:24AM +0100, Richard Biener wrote: >> OK, so I'd prefer we simply unset the flag after processing deferred >rescan. I clearly misread the function to do that. > >This works too, will bootstrap/regtest it now. OK. Richard. >2021-01-29 Jakub Jelinek > > * config/i386/i386-features.c (remove_partial_avx_dependency): Clear > DF_DEFER_INSN_RESCAN after calling df_process_deferred_rescans. > > * gcc.target/i386/20051216-1.c: New test. > >--- gcc/config/i386/i386-features.c.jj 2021-01-30 10:48:09.788800773 >+0100 >+++ gcc/config/i386/i386-features.c2021-01-30 11:50:36.458872261 +0100 >@@ -2409,6 +2409,7 @@ remove_partial_avx_dependency (void) > } > > df_process_deferred_rescans (); >+ df_clear_flags (DF_DEFER_INSN_RESCAN); > bitmap_obstack_release (NULL); > BITMAP_FREE (convert_bbs); > >--- gcc/testsuite/gcc.target/i386/20051216-1.c.jj 2021-01-30 >11:41:15.558293070 +0100 >+++ gcc/testsuite/gcc.target/i386/20051216-1.c 2021-01-30 >11:41:15.558293070 +0100 >@@ -0,0 +1,5 @@ >+/* PR rtl-optimization/25432 */ >+/* { dg-do compile } */ >+/* { dg-options "-O1 -march=cascadelake" } */ >+ >+#include "../../gcc.c-torture/compile/20051216-1.c" > > > Jakub
Re: [PATCH] i386, df: Fix up gcc.c-torture/compile/20051216-1.c -O1 -march=cascadelake
On Sat, Jan 30, 2021 at 11:47:24AM +0100, Richard Biener wrote: > OK, so I'd prefer we simply unset the flag after processing deferred rescan. > I clearly misread the function to do that. This works too, will bootstrap/regtest it now. 2021-01-29 Jakub Jelinek * config/i386/i386-features.c (remove_partial_avx_dependency): Clear DF_DEFER_INSN_RESCAN after calling df_process_deferred_rescans. * gcc.target/i386/20051216-1.c: New test. --- gcc/config/i386/i386-features.c.jj 2021-01-30 10:48:09.788800773 +0100 +++ gcc/config/i386/i386-features.c 2021-01-30 11:50:36.458872261 +0100 @@ -2409,6 +2409,7 @@ remove_partial_avx_dependency (void) } df_process_deferred_rescans (); + df_clear_flags (DF_DEFER_INSN_RESCAN); bitmap_obstack_release (NULL); BITMAP_FREE (convert_bbs); --- gcc/testsuite/gcc.target/i386/20051216-1.c.jj 2021-01-30 11:41:15.558293070 +0100 +++ gcc/testsuite/gcc.target/i386/20051216-1.c 2021-01-30 11:41:15.558293070 +0100 @@ -0,0 +1,5 @@ +/* PR rtl-optimization/25432 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -march=cascadelake" } */ + +#include "../../gcc.c-torture/compile/20051216-1.c" Jakub
Re: [PATCH] i386, df: Fix up gcc.c-torture/compile/20051216-1.c -O1 -march=cascadelake
On January 30, 2021 10:46:17 AM GMT+01:00, Jakub Jelinek wrote: >On Sat, Jan 30, 2021 at 09:17:45AM +0100, Richard Biener wrote: >> >The following patch fixes it, ok for trunk if it passes >> >bootstrap/regtest? >> >> Hmm, that's odd. Who relies on deferred rescan being the default? >Finish >> pass, via processing deferred insns also resets it back. Or is this >> documented somewhere? > >Ifcvt clearly relies on non-deferred rescanning. >And yes, df_finish_pass clears df->changeable_flags, but we don't do >that >for this pass anymore (removal of TODO_df_finish), as that pass didn't >call >df_analyze either. >df_process_deferred_rescans temporarily clears DF_DEFER_INSN_RESCAN >flag, but restores it to the previous state at the end. > >So, I think we either need what I posted (which passed >bootstrap/regtest >on x86_64-linux and i686-linux), or we need to restore TODO_df_finish >for the pass. >Given that the pass previously did call df_analyze () only >conditionally, >not at all in many functions, and had TODO_df_finish unconditionally, >perhaps that needs to work even if it wasn't meant to be used that way. OK, so I'd prefer we simply unset the flag after processing deferred rescan. I clearly misread the function to do that. Richard. >> >2021-01-29 Jakub Jelinek >> > >> >* config/i386/i386-features.c (remove_partial_avx_dependency): >> >Remember >> >whether DF_DEFER_INSN_RESCAN has been active before or not, and >> >reset it to previous state. >> > >> >* gcc.target/i386/20051216-1.c: New test. >> > >> >--- gcc/config/i386/i386-features.c.jj 2021-01-29 20:39:10.561912947 >> >+0100 >> >+++ gcc/config/i386/i386-features.c 2021-01-29 20:59:06.254740315 >+0100 >> >@@ -2273,7 +2273,7 @@ remove_partial_avx_dependency (void) >> > auto_vec control_flow_insns; >> > >> > /* We create invalid RTL initially so defer rescans. */ >> >- df_set_flags (DF_DEFER_INSN_RESCAN); >> >+ int prev_df_flags = df_set_flags (DF_DEFER_INSN_RESCAN); >> > >> > FOR_EACH_BB_FN (bb, cfun) >> > { >> >@@ -2409,6 +2409,8 @@ remove_partial_avx_dependency (void) >> > } >> > >> > df_process_deferred_rescans (); >> >+ if ((prev_df_flags & DF_DEFER_INSN_RESCAN) == 0) >> >+df_clear_flags (DF_DEFER_INSN_RESCAN); >> > bitmap_obstack_release (NULL); >> > BITMAP_FREE (convert_bbs); >> > >> >--- gcc/testsuite/gcc.target/i386/20051216-1.c.jj 2021-01-29 >> >21:06:20.386960652 +0100 >> >+++ gcc/testsuite/gcc.target/i386/20051216-1.c 2021-01-29 >> >21:03:17.599973093 +0100 >> >@@ -0,0 +1,5 @@ >> >+/* PR rtl-optimization/25432 */ >> >+/* { dg-do compile } */ >> >+/* { dg-options "-O1 -march=cascadelake" } */ >> >+ >> >+#include "../../gcc.c-torture/compile/20051216-1.c" >> > >> > >> >Jakub > > Jakub
Re: [PATCH] i386, df: Fix up gcc.c-torture/compile/20051216-1.c -O1 -march=cascadelake
On Sat, Jan 30, 2021 at 10:46:17AM +0100, Jakub Jelinek via Gcc-patches wrote: > On Sat, Jan 30, 2021 at 09:17:45AM +0100, Richard Biener wrote: > > >The following patch fixes it, ok for trunk if it passes > > >bootstrap/regtest? > > > > Hmm, that's odd. Who relies on deferred rescan being the default? Finish > > pass, via processing deferred insns also resets it back. Or is this > > documented somewhere? > > Ifcvt clearly relies on non-deferred rescanning. > And yes, df_finish_pass clears df->changeable_flags, but we don't do that > for this pass anymore (removal of TODO_df_finish), as that pass didn't call > df_analyze either. > df_process_deferred_rescans temporarily clears DF_DEFER_INSN_RESCAN > flag, but restores it to the previous state at the end. > > So, I think we either need what I posted (which passed bootstrap/regtest > on x86_64-linux and i686-linux), or we need to restore TODO_df_finish > for the pass. > Given that the pass previously did call df_analyze () only conditionally, > not at all in many functions, and had TODO_df_finish unconditionally, > perhaps that needs to work even if it wasn't meant to be used that way. The following works too, can bootstrap/regtest it if you prefer it that way: 2021-01-29 Jakub Jelinek * config/i386/i386-features.c (remove_partial_avx_dependency): Don't call df_process_deferred_rescans. (pass_data_remove_partial_avx_dependency): Readd TODO_df_finish. * gcc.target/i386/20051216-1.c: New test. --- gcc/config/i386/i386-features.c.jj 2021-01-30 10:48:09.788800773 +0100 +++ gcc/config/i386/i386-features.c 2021-01-30 11:42:35.660376111 +0100 @@ -2408,7 +2408,6 @@ remove_partial_avx_dependency (void) } } - df_process_deferred_rescans (); bitmap_obstack_release (NULL); BITMAP_FREE (convert_bbs); @@ -2438,7 +2437,7 @@ const pass_data pass_data_remove_partial 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ + TODO_df_finish, /* todo_flags_finish */ }; class pass_remove_partial_avx_dependency : public rtl_opt_pass --- gcc/testsuite/gcc.target/i386/20051216-1.c.jj 2021-01-30 11:41:15.558293070 +0100 +++ gcc/testsuite/gcc.target/i386/20051216-1.c 2021-01-30 11:41:15.558293070 +0100 @@ -0,0 +1,5 @@ +/* PR rtl-optimization/25432 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -march=cascadelake" } */ + +#include "../../gcc.c-torture/compile/20051216-1.c" Jakub
[committed] testsuite: Fix up gomp/simd-{2,3}.c tests [PR98243]
Hi! The test (intentionally) is not gcc.dg/vect/, as it needs -fopenmp and uses OpenMP directives other than simd and therefore can't rely on default VECTFLAGS and so I think can't safely use vect_int effective target either. So, I'm just making sure it is vectorized on x86 and on aarch64 (the latter as an example of a target that doesn't need any extra options to get the vectorization). Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2021-01-30 Jakub Jelinek PR testsuite/98243 * gcc.dg/gomp/simd-2.c: Add -msse2 on x86. Restrict scan-tree-dump-times to x86 and aarch64 targets. * gcc.dg/gomp/simd-3.c: Likewise. --- gcc/testsuite/gcc.dg/gomp/simd-2.c.jj 2020-10-07 10:49:28.345534230 +0200 +++ gcc/testsuite/gcc.dg/gomp/simd-2.c 2021-01-29 18:02:56.654262756 +0100 @@ -1,7 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fopenmp -fdump-tree-vect-details" } */ +/* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-additional-options "-mavx" { target avx } } */ -/* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" { target i?86-*-* x86_64-*-* aarch64-*-* } } } */ int a[1][128]; --- gcc/testsuite/gcc.dg/gomp/simd-3.c.jj 2020-10-07 10:49:28.345534230 +0200 +++ gcc/testsuite/gcc.dg/gomp/simd-3.c 2021-01-29 18:03:10.636104930 +0100 @@ -1,7 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fopenmp -fdump-tree-vect-details" } */ +/* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-additional-options "-mavx" { target avx } } */ -/* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" { target i?86-*-* x86_64-*-* aarch64-*-* } } } */ int a[1024][1024]; Jakub
Re: [PATCH] i386, df: Fix up gcc.c-torture/compile/20051216-1.c -O1 -march=cascadelake
On Sat, Jan 30, 2021 at 09:17:45AM +0100, Richard Biener wrote: > >The following patch fixes it, ok for trunk if it passes > >bootstrap/regtest? > > Hmm, that's odd. Who relies on deferred rescan being the default? Finish > pass, via processing deferred insns also resets it back. Or is this > documented somewhere? Ifcvt clearly relies on non-deferred rescanning. And yes, df_finish_pass clears df->changeable_flags, but we don't do that for this pass anymore (removal of TODO_df_finish), as that pass didn't call df_analyze either. df_process_deferred_rescans temporarily clears DF_DEFER_INSN_RESCAN flag, but restores it to the previous state at the end. So, I think we either need what I posted (which passed bootstrap/regtest on x86_64-linux and i686-linux), or we need to restore TODO_df_finish for the pass. Given that the pass previously did call df_analyze () only conditionally, not at all in many functions, and had TODO_df_finish unconditionally, perhaps that needs to work even if it wasn't meant to be used that way. > >2021-01-29 Jakub Jelinek > > > > * config/i386/i386-features.c (remove_partial_avx_dependency): > >Remember > > whether DF_DEFER_INSN_RESCAN has been active before or not, and > > reset it to previous state. > > > > * gcc.target/i386/20051216-1.c: New test. > > > >--- gcc/config/i386/i386-features.c.jj 2021-01-29 20:39:10.561912947 > >+0100 > >+++ gcc/config/i386/i386-features.c 2021-01-29 20:59:06.254740315 +0100 > >@@ -2273,7 +2273,7 @@ remove_partial_avx_dependency (void) > > auto_vec control_flow_insns; > > > > /* We create invalid RTL initially so defer rescans. */ > >- df_set_flags (DF_DEFER_INSN_RESCAN); > >+ int prev_df_flags = df_set_flags (DF_DEFER_INSN_RESCAN); > > > > FOR_EACH_BB_FN (bb, cfun) > > { > >@@ -2409,6 +2409,8 @@ remove_partial_avx_dependency (void) > > } > > > > df_process_deferred_rescans (); > >+ if ((prev_df_flags & DF_DEFER_INSN_RESCAN) == 0) > >+df_clear_flags (DF_DEFER_INSN_RESCAN); > > bitmap_obstack_release (NULL); > > BITMAP_FREE (convert_bbs); > > > >--- gcc/testsuite/gcc.target/i386/20051216-1.c.jj2021-01-29 > >21:06:20.386960652 +0100 > >+++ gcc/testsuite/gcc.target/i386/20051216-1.c 2021-01-29 > >21:03:17.599973093 +0100 > >@@ -0,0 +1,5 @@ > >+/* PR rtl-optimization/25432 */ > >+/* { dg-do compile } */ > >+/* { dg-options "-O1 -march=cascadelake" } */ > >+ > >+#include "../../gcc.c-torture/compile/20051216-1.c" > > > > > > Jakub Jakub
Re: [PATCH] i386, df: Fix up gcc.c-torture/compile/20051216-1.c -O1 -march=cascadelake
On January 29, 2021 9:19:26 PM GMT+01:00, Jakub Jelinek wrote: >On Fri, Jan 29, 2021 at 11:18:54AM -0800, sunil.k.pandey via >Gcc-patches wrote: >> On Linux/x86_64, >> >> a7f52181a6a16bb6d216ff41d9c6a9da95c19b5c is the first bad commit >> commit a7f52181a6a16bb6d216ff41d9c6a9da95c19b5c >> Author: Richard Biener >> Date: Fri Jan 29 16:02:36 2021 +0100 >> >> rtl-optimization/98863 - tame i386 specific RPAD pass >> >> caused >> >> FAIL: gcc.c-torture/compile/20051216-1.c -O1 (internal compiler >error) >> FAIL: gcc.c-torture/compile/20051216-1.c -O1 (test for excess >errors) > >I can reproduce it. The problem is that we don't revert the df flags >back. > >The following patch fixes it, ok for trunk if it passes >bootstrap/regtest? Hmm, that's odd. Who relies on deferred rescan being the default? Finish pass, via processing deferred insns also resets it back. Or is this documented somewhere? Richard. >2021-01-29 Jakub Jelinek > > * config/i386/i386-features.c (remove_partial_avx_dependency): >Remember > whether DF_DEFER_INSN_RESCAN has been active before or not, and > reset it to previous state. > > * gcc.target/i386/20051216-1.c: New test. > >--- gcc/config/i386/i386-features.c.jj 2021-01-29 20:39:10.561912947 >+0100 >+++ gcc/config/i386/i386-features.c2021-01-29 20:59:06.254740315 +0100 >@@ -2273,7 +2273,7 @@ remove_partial_avx_dependency (void) > auto_vec control_flow_insns; > > /* We create invalid RTL initially so defer rescans. */ >- df_set_flags (DF_DEFER_INSN_RESCAN); >+ int prev_df_flags = df_set_flags (DF_DEFER_INSN_RESCAN); > > FOR_EACH_BB_FN (bb, cfun) > { >@@ -2409,6 +2409,8 @@ remove_partial_avx_dependency (void) > } > > df_process_deferred_rescans (); >+ if ((prev_df_flags & DF_DEFER_INSN_RESCAN) == 0) >+df_clear_flags (DF_DEFER_INSN_RESCAN); > bitmap_obstack_release (NULL); > BITMAP_FREE (convert_bbs); > >--- gcc/testsuite/gcc.target/i386/20051216-1.c.jj 2021-01-29 >21:06:20.386960652 +0100 >+++ gcc/testsuite/gcc.target/i386/20051216-1.c 2021-01-29 >21:03:17.599973093 +0100 >@@ -0,0 +1,5 @@ >+/* PR rtl-optimization/25432 */ >+/* { dg-do compile } */ >+/* { dg-options "-O1 -march=cascadelake" } */ >+ >+#include "../../gcc.c-torture/compile/20051216-1.c" > > > Jakub