Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On 10/8/21 4:49 AM, Aldy Hernandez via Gcc-patches wrote: On Thu, Sep 23, 2021 at 8:32 AM Richard Biener via Gcc-patches wrote: On Thu, 23 Sep 2021, Hongtao Liu wrote: On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: On 9/21/21 7:38 PM, Hongtao Liu wrote: On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: ... diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c index 1d79930cd58..9351f7e7a1a 100644 --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c @@ -1,7 +1,7 @@ /* PR middle-end/91458 - inconsistent warning for writing past the end of an array member { dg-do compile } - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf -fno-tree-vectorize" } */ The testcase is large - what part requires this change? Given the testcase was added for inconsistent warnings do they now become inconsistent again as we enable vectorization at -O2? That said, the testcase adjustments need some explaining - I suppose you didn't just slap -fno-tree-vectorize to all of those changing behavior? void ga1_ (void) { a1_.a[0] = 0; a1_.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1_.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a; a.a[0] = 0; a.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } sink (); } It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since there are 2 accesses, but after enabling vectorization, there's only one access, so one warning is missing which causes the failure. With the stores vectorized, is the warning on the correct line or does it point to the first store, the one that's in bounds, as it does with -O3? The latter would be a regression at -O2. For the upper case, It points to the second store which is out of bounds, the third store warning is missing. I would find it preferable to change the test code over disabling optimizations that are on by default. My concern is that the test would no longer exercise the default behavior. (The same goes for the -fno-ipa-icf option.) Hmm, it's a middle-end test, for some backend, it may not do vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and relative cost model). Yes, there are quite a few warning tests like that. Their main purpose is to verify that in common GCC invocations (i.e., without any special options) warnings are a) issued when expected and b) not issued when not expected. Otherwise, middle end warnings are known to have both false positives and false negatives in some invocations, depending on what optimizations are in effect. Indiscriminately disabling common optimizations for these large tests and invoking them under artificial conditions would compromise this goal and hide the problems. If enabling vectorization at -O2 causes regressions in the quality of diagnostics (as the test failure above indicates seems to be happening) we should investigate these and open bugs for them so they can be fixed. We can then tweak the specific failing test cases to avoid the failures until they are fixed. There are indeed cases of false positives and false negatives .i.e. // Verify warning for access to a definition with an initializer that // initializes the one-element array member. struct A1 a1i_1 = { 0, { 1 } }; void ga1i_1 (void) { a1i_1.a[0] = 0; a1i_1.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1i_1.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a = { 0, { 1 } }; --- false positive here. a.a[0] = 1; a.a[1] = 2; // { dg-warning "\\\[-Wstringop-overflow" } false negative here. a.a[2] = 3; // { dg-warning "\\\[-Wstringop-overflow" } false negative here. sink (); } Similar for * gcc.dg/Warray-bounds-51.c. * gcc.dg/Warray-parameter-3.c * gcc.dg/Wstringop-overflow-14.c * gcc.dg/Wstringop-overflow-21.c So there're 3 situations. 1. All accesses are out of bound, and after vectorization, there are some warnings missing. 2. Part of accesses are inbound, part of accesses are out of bound, and after vectorization, the warning goes from out of bound line to inbound line. 3. All access are out of bound, and after vectoriation, all warning are missing, and goes to a false-positive line. I remember some of the warning code explicitely excuses itself from even trying to deal with vectorized loads/stores, that might need to be revisited. It would also be useful to verify whether the line info on the vectorized loads/stores is sensible (if you dump with -lineno you get stmts with line numbers). It is of course impossible to preserve
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, Sep 23, 2021 at 8:32 AM Richard Biener via Gcc-patches wrote: > > On Thu, 23 Sep 2021, Hongtao Liu wrote: > > > On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: > > > > > > On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: > > > > > > > > On 9/21/21 7:38 PM, Hongtao Liu wrote: > > > > > On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: > > > > ... > > > > > diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > > > b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > > > index 1d79930cd58..9351f7e7a1a 100644 > > > > > --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > > > +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > > > @@ -1,7 +1,7 @@ > > > > >/* PR middle-end/91458 - inconsistent warning for writing past > > > > > the end > > > > > of an array member > > > > > { dg-do compile } > > > > > - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ > > > > > + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf > > > > > -fno-tree-vectorize" } */ > > > > > > > > The testcase is large - what part requires this change? Given the > > > > testcase was added for inconsistent warnings do they now become > > > > inconsistent again as we enable vectorization at -O2? > > > > > > > > That said, the testcase adjustments need some explaining - I > > > > suppose > > > > you didn't just slap -fno-tree-vectorize to all of those changing > > > > behavior? > > > > > > > > >>> void ga1_ (void) > > > > >>> { > > > > >>> a1_.a[0] = 0; > > > > >>> a1_.a[1] = 1; // { dg-warning > > > > >>> "\\\[-Wstringop-overflow" } > > > > >>> a1_.a[2] = 2; // { dg-warning > > > > >>> "\\\[-Wstringop-overflow" } > > > > >>> > > > > >>> struct A1 a; > > > > >>> a.a[0] = 0; > > > > >>> a.a[1] = 1; // { dg-warning > > > > >>> "\\\[-Wstringop-overflow" } > > > > >>> a.a[2] = 2; // { dg-warning > > > > >>> "\\\[-Wstringop-overflow" } > > > > >>> sink (); > > > > >>> } > > > > >>> > > > > >>> It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since > > > > >>> there are 2 accesses, but after enabling vectorization, there's only > > > > >>> one access, so one warning is missing which causes the failure. > > > > > > > > With the stores vectorized, is the warning on the correct line or > > > > does it point to the first store, the one that's in bounds, as > > > > it does with -O3? The latter would be a regression at -O2. > > > For the upper case, It points to the second store which is out of > > > bounds, the third store warning is missing. > > > > > > > > >> > > > > >> I would find it preferable to change the test code over disabling > > > > >> optimizations that are on by default. My concern is that the test > > > > >> would no longer exercise the default behavior. (The same goes for > > > > >> the -fno-ipa-icf option.) > > > > > Hmm, it's a middle-end test, for some backend, it may not do > > > > > vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and > > > > > relative cost model). > > > > > > > > Yes, there are quite a few warning tests like that. Their main > > > > purpose is to verify that in common GCC invocations (i.e., without > > > > any special options) warnings are a) issued when expected and b) > > > > not issued when not expected. Otherwise, middle end warnings are > > > > known to have both false positives and false negatives in some > > > > invocations, depending on what optimizations are in effect. > > > > Indiscriminately disabling common optimizations for these large > > > > tests and invoking them under artificial conditions would > > > > compromise this goal and hide the problems. > > > > > > > > If enabling vectorization at -O2 causes regressions in the quality > > > > of diagnostics (as the test failure above indicates seems to be > > > > happening) we should investigate these and open bugs for them so > > > > they can be fixed. We can then tweak the specific failing test > > > > cases to avoid the failures until they are fixed. > > > There are indeed cases of false positives and false negatives > > > .i.e. > > > // Verify warning for access to a definition with an initializer that > > > // initializes the one-element array member. > > > struct A1 a1i_1 = { 0, { 1 } }; > > > > > > void ga1i_1 (void) > > > { > > > a1i_1.a[0] = 0; > > > a1i_1.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" > > > } > > > a1i_1.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" > > > } > > > > > > struct A1 a = { 0, { 1 } }; --- false positive here. > > > a.a[0] = 1; > > > a.a[1] = 2; // { dg-warning > > > "\\\[-Wstringop-overflow" } false negative here. > > > a.a[2] = 3; // { dg-warning > > > "\\\[-Wstringop-overflow" } false negative here. >
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, Oct 7, 2021 at 11:38 PM H.J. Lu via Gcc-patches wrote: > > On Thu, Oct 7, 2021 at 8:35 AM Martin Liška wrote: > > > > Hello. > > > > The patch is approved, are you planning committing the changes? Committed. > > > > Thanks, > > Martin > > Hongtao is on holiday. He will be back later today. > > -- > H.J. -- BR, Hongtao
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, Oct 7, 2021 at 8:35 AM Martin Liška wrote: > > Hello. > > The patch is approved, are you planning committing the changes? > > Thanks, > Martin Hongtao is on holiday. He will be back later today. -- H.J.
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
Hello. The patch is approved, are you planning committing the changes? Thanks, Martin
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Sun, 26 Sep 2021, liuhongt wrote: > Hi: > > Please don't add the -fno- option to the warning tests. As I said, > > I would prefer to either suppress the vectorization for the failing > > cases by tweaking the test code or xfail them. That way future > > regressions won't be masked by the option. Once we've moved > > the warning to a more suitable pass we'll add a new test to verify > > it works as intended or remove the xfails. > > Remove -fno-tree-vectorize from the warning tests, and add xfails to them. > The warning information is mainly affected by vectorization of 4 or 2 char > store. Some targets support both, some targets only support one of them, > and some targets supported neither, which means the warning information > would differ from targets to targets. > I only added xfail { x86_64-*-* i?86-*-* }, other backends may need to > re-adjust these xfail. > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,}. OK. Thanks, Richard. > gcc/ChangeLog: > > * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). > * doc/invoke.texi (Options That Control Optimization): Update > documents. > * opts.c (default_options_table): Enable auto-vectorization at > O2 with very-cheap cost model. > (finish_options): Use cheap cost model for > explicit -ftree{,-loop}-vectorize. > > gcc/testsuite/ChangeLog: > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > * g++.dg/tree-ssa/pr81408.C: Ditto. > * g++.dg/warn/Wuninitialized-13.C: Ditto. > * gcc.dg/Warray-bounds-51.c: Ditto. > * gcc.dg/Warray-parameter-3.c: Ditto. > * gcc.dg/Wstringop-overflow-14.c: Ditto. > * gcc.dg/Wstringop-overflow-21.c: Ditto. > * gcc.dg/Wstringop-overflow-68.c: Ditto. > * gcc.dg/Wstringop-overflow-76.c: Ditto. > * gcc.dg/gomp/pr46032-2.c: Ditto. > * gcc.dg/gomp/pr46032-3.c: Ditto. > * gcc.dg/gomp/simd-2.c: Ditto. > * gcc.dg/gomp/simd-3.c: Ditto. > * gcc.dg/graphite/fuse-1.c: Ditto. > * gcc.dg/pr67089-6.c: Ditto. > * gcc.dg/pr82929-2.c: Ditto. > * gcc.dg/pr82929.c: Ditto. > * gcc.dg/store_merging_1.c: Ditto. > * gcc.dg/store_merging_11.c: Ditto. > * gcc.dg/store_merging_15.c: Ditto. > * gcc.dg/store_merging_16.c: Ditto. > * gcc.dg/store_merging_19.c: Ditto. > * gcc.dg/store_merging_24.c: Ditto. > * gcc.dg/store_merging_25.c: Ditto. > * gcc.dg/store_merging_28.c: Ditto. > * gcc.dg/store_merging_30.c: Ditto. > * gcc.dg/store_merging_5.c: Ditto. > * gcc.dg/store_merging_7.c: Ditto. > * gcc.dg/store_merging_8.c: Ditto. > * gcc.dg/strlenopt-85.c: Ditto. > * gcc.dg/tree-ssa/dump-6.c: Ditto. > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > * gcc.dg/tree-ssa/pr47059.c: Ditto. > * gcc.dg/tree-ssa/pr86017.c: Ditto. > * gcc.dg/tree-ssa/pr91482.c: Ditto. > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > * gcc.dg/uninit-40.c: Ditto. > * gcc.dg/unroll-7.c: Ditto. > * gcc.misc-tests/help.exp: Ditto. > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > * gcc.target/i386/pr34012.c: Ditto. > * gcc.target/i386/pr49781-1.c: Ditto. > * gcc.target/i386/pr95798-1.c: Ditto. > * gcc.target/i386/pr95798-2.c: Ditto. > * gfortran.dg/pr77498.f: Ditto. > --- > gcc/common.opt| 2 +- > gcc/doc/invoke.texi | 8 > gcc/opts.c| 17 +--- > .../c-c++-common/Wstringop-overflow-2.c | 20 +-- > gcc/testsuite/g++.dg/tree-ssa/pr81408.C | 2 +- > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > gcc/testsuite/gcc.dg/Warray-bounds-51.c | 2 +- > gcc/testsuite/gcc.dg/Warray-parameter-3.c | 4 ++-- > gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 4 ++-- > gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 8 > gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 10 +- > gcc/testsuite/gcc.dg/Wstringop-overflow-76.c | 20 +-- > gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- > gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- > gcc/testsuite/gcc.dg/gomp/simd-2.c| 2 +- > gcc/testsuite/gcc.dg/gomp/simd-3.c| 2 +- > gcc/testsuite/gcc.dg/graphite/fuse-1.c| 2 +- > gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- > gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- > gcc/testsuite/gcc.dg/pr82929.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_1.c| 2 +- >
[PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
Hi: > Please don't add the -fno- option to the warning tests. As I said, > I would prefer to either suppress the vectorization for the failing > cases by tweaking the test code or xfail them. That way future > regressions won't be masked by the option. Once we've moved > the warning to a more suitable pass we'll add a new test to verify > it works as intended or remove the xfails. Remove -fno-tree-vectorize from the warning tests, and add xfails to them. The warning information is mainly affected by vectorization of 4 or 2 char store. Some targets support both, some targets only support one of them, and some targets supported neither, which means the warning information would differ from targets to targets. I only added xfail { x86_64-*-* i?86-*-* }, other backends may need to re-adjust these xfail. Bootstrapped and regtested on x86_64-linux-gnu{-m32,}. gcc/ChangeLog: * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). * doc/invoke.texi (Options That Control Optimization): Update documents. * opts.c (default_options_table): Enable auto-vectorization at O2 with very-cheap cost model. (finish_options): Use cheap cost model for explicit -ftree{,-loop}-vectorize. gcc/testsuite/ChangeLog: * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. * g++.dg/tree-ssa/pr81408.C: Ditto. * g++.dg/warn/Wuninitialized-13.C: Ditto. * gcc.dg/Warray-bounds-51.c: Ditto. * gcc.dg/Warray-parameter-3.c: Ditto. * gcc.dg/Wstringop-overflow-14.c: Ditto. * gcc.dg/Wstringop-overflow-21.c: Ditto. * gcc.dg/Wstringop-overflow-68.c: Ditto. * gcc.dg/Wstringop-overflow-76.c: Ditto. * gcc.dg/gomp/pr46032-2.c: Ditto. * gcc.dg/gomp/pr46032-3.c: Ditto. * gcc.dg/gomp/simd-2.c: Ditto. * gcc.dg/gomp/simd-3.c: Ditto. * gcc.dg/graphite/fuse-1.c: Ditto. * gcc.dg/pr67089-6.c: Ditto. * gcc.dg/pr82929-2.c: Ditto. * gcc.dg/pr82929.c: Ditto. * gcc.dg/store_merging_1.c: Ditto. * gcc.dg/store_merging_11.c: Ditto. * gcc.dg/store_merging_15.c: Ditto. * gcc.dg/store_merging_16.c: Ditto. * gcc.dg/store_merging_19.c: Ditto. * gcc.dg/store_merging_24.c: Ditto. * gcc.dg/store_merging_25.c: Ditto. * gcc.dg/store_merging_28.c: Ditto. * gcc.dg/store_merging_30.c: Ditto. * gcc.dg/store_merging_5.c: Ditto. * gcc.dg/store_merging_7.c: Ditto. * gcc.dg/store_merging_8.c: Ditto. * gcc.dg/strlenopt-85.c: Ditto. * gcc.dg/tree-ssa/dump-6.c: Ditto. * gcc.dg/tree-ssa/pr19210-1.c: Ditto. * gcc.dg/tree-ssa/pr47059.c: Ditto. * gcc.dg/tree-ssa/pr86017.c: Ditto. * gcc.dg/tree-ssa/pr91482.c: Ditto. * gcc.dg/tree-ssa/predcom-1.c: Ditto. * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-6.c: Ditto. * gcc.dg/tree-ssa/prefetch-8.c: Ditto. * gcc.dg/tree-ssa/prefetch-9.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. * gcc.dg/uninit-40.c: Ditto. * gcc.dg/unroll-7.c: Ditto. * gcc.misc-tests/help.exp: Ditto. * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. * gcc.target/i386/pr34012.c: Ditto. * gcc.target/i386/pr49781-1.c: Ditto. * gcc.target/i386/pr95798-1.c: Ditto. * gcc.target/i386/pr95798-2.c: Ditto. * gfortran.dg/pr77498.f: Ditto. --- gcc/common.opt| 2 +- gcc/doc/invoke.texi | 8 gcc/opts.c| 17 +--- .../c-c++-common/Wstringop-overflow-2.c | 20 +-- gcc/testsuite/g++.dg/tree-ssa/pr81408.C | 2 +- gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- gcc/testsuite/gcc.dg/Warray-bounds-51.c | 2 +- gcc/testsuite/gcc.dg/Warray-parameter-3.c | 4 ++-- gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 4 ++-- gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 8 gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 10 +- gcc/testsuite/gcc.dg/Wstringop-overflow-76.c | 20 +-- gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- gcc/testsuite/gcc.dg/gomp/simd-2.c| 2 +- gcc/testsuite/gcc.dg/gomp/simd-3.c| 2 +- gcc/testsuite/gcc.dg/graphite/fuse-1.c| 2 +- gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- gcc/testsuite/gcc.dg/pr82929.c| 2 +- gcc/testsuite/gcc.dg/store_merging_1.c| 2 +- gcc/testsuite/gcc.dg/store_merging_11.c | 2 +- gcc/testsuite/gcc.dg/store_merging_15.c | 2 +- gcc/testsuite/gcc.dg/store_merging_16.c | 2 +-
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On 9/23/21 9:32 PM, Hongtao Liu wrote: On Thu, Sep 23, 2021 at 11:18 PM Martin Sebor wrote: On 9/23/21 12:30 AM, Richard Biener wrote: On Thu, 23 Sep 2021, Hongtao Liu wrote: On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: On 9/21/21 7:38 PM, Hongtao Liu wrote: On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: ... diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c index 1d79930cd58..9351f7e7a1a 100644 --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c @@ -1,7 +1,7 @@ /* PR middle-end/91458 - inconsistent warning for writing past the end of an array member { dg-do compile } - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf -fno-tree-vectorize" } */ The testcase is large - what part requires this change? Given the testcase was added for inconsistent warnings do they now become inconsistent again as we enable vectorization at -O2? That said, the testcase adjustments need some explaining - I suppose you didn't just slap -fno-tree-vectorize to all of those changing behavior? void ga1_ (void) { a1_.a[0] = 0; a1_.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1_.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a; a.a[0] = 0; a.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } sink (); } It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since there are 2 accesses, but after enabling vectorization, there's only one access, so one warning is missing which causes the failure. With the stores vectorized, is the warning on the correct line or does it point to the first store, the one that's in bounds, as it does with -O3? The latter would be a regression at -O2. For the upper case, It points to the second store which is out of bounds, the third store warning is missing. I would find it preferable to change the test code over disabling optimizations that are on by default. My concern is that the test would no longer exercise the default behavior. (The same goes for the -fno-ipa-icf option.) Hmm, it's a middle-end test, for some backend, it may not do vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and relative cost model). Yes, there are quite a few warning tests like that. Their main purpose is to verify that in common GCC invocations (i.e., without any special options) warnings are a) issued when expected and b) not issued when not expected. Otherwise, middle end warnings are known to have both false positives and false negatives in some invocations, depending on what optimizations are in effect. Indiscriminately disabling common optimizations for these large tests and invoking them under artificial conditions would compromise this goal and hide the problems. If enabling vectorization at -O2 causes regressions in the quality of diagnostics (as the test failure above indicates seems to be happening) we should investigate these and open bugs for them so they can be fixed. We can then tweak the specific failing test cases to avoid the failures until they are fixed. There are indeed cases of false positives and false negatives .i.e. // Verify warning for access to a definition with an initializer that // initializes the one-element array member. struct A1 a1i_1 = { 0, { 1 } }; void ga1i_1 (void) { a1i_1.a[0] = 0; a1i_1.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1i_1.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a = { 0, { 1 } }; --- false positive here. a.a[0] = 1; a.a[1] = 2; // { dg-warning "\\\[-Wstringop-overflow" } false negative here. a.a[2] = 3; // { dg-warning "\\\[-Wstringop-overflow" } false negative here. sink (); } Similar for * gcc.dg/Warray-bounds-51.c. * gcc.dg/Warray-parameter-3.c * gcc.dg/Wstringop-overflow-14.c * gcc.dg/Wstringop-overflow-21.c So there're 3 situations. 1. All accesses are out of bound, and after vectorization, there are some warnings missing. 2. Part of accesses are inbound, part of accesses are out of bound, and after vectorization, the warning goes from out of bound line to inbound line. 3. All access are out of bound, and after vectoriation, all warning are missing, and goes to a false-positive line. My mistake, there's no case3, just case 1 and case2. So i'm going to install the patch, ok? Please don't add the -fno- option to the warning tests. As I said, I would prefer to either suppress the vectorization for the failing cases by tweaking the test code or xfail them. That way future regressions won't be masked by
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, Sep 23, 2021 at 11:18 PM Martin Sebor wrote: > > On 9/23/21 12:30 AM, Richard Biener wrote: > > On Thu, 23 Sep 2021, Hongtao Liu wrote: > > > >> On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: > >>> > >>> On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: > > On 9/21/21 7:38 PM, Hongtao Liu wrote: > > On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: > ... > > diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > index 1d79930cd58..9351f7e7a1a 100644 > > --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > @@ -1,7 +1,7 @@ > > /* PR middle-end/91458 - inconsistent warning for writing past > > the end > >of an array member > >{ dg-do compile } > > - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ > > + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf > > -fno-tree-vectorize" } */ > > The testcase is large - what part requires this change? Given the > testcase was added for inconsistent warnings do they now become > inconsistent again as we enable vectorization at -O2? > > That said, the testcase adjustments need some explaining - I suppose > you didn't just slap -fno-tree-vectorize to all of those changing > behavior? > > >>> void ga1_ (void) > >>> { > >>> a1_.a[0] = 0; > >>> a1_.a[1] = 1; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> a1_.a[2] = 2; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> > >>> struct A1 a; > >>> a.a[0] = 0; > >>> a.a[1] = 1; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> a.a[2] = 2; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> sink (); > >>> } > >>> > >>> It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since > >>> there are 2 accesses, but after enabling vectorization, there's only > >>> one access, so one warning is missing which causes the failure. > > With the stores vectorized, is the warning on the correct line or > does it point to the first store, the one that's in bounds, as > it does with -O3? The latter would be a regression at -O2. > >>> For the upper case, It points to the second store which is out of > >>> bounds, the third store warning is missing. > > >> > >> I would find it preferable to change the test code over disabling > >> optimizations that are on by default. My concern is that the test > >> would no longer exercise the default behavior. (The same goes for > >> the -fno-ipa-icf option.) > > Hmm, it's a middle-end test, for some backend, it may not do > > vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and > > relative cost model). > > Yes, there are quite a few warning tests like that. Their main > purpose is to verify that in common GCC invocations (i.e., without > any special options) warnings are a) issued when expected and b) > not issued when not expected. Otherwise, middle end warnings are > known to have both false positives and false negatives in some > invocations, depending on what optimizations are in effect. > Indiscriminately disabling common optimizations for these large > tests and invoking them under artificial conditions would > compromise this goal and hide the problems. > > If enabling vectorization at -O2 causes regressions in the quality > of diagnostics (as the test failure above indicates seems to be > happening) we should investigate these and open bugs for them so > they can be fixed. We can then tweak the specific failing test > cases to avoid the failures until they are fixed. > >>> There are indeed cases of false positives and false negatives > >>> .i.e. > >>> // Verify warning for access to a definition with an initializer that > >>> // initializes the one-element array member. > >>> struct A1 a1i_1 = { 0, { 1 } }; > >>> > >>> void ga1i_1 (void) > >>> { > >>>a1i_1.a[0] = 0; > >>>a1i_1.a[1] = 1; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>>a1i_1.a[2] = 2; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> > >>>struct A1 a = { 0, { 1 } }; --- false positive here. > >>>a.a[0] = 1; > >>>a.a[1] = 2; // { dg-warning > >>> "\\\[-Wstringop-overflow" } false negative here. > >>>a.a[2] = 3; // { dg-warning > >>> "\\\[-Wstringop-overflow" } false negative here. > >>>sink (); > >>> } > >> Similar for > >> * gcc.dg/Warray-bounds-51.c. > >> *
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On 9/23/21 12:30 AM, Richard Biener wrote: On Thu, 23 Sep 2021, Hongtao Liu wrote: On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: On 9/21/21 7:38 PM, Hongtao Liu wrote: On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: ... diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c index 1d79930cd58..9351f7e7a1a 100644 --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c @@ -1,7 +1,7 @@ /* PR middle-end/91458 - inconsistent warning for writing past the end of an array member { dg-do compile } - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf -fno-tree-vectorize" } */ The testcase is large - what part requires this change? Given the testcase was added for inconsistent warnings do they now become inconsistent again as we enable vectorization at -O2? That said, the testcase adjustments need some explaining - I suppose you didn't just slap -fno-tree-vectorize to all of those changing behavior? void ga1_ (void) { a1_.a[0] = 0; a1_.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1_.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a; a.a[0] = 0; a.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } sink (); } It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since there are 2 accesses, but after enabling vectorization, there's only one access, so one warning is missing which causes the failure. With the stores vectorized, is the warning on the correct line or does it point to the first store, the one that's in bounds, as it does with -O3? The latter would be a regression at -O2. For the upper case, It points to the second store which is out of bounds, the third store warning is missing. I would find it preferable to change the test code over disabling optimizations that are on by default. My concern is that the test would no longer exercise the default behavior. (The same goes for the -fno-ipa-icf option.) Hmm, it's a middle-end test, for some backend, it may not do vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and relative cost model). Yes, there are quite a few warning tests like that. Their main purpose is to verify that in common GCC invocations (i.e., without any special options) warnings are a) issued when expected and b) not issued when not expected. Otherwise, middle end warnings are known to have both false positives and false negatives in some invocations, depending on what optimizations are in effect. Indiscriminately disabling common optimizations for these large tests and invoking them under artificial conditions would compromise this goal and hide the problems. If enabling vectorization at -O2 causes regressions in the quality of diagnostics (as the test failure above indicates seems to be happening) we should investigate these and open bugs for them so they can be fixed. We can then tweak the specific failing test cases to avoid the failures until they are fixed. There are indeed cases of false positives and false negatives .i.e. // Verify warning for access to a definition with an initializer that // initializes the one-element array member. struct A1 a1i_1 = { 0, { 1 } }; void ga1i_1 (void) { a1i_1.a[0] = 0; a1i_1.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1i_1.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a = { 0, { 1 } }; --- false positive here. a.a[0] = 1; a.a[1] = 2; // { dg-warning "\\\[-Wstringop-overflow" } false negative here. a.a[2] = 3; // { dg-warning "\\\[-Wstringop-overflow" } false negative here. sink (); } Similar for * gcc.dg/Warray-bounds-51.c. * gcc.dg/Warray-parameter-3.c * gcc.dg/Wstringop-overflow-14.c * gcc.dg/Wstringop-overflow-21.c So there're 3 situations. 1. All accesses are out of bound, and after vectorization, there are some warnings missing. 2. Part of accesses are inbound, part of accesses are out of bound, and after vectorization, the warning goes from out of bound line to inbound line. 3. All access are out of bound, and after vectoriation, all warning are missing, and goes to a false-positive line. I remember some of the warning code explicitely excuses itself from even trying to deal with vectorized loads/stores, that might need to be revisited. It would also be useful to verify whether the line info on the vectorized loads/stores is sensible (if you dump with -lineno you get stmts with line numbers). Yes, it's this code in handle_mem_ref() in pointer-query.cc: if (VECTOR_TYPE_P (TREE_TYPE (mref))) { /* Hack:
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, 23 Sep 2021, Hongtao Liu wrote: > On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: > > > > On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: > > > > > > On 9/21/21 7:38 PM, Hongtao Liu wrote: > > > > On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: > > > ... > > > > diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > > b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > > index 1d79930cd58..9351f7e7a1a 100644 > > > > --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > > +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > > @@ -1,7 +1,7 @@ > > > >/* PR middle-end/91458 - inconsistent warning for writing past > > > > the end > > > > of an array member > > > > { dg-do compile } > > > > - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ > > > > + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf > > > > -fno-tree-vectorize" } */ > > > > > > The testcase is large - what part requires this change? Given the > > > testcase was added for inconsistent warnings do they now become > > > inconsistent again as we enable vectorization at -O2? > > > > > > That said, the testcase adjustments need some explaining - I suppose > > > you didn't just slap -fno-tree-vectorize to all of those changing > > > behavior? > > > > > > >>> void ga1_ (void) > > > >>> { > > > >>> a1_.a[0] = 0; > > > >>> a1_.a[1] = 1; // { dg-warning > > > >>> "\\\[-Wstringop-overflow" } > > > >>> a1_.a[2] = 2; // { dg-warning > > > >>> "\\\[-Wstringop-overflow" } > > > >>> > > > >>> struct A1 a; > > > >>> a.a[0] = 0; > > > >>> a.a[1] = 1; // { dg-warning > > > >>> "\\\[-Wstringop-overflow" } > > > >>> a.a[2] = 2; // { dg-warning > > > >>> "\\\[-Wstringop-overflow" } > > > >>> sink (); > > > >>> } > > > >>> > > > >>> It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since > > > >>> there are 2 accesses, but after enabling vectorization, there's only > > > >>> one access, so one warning is missing which causes the failure. > > > > > > With the stores vectorized, is the warning on the correct line or > > > does it point to the first store, the one that's in bounds, as > > > it does with -O3? The latter would be a regression at -O2. > > For the upper case, It points to the second store which is out of > > bounds, the third store warning is missing. > > > > > > >> > > > >> I would find it preferable to change the test code over disabling > > > >> optimizations that are on by default. My concern is that the test > > > >> would no longer exercise the default behavior. (The same goes for > > > >> the -fno-ipa-icf option.) > > > > Hmm, it's a middle-end test, for some backend, it may not do > > > > vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and > > > > relative cost model). > > > > > > Yes, there are quite a few warning tests like that. Their main > > > purpose is to verify that in common GCC invocations (i.e., without > > > any special options) warnings are a) issued when expected and b) > > > not issued when not expected. Otherwise, middle end warnings are > > > known to have both false positives and false negatives in some > > > invocations, depending on what optimizations are in effect. > > > Indiscriminately disabling common optimizations for these large > > > tests and invoking them under artificial conditions would > > > compromise this goal and hide the problems. > > > > > > If enabling vectorization at -O2 causes regressions in the quality > > > of diagnostics (as the test failure above indicates seems to be > > > happening) we should investigate these and open bugs for them so > > > they can be fixed. We can then tweak the specific failing test > > > cases to avoid the failures until they are fixed. > > There are indeed cases of false positives and false negatives > > .i.e. > > // Verify warning for access to a definition with an initializer that > > // initializes the one-element array member. > > struct A1 a1i_1 = { 0, { 1 } }; > > > > void ga1i_1 (void) > > { > > a1i_1.a[0] = 0; > > a1i_1.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } > > a1i_1.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } > > > > struct A1 a = { 0, { 1 } }; --- false positive here. > > a.a[0] = 1; > > a.a[1] = 2; // { dg-warning > > "\\\[-Wstringop-overflow" } false negative here. > > a.a[2] = 3; // { dg-warning > > "\\\[-Wstringop-overflow" } false negative here. > > sink (); > > } > Similar for > * gcc.dg/Warray-bounds-51.c. > * gcc.dg/Warray-parameter-3.c > * gcc.dg/Wstringop-overflow-14.c > * gcc.dg/Wstringop-overflow-21.c > > So there're 3 situations. > 1. All accesses are out of bound, and after vectorization, there are > some warnings missing. > 2.
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, Sep 23, 2021 at 9:48 AM Hongtao Liu wrote: > > On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: > > > > On 9/21/21 7:38 PM, Hongtao Liu wrote: > > > On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: > > ... > > > diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > index 1d79930cd58..9351f7e7a1a 100644 > > > --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > > @@ -1,7 +1,7 @@ > > >/* PR middle-end/91458 - inconsistent warning for writing past the > > > end > > > of an array member > > > { dg-do compile } > > > - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ > > > + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf > > > -fno-tree-vectorize" } */ > > > > The testcase is large - what part requires this change? Given the > > testcase was added for inconsistent warnings do they now become > > inconsistent again as we enable vectorization at -O2? > > > > That said, the testcase adjustments need some explaining - I suppose > > you didn't just slap -fno-tree-vectorize to all of those changing > > behavior? > > > > >>> void ga1_ (void) > > >>> { > > >>> a1_.a[0] = 0; > > >>> a1_.a[1] = 1; // { dg-warning > > >>> "\\\[-Wstringop-overflow" } > > >>> a1_.a[2] = 2; // { dg-warning > > >>> "\\\[-Wstringop-overflow" } > > >>> > > >>> struct A1 a; > > >>> a.a[0] = 0; > > >>> a.a[1] = 1; // { dg-warning > > >>> "\\\[-Wstringop-overflow" } > > >>> a.a[2] = 2; // { dg-warning > > >>> "\\\[-Wstringop-overflow" } > > >>> sink (); > > >>> } > > >>> > > >>> It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since > > >>> there are 2 accesses, but after enabling vectorization, there's only > > >>> one access, so one warning is missing which causes the failure. > > > > With the stores vectorized, is the warning on the correct line or > > does it point to the first store, the one that's in bounds, as > > it does with -O3? The latter would be a regression at -O2. > For the upper case, It points to the second store which is out of > bounds, the third store warning is missing. > > > > >> > > >> I would find it preferable to change the test code over disabling > > >> optimizations that are on by default. My concern is that the test > > >> would no longer exercise the default behavior. (The same goes for > > >> the -fno-ipa-icf option.) > > > Hmm, it's a middle-end test, for some backend, it may not do > > > vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and > > > relative cost model). > > > > Yes, there are quite a few warning tests like that. Their main > > purpose is to verify that in common GCC invocations (i.e., without > > any special options) warnings are a) issued when expected and b) > > not issued when not expected. Otherwise, middle end warnings are > > known to have both false positives and false negatives in some > > invocations, depending on what optimizations are in effect. > > Indiscriminately disabling common optimizations for these large > > tests and invoking them under artificial conditions would > > compromise this goal and hide the problems. > > > > If enabling vectorization at -O2 causes regressions in the quality > > of diagnostics (as the test failure above indicates seems to be > > happening) we should investigate these and open bugs for them so > > they can be fixed. We can then tweak the specific failing test > > cases to avoid the failures until they are fixed. > There are indeed cases of false positives and false negatives > .i.e. > // Verify warning for access to a definition with an initializer that > // initializes the one-element array member. > struct A1 a1i_1 = { 0, { 1 } }; > > void ga1i_1 (void) > { > a1i_1.a[0] = 0; > a1i_1.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } > a1i_1.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } > > struct A1 a = { 0, { 1 } }; --- false positive here. > a.a[0] = 1; > a.a[1] = 2; // { dg-warning > "\\\[-Wstringop-overflow" } false negative here. > a.a[2] = 3; // { dg-warning > "\\\[-Wstringop-overflow" } false negative here. > sink (); > } Similar for * gcc.dg/Warray-bounds-51.c. * gcc.dg/Warray-parameter-3.c * gcc.dg/Wstringop-overflow-14.c * gcc.dg/Wstringop-overflow-21.c So there're 3 situations. 1. All accesses are out of bound, and after vectorization, there are some warnings missing. 2. Part of accesses are inbound, part of accesses are out of bound, and after vectorization, the warning goes from out of bound line to inbound line. 3. All access are out of bound, and after vectoriation, all warning are missing, and goes to a false-positive line.
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Wed, Sep 22, 2021 at 10:21 PM Martin Sebor wrote: > > On 9/21/21 7:38 PM, Hongtao Liu wrote: > > On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: > ... > > diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > index 1d79930cd58..9351f7e7a1a 100644 > > --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c > > @@ -1,7 +1,7 @@ > >/* PR middle-end/91458 - inconsistent warning for writing past the > > end > > of an array member > > { dg-do compile } > > - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ > > + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf > > -fno-tree-vectorize" } */ > > The testcase is large - what part requires this change? Given the > testcase was added for inconsistent warnings do they now become > inconsistent again as we enable vectorization at -O2? > > That said, the testcase adjustments need some explaining - I suppose > you didn't just slap -fno-tree-vectorize to all of those changing > behavior? > > >>> void ga1_ (void) > >>> { > >>> a1_.a[0] = 0; > >>> a1_.a[1] = 1; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> a1_.a[2] = 2; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> > >>> struct A1 a; > >>> a.a[0] = 0; > >>> a.a[1] = 1; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> a.a[2] = 2; // { dg-warning > >>> "\\\[-Wstringop-overflow" } > >>> sink (); > >>> } > >>> > >>> It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since > >>> there are 2 accesses, but after enabling vectorization, there's only > >>> one access, so one warning is missing which causes the failure. > > With the stores vectorized, is the warning on the correct line or > does it point to the first store, the one that's in bounds, as > it does with -O3? The latter would be a regression at -O2. For the upper case, It points to the second store which is out of bounds, the third store warning is missing. > > >> > >> I would find it preferable to change the test code over disabling > >> optimizations that are on by default. My concern is that the test > >> would no longer exercise the default behavior. (The same goes for > >> the -fno-ipa-icf option.) > > Hmm, it's a middle-end test, for some backend, it may not do > > vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and > > relative cost model). > > Yes, there are quite a few warning tests like that. Their main > purpose is to verify that in common GCC invocations (i.e., without > any special options) warnings are a) issued when expected and b) > not issued when not expected. Otherwise, middle end warnings are > known to have both false positives and false negatives in some > invocations, depending on what optimizations are in effect. > Indiscriminately disabling common optimizations for these large > tests and invoking them under artificial conditions would > compromise this goal and hide the problems. > > If enabling vectorization at -O2 causes regressions in the quality > of diagnostics (as the test failure above indicates seems to be > happening) we should investigate these and open bugs for them so > they can be fixed. We can then tweak the specific failing test > cases to avoid the failures until they are fixed. There are indeed cases of false positives and false negatives .i.e. // Verify warning for access to a definition with an initializer that // initializes the one-element array member. struct A1 a1i_1 = { 0, { 1 } }; void ga1i_1 (void) { a1i_1.a[0] = 0; a1i_1.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1i_1.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a = { 0, { 1 } }; --- false positive here. a.a[0] = 1; a.a[1] = 2; // { dg-warning "\\\[-Wstringop-overflow" } false negative here. a.a[2] = 3; // { dg-warning "\\\[-Wstringop-overflow" } false negative here. sink (); } the last 2 warnings are missing, and there's new warning on the line *struct A1 a = { 0, { 1 } }; > > Martin -- BR, Hongtao
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On 9/22/21 8:21 AM, Martin Sebor wrote: On 9/21/21 7:38 PM, Hongtao Liu wrote: On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: ... diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c index 1d79930cd58..9351f7e7a1a 100644 --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c @@ -1,7 +1,7 @@ /* PR middle-end/91458 - inconsistent warning for writing past the end of an array member { dg-do compile } - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf -fno-tree-vectorize" } */ The testcase is large - what part requires this change? Given the testcase was added for inconsistent warnings do they now become inconsistent again as we enable vectorization at -O2? That said, the testcase adjustments need some explaining - I suppose you didn't just slap -fno-tree-vectorize to all of those changing behavior? void ga1_ (void) { a1_.a[0] = 0; a1_.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1_.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a; a.a[0] = 0; a.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } sink (); } It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since there are 2 accesses, but after enabling vectorization, there's only one access, so one warning is missing which causes the failure. With the stores vectorized, is the warning on the correct line or does it point to the first store, the one that's in bounds, as it does with -O3? The latter would be a regression at -O2. I would find it preferable to change the test code over disabling optimizations that are on by default. My concern is that the test would no longer exercise the default behavior. (The same goes for the -fno-ipa-icf option.) Hmm, it's a middle-end test, for some backend, it may not do vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and relative cost model). Yes, there are quite a few warning tests like that. Their main purpose is to verify that in common GCC invocations (i.e., without any special options) warnings are a) issued when expected and b) not issued when not expected. Otherwise, middle end warnings are known to have both false positives and false negatives in some invocations, depending on what optimizations are in effect. Indiscriminately disabling common optimizations for these large tests and invoking them under artificial conditions would compromise this goal and hide the problems. If enabling vectorization at -O2 causes regressions in the quality of diagnostics (as the test failure above indicates seems to be happening) we should investigate these and open bugs for them so they can be fixed. We can then tweak the specific failing test cases to avoid the failures until they are fixed. To expand on the last part: in my tests with -O2 and -O3 the failure is specific to char stores and doesn't affect stores of larger types because they're not detected by -Wstringop-overflow. Those accesses are handled by -Warray-bounds. The former runs as part of the strlen and after vectorization, while the latter runs in vrp1 and before vectorization. So the "quick and dirty" solution here, to keep the warnings on the right lines, might be to move the char store handling from the strlen pass to vrp1. A more robust solution is to avoid vectorizing (or merging) out of bounds stores. Martin
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On 9/21/21 7:38 PM, Hongtao Liu wrote: On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: ... diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c index 1d79930cd58..9351f7e7a1a 100644 --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c @@ -1,7 +1,7 @@ /* PR middle-end/91458 - inconsistent warning for writing past the end of an array member { dg-do compile } - { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf" } */ + { dg-options "-O2 -Wall -Wno-array-bounds -fno-ipa-icf -fno-tree-vectorize" } */ The testcase is large - what part requires this change? Given the testcase was added for inconsistent warnings do they now become inconsistent again as we enable vectorization at -O2? That said, the testcase adjustments need some explaining - I suppose you didn't just slap -fno-tree-vectorize to all of those changing behavior? void ga1_ (void) { a1_.a[0] = 0; a1_.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a1_.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } struct A1 a; a.a[0] = 0; a.a[1] = 1; // { dg-warning "\\\[-Wstringop-overflow" } a.a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" } sink (); } It's supposed to be 2 warning for a.a[1] = 1 and a.a[2] = 1 since there are 2 accesses, but after enabling vectorization, there's only one access, so one warning is missing which causes the failure. With the stores vectorized, is the warning on the correct line or does it point to the first store, the one that's in bounds, as it does with -O3? The latter would be a regression at -O2. I would find it preferable to change the test code over disabling optimizations that are on by default. My concern is that the test would no longer exercise the default behavior. (The same goes for the -fno-ipa-icf option.) Hmm, it's a middle-end test, for some backend, it may not do vectorization(it depends on TARGET_VECTOR_MODE_SUPPORTED_P and relative cost model). Yes, there are quite a few warning tests like that. Their main purpose is to verify that in common GCC invocations (i.e., without any special options) warnings are a) issued when expected and b) not issued when not expected. Otherwise, middle end warnings are known to have both false positives and false negatives in some invocations, depending on what optimizations are in effect. Indiscriminately disabling common optimizations for these large tests and invoking them under artificial conditions would compromise this goal and hide the problems. If enabling vectorization at -O2 causes regressions in the quality of diagnostics (as the test failure above indicates seems to be happening) we should investigate these and open bugs for them so they can be fixed. We can then tweak the specific failing test cases to avoid the failures until they are fixed. Martin
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 20, 2021 at 4:13 AM Martin Sebor wrote: > > On 9/16/21 3:03 AM, Hongtao Liu via Gcc-patches wrote: > > On Thu, Sep 16, 2021 at 4:23 PM Richard Biener via Gcc-patches > > wrote: > >> > >> On Thu, 16 Sep 2021, liuhongt wrote: > >> > >>> Ping > >>> rebased on latest trunk. > >>> > >>> gcc/ChangeLog: > >>> > >>>* common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). > >>>* doc/invoke.texi (Options That Control Optimization): Update > >>>documents. > >>>* opts.c (default_options_table): Enable auto-vectorization at > >>>O2 with very-cheap cost model. > >>>(finish_options): Use cheap cost model for > >>>explicit -ftree{,-loop}-vectorize. > >>> > >>> gcc/testsuite/ChangeLog: > >>> > >>>* c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > >>>* g++.dg/tree-ssa/pr81408.C: Ditto. > >>>* g++.dg/warn/Wuninitialized-13.C: Ditto. > >>>* gcc.dg/Warray-bounds-51.c: Ditto. > >>>* gcc.dg/Warray-parameter-3.c: Ditto. > >>>* gcc.dg/Wstringop-overflow-13.c: Ditto. > >>>* gcc.dg/Wstringop-overflow-14.c: Ditto. > >>>* gcc.dg/Wstringop-overflow-21.c: Ditto. > >>>* gcc.dg/Wstringop-overflow-68.c: Ditto. > >>>* gcc.dg/gomp/pr46032-2.c: Ditto. > >>>* gcc.dg/gomp/pr46032-3.c: Ditto. > >>>* gcc.dg/gomp/simd-2.c: Ditto. > >>>* gcc.dg/gomp/simd-3.c: Ditto. > >>>* gcc.dg/graphite/fuse-1.c: Ditto. > >>>* gcc.dg/pr67089-6.c: Ditto. > >>>* gcc.dg/pr82929-2.c: Ditto. > >>>* gcc.dg/pr82929.c: Ditto. > >>>* gcc.dg/store_merging_1.c: Ditto. > >>>* gcc.dg/store_merging_11.c: Ditto. > >>>* gcc.dg/store_merging_15.c: Ditto. > >>>* gcc.dg/store_merging_16.c: Ditto. > >>>* gcc.dg/store_merging_19.c: Ditto. > >>>* gcc.dg/store_merging_24.c: Ditto. > >>>* gcc.dg/store_merging_25.c: Ditto. > >>>* gcc.dg/store_merging_28.c: Ditto. > >>>* gcc.dg/store_merging_30.c: Ditto. > >>>* gcc.dg/store_merging_5.c: Ditto. > >>>* gcc.dg/store_merging_7.c: Ditto. > >>>* gcc.dg/store_merging_8.c: Ditto. > >>>* gcc.dg/strlenopt-85.c: Ditto. > >>>* gcc.dg/tree-ssa/dump-6.c: Ditto. > >>>* gcc.dg/tree-ssa/pr19210-1.c: Ditto. > >>>* gcc.dg/tree-ssa/pr47059.c: Ditto. > >>>* gcc.dg/tree-ssa/pr86017.c: Ditto. > >>>* gcc.dg/tree-ssa/pr91482.c: Ditto. > >>>* gcc.dg/tree-ssa/predcom-1.c: Ditto. > >>>* gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > >>>* gcc.dg/tree-ssa/prefetch-3.c: Ditto. > >>>* gcc.dg/tree-ssa/prefetch-6.c: Ditto. > >>>* gcc.dg/tree-ssa/prefetch-8.c: Ditto. > >>>* gcc.dg/tree-ssa/prefetch-9.c: Ditto. > >>>* gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > >>>* gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > >>>* gcc.dg/uninit-40.c: Ditto. > >>>* gcc.dg/unroll-7.c: Ditto. > >>>* gcc.misc-tests/help.exp: Ditto. > >>>* gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > >>>* gcc.target/i386/pr22141.c: Ditto. > >>>* gcc.target/i386/pr34012.c: Ditto. > >>>* gcc.target/i386/pr49781-1.c: Ditto. > >>>* gcc.target/i386/pr95798-1.c: Ditto. > >>>* gcc.target/i386/pr95798-2.c: Ditto. > >>>* gfortran.dg/pr77498.f: Ditto. > >>> --- > >>> gcc/common.opt | 2 +- > >>> gcc/doc/invoke.texi| 8 +--- > >>> gcc/opts.c | 18 +++--- > >>> .../c-c++-common/Wstringop-overflow-2.c| 2 +- > >>> gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- > >>> gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > >>> gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- > >>> gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- > >>> gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- > >>> gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- > >>> gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- > >>> gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- > >>> gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- > >>> gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- > >>> gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- > >>> gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- > >>> gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- > >>> gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- > >>> gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- > >>> gcc/testsuite/gcc.dg/pr82929.c | 2 +- > >>> gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- > >>> gcc/testsuite/gcc.dg/store_merging_11.c| 2 +- > >>> gcc/testsuite/gcc.dg/store_merging_15.c| 2 +- > >>> gcc/testsuite/gcc.dg/store_merging_16.c| 2 +- > >>> gcc/testsuite/gcc.dg/store_merging_19.c| 2 +-
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On 9/16/21 3:03 AM, Hongtao Liu via Gcc-patches wrote: On Thu, Sep 16, 2021 at 4:23 PM Richard Biener via Gcc-patches wrote: On Thu, 16 Sep 2021, liuhongt wrote: Ping rebased on latest trunk. gcc/ChangeLog: * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). * doc/invoke.texi (Options That Control Optimization): Update documents. * opts.c (default_options_table): Enable auto-vectorization at O2 with very-cheap cost model. (finish_options): Use cheap cost model for explicit -ftree{,-loop}-vectorize. gcc/testsuite/ChangeLog: * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. * g++.dg/tree-ssa/pr81408.C: Ditto. * g++.dg/warn/Wuninitialized-13.C: Ditto. * gcc.dg/Warray-bounds-51.c: Ditto. * gcc.dg/Warray-parameter-3.c: Ditto. * gcc.dg/Wstringop-overflow-13.c: Ditto. * gcc.dg/Wstringop-overflow-14.c: Ditto. * gcc.dg/Wstringop-overflow-21.c: Ditto. * gcc.dg/Wstringop-overflow-68.c: Ditto. * gcc.dg/gomp/pr46032-2.c: Ditto. * gcc.dg/gomp/pr46032-3.c: Ditto. * gcc.dg/gomp/simd-2.c: Ditto. * gcc.dg/gomp/simd-3.c: Ditto. * gcc.dg/graphite/fuse-1.c: Ditto. * gcc.dg/pr67089-6.c: Ditto. * gcc.dg/pr82929-2.c: Ditto. * gcc.dg/pr82929.c: Ditto. * gcc.dg/store_merging_1.c: Ditto. * gcc.dg/store_merging_11.c: Ditto. * gcc.dg/store_merging_15.c: Ditto. * gcc.dg/store_merging_16.c: Ditto. * gcc.dg/store_merging_19.c: Ditto. * gcc.dg/store_merging_24.c: Ditto. * gcc.dg/store_merging_25.c: Ditto. * gcc.dg/store_merging_28.c: Ditto. * gcc.dg/store_merging_30.c: Ditto. * gcc.dg/store_merging_5.c: Ditto. * gcc.dg/store_merging_7.c: Ditto. * gcc.dg/store_merging_8.c: Ditto. * gcc.dg/strlenopt-85.c: Ditto. * gcc.dg/tree-ssa/dump-6.c: Ditto. * gcc.dg/tree-ssa/pr19210-1.c: Ditto. * gcc.dg/tree-ssa/pr47059.c: Ditto. * gcc.dg/tree-ssa/pr86017.c: Ditto. * gcc.dg/tree-ssa/pr91482.c: Ditto. * gcc.dg/tree-ssa/predcom-1.c: Ditto. * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-6.c: Ditto. * gcc.dg/tree-ssa/prefetch-8.c: Ditto. * gcc.dg/tree-ssa/prefetch-9.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. * gcc.dg/uninit-40.c: Ditto. * gcc.dg/unroll-7.c: Ditto. * gcc.misc-tests/help.exp: Ditto. * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. * gcc.target/i386/pr22141.c: Ditto. * gcc.target/i386/pr34012.c: Ditto. * gcc.target/i386/pr49781-1.c: Ditto. * gcc.target/i386/pr95798-1.c: Ditto. * gcc.target/i386/pr95798-2.c: Ditto. * gfortran.dg/pr77498.f: Ditto. --- gcc/common.opt | 2 +- gcc/doc/invoke.texi| 8 +--- gcc/opts.c | 18 +++--- .../c-c++-common/Wstringop-overflow-2.c| 2 +- gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- gcc/testsuite/gcc.dg/pr82929.c | 2 +- gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- gcc/testsuite/gcc.dg/store_merging_11.c| 2 +- gcc/testsuite/gcc.dg/store_merging_15.c| 2 +- gcc/testsuite/gcc.dg/store_merging_16.c| 2 +- gcc/testsuite/gcc.dg/store_merging_19.c| 2 +- gcc/testsuite/gcc.dg/store_merging_24.c| 2 +- gcc/testsuite/gcc.dg/store_merging_25.c| 2 +- gcc/testsuite/gcc.dg/store_merging_28.c| 2 +- gcc/testsuite/gcc.dg/store_merging_30.c| 2 +- gcc/testsuite/gcc.dg/store_merging_5.c | 2 +- gcc/testsuite/gcc.dg/store_merging_7.c | 2 +- gcc/testsuite/gcc.dg/store_merging_8.c | 2 +- gcc/testsuite/gcc.dg/strlenopt-85.c| 2 +- gcc/testsuite/gcc.dg/tree-ssa/dump-6.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr47059.c| 2 +-
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Fri, Sep 17, 2021 at 3:47 PM Richard Biener wrote: > > On Fri, 17 Sep 2021, Hongtao Liu wrote: > > > On Thu, Sep 16, 2021 at 8:31 PM Richard Biener wrote: > > > > > > On Thu, 16 Sep 2021, Hongtao Liu wrote: > > > > > > > On Thu, Sep 16, 2021 at 4:23 PM Richard Biener via Gcc-patches > > > > wrote: > > > > > > > > > > On Thu, 16 Sep 2021, liuhongt wrote: > > > > > > > > > > > Ping > > > > > > rebased on latest trunk. > > > > > > > > > > > > gcc/ChangeLog: > > > > > > > > > > > > * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). > > > > > > * doc/invoke.texi (Options That Control Optimization): Update > > > > > > documents. > > > > > > * opts.c (default_options_table): Enable auto-vectorization at > > > > > > O2 with very-cheap cost model. > > > > > > (finish_options): Use cheap cost model for > > > > > > explicit -ftree{,-loop}-vectorize. > > > > > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > > > > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > > > > > > * g++.dg/tree-ssa/pr81408.C: Ditto. > > > > > > * g++.dg/warn/Wuninitialized-13.C: Ditto. > > > > > > * gcc.dg/Warray-bounds-51.c: Ditto. > > > > > > * gcc.dg/Warray-parameter-3.c: Ditto. > > > > > > * gcc.dg/Wstringop-overflow-13.c: Ditto. > > > > > > * gcc.dg/Wstringop-overflow-14.c: Ditto. > > > > > > * gcc.dg/Wstringop-overflow-21.c: Ditto. > > > > > > * gcc.dg/Wstringop-overflow-68.c: Ditto. > > > > > > * gcc.dg/gomp/pr46032-2.c: Ditto. > > > > > > * gcc.dg/gomp/pr46032-3.c: Ditto. > > > > > > * gcc.dg/gomp/simd-2.c: Ditto. > > > > > > * gcc.dg/gomp/simd-3.c: Ditto. > > > > > > * gcc.dg/graphite/fuse-1.c: Ditto. > > > > > > * gcc.dg/pr67089-6.c: Ditto. > > > > > > * gcc.dg/pr82929-2.c: Ditto. > > > > > > * gcc.dg/pr82929.c: Ditto. > > > > > > * gcc.dg/store_merging_1.c: Ditto. > > > > > > * gcc.dg/store_merging_11.c: Ditto. > > > > > > * gcc.dg/store_merging_15.c: Ditto. > > > > > > * gcc.dg/store_merging_16.c: Ditto. > > > > > > * gcc.dg/store_merging_19.c: Ditto. > > > > > > * gcc.dg/store_merging_24.c: Ditto. > > > > > > * gcc.dg/store_merging_25.c: Ditto. > > > > > > * gcc.dg/store_merging_28.c: Ditto. > > > > > > * gcc.dg/store_merging_30.c: Ditto. > > > > > > * gcc.dg/store_merging_5.c: Ditto. > > > > > > * gcc.dg/store_merging_7.c: Ditto. > > > > > > * gcc.dg/store_merging_8.c: Ditto. > > > > > > * gcc.dg/strlenopt-85.c: Ditto. > > > > > > * gcc.dg/tree-ssa/dump-6.c: Ditto. > > > > > > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > > > > > > * gcc.dg/tree-ssa/pr47059.c: Ditto. > > > > > > * gcc.dg/tree-ssa/pr86017.c: Ditto. > > > > > > * gcc.dg/tree-ssa/pr91482.c: Ditto. > > > > > > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > > > > > > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > > > > > > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > > > > > > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > > > > > > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > > > > > > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > > > > > > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > > > > > > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > > > > > > * gcc.dg/uninit-40.c: Ditto. > > > > > > * gcc.dg/unroll-7.c: Ditto. > > > > > > * gcc.misc-tests/help.exp: Ditto. > > > > > > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > > > > > > * gcc.target/i386/pr22141.c: Ditto. > > > > > > * gcc.target/i386/pr34012.c: Ditto. > > > > > > * gcc.target/i386/pr49781-1.c: Ditto. > > > > > > * gcc.target/i386/pr95798-1.c: Ditto. > > > > > > * gcc.target/i386/pr95798-2.c: Ditto. > > > > > > * gfortran.dg/pr77498.f: Ditto. > > > > > > --- > > > > > > gcc/common.opt | 2 +- > > > > > > gcc/doc/invoke.texi| 8 +--- > > > > > > gcc/opts.c | 18 > > > > > > +++--- > > > > > > .../c-c++-common/Wstringop-overflow-2.c| 2 +- > > > > > > gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- > > > > > > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > > > > > > gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- > > > > > > gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- > > > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- > > > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- > > > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- > > > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- > > > > > > gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- > > > > > > gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- > > > > > > gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- > > > > > > gcc/testsuite/gcc.dg/gomp/simd-3.c
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Fri, 17 Sep 2021, Hongtao Liu wrote: > On Thu, Sep 16, 2021 at 8:31 PM Richard Biener wrote: > > > > On Thu, 16 Sep 2021, Hongtao Liu wrote: > > > > > On Thu, Sep 16, 2021 at 4:23 PM Richard Biener via Gcc-patches > > > wrote: > > > > > > > > On Thu, 16 Sep 2021, liuhongt wrote: > > > > > > > > > Ping > > > > > rebased on latest trunk. > > > > > > > > > > gcc/ChangeLog: > > > > > > > > > > * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). > > > > > * doc/invoke.texi (Options That Control Optimization): Update > > > > > documents. > > > > > * opts.c (default_options_table): Enable auto-vectorization at > > > > > O2 with very-cheap cost model. > > > > > (finish_options): Use cheap cost model for > > > > > explicit -ftree{,-loop}-vectorize. > > > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > > > > > * g++.dg/tree-ssa/pr81408.C: Ditto. > > > > > * g++.dg/warn/Wuninitialized-13.C: Ditto. > > > > > * gcc.dg/Warray-bounds-51.c: Ditto. > > > > > * gcc.dg/Warray-parameter-3.c: Ditto. > > > > > * gcc.dg/Wstringop-overflow-13.c: Ditto. > > > > > * gcc.dg/Wstringop-overflow-14.c: Ditto. > > > > > * gcc.dg/Wstringop-overflow-21.c: Ditto. > > > > > * gcc.dg/Wstringop-overflow-68.c: Ditto. > > > > > * gcc.dg/gomp/pr46032-2.c: Ditto. > > > > > * gcc.dg/gomp/pr46032-3.c: Ditto. > > > > > * gcc.dg/gomp/simd-2.c: Ditto. > > > > > * gcc.dg/gomp/simd-3.c: Ditto. > > > > > * gcc.dg/graphite/fuse-1.c: Ditto. > > > > > * gcc.dg/pr67089-6.c: Ditto. > > > > > * gcc.dg/pr82929-2.c: Ditto. > > > > > * gcc.dg/pr82929.c: Ditto. > > > > > * gcc.dg/store_merging_1.c: Ditto. > > > > > * gcc.dg/store_merging_11.c: Ditto. > > > > > * gcc.dg/store_merging_15.c: Ditto. > > > > > * gcc.dg/store_merging_16.c: Ditto. > > > > > * gcc.dg/store_merging_19.c: Ditto. > > > > > * gcc.dg/store_merging_24.c: Ditto. > > > > > * gcc.dg/store_merging_25.c: Ditto. > > > > > * gcc.dg/store_merging_28.c: Ditto. > > > > > * gcc.dg/store_merging_30.c: Ditto. > > > > > * gcc.dg/store_merging_5.c: Ditto. > > > > > * gcc.dg/store_merging_7.c: Ditto. > > > > > * gcc.dg/store_merging_8.c: Ditto. > > > > > * gcc.dg/strlenopt-85.c: Ditto. > > > > > * gcc.dg/tree-ssa/dump-6.c: Ditto. > > > > > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > > > > > * gcc.dg/tree-ssa/pr47059.c: Ditto. > > > > > * gcc.dg/tree-ssa/pr86017.c: Ditto. > > > > > * gcc.dg/tree-ssa/pr91482.c: Ditto. > > > > > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > > > > > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > > > > > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > > > > > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > > > > > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > > > > > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > > > > > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > > > > > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > > > > > * gcc.dg/uninit-40.c: Ditto. > > > > > * gcc.dg/unroll-7.c: Ditto. > > > > > * gcc.misc-tests/help.exp: Ditto. > > > > > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > > > > > * gcc.target/i386/pr22141.c: Ditto. > > > > > * gcc.target/i386/pr34012.c: Ditto. > > > > > * gcc.target/i386/pr49781-1.c: Ditto. > > > > > * gcc.target/i386/pr95798-1.c: Ditto. > > > > > * gcc.target/i386/pr95798-2.c: Ditto. > > > > > * gfortran.dg/pr77498.f: Ditto. > > > > > --- > > > > > gcc/common.opt | 2 +- > > > > > gcc/doc/invoke.texi| 8 +--- > > > > > gcc/opts.c | 18 > > > > > +++--- > > > > > .../c-c++-common/Wstringop-overflow-2.c| 2 +- > > > > > gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- > > > > > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > > > > > gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- > > > > > gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- > > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- > > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- > > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- > > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- > > > > > gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- > > > > > gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- > > > > > gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- > > > > > gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- > > > > > gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- > > > > > gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- > > > > > gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- > > > > > gcc/testsuite/gcc.dg/pr82929.c
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, Sep 16, 2021 at 8:31 PM Richard Biener wrote: > > On Thu, 16 Sep 2021, Hongtao Liu wrote: > > > On Thu, Sep 16, 2021 at 4:23 PM Richard Biener via Gcc-patches > > wrote: > > > > > > On Thu, 16 Sep 2021, liuhongt wrote: > > > > > > > Ping > > > > rebased on latest trunk. > > > > > > > > gcc/ChangeLog: > > > > > > > > * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). > > > > * doc/invoke.texi (Options That Control Optimization): Update > > > > documents. > > > > * opts.c (default_options_table): Enable auto-vectorization at > > > > O2 with very-cheap cost model. > > > > (finish_options): Use cheap cost model for > > > > explicit -ftree{,-loop}-vectorize. > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > > > > * g++.dg/tree-ssa/pr81408.C: Ditto. > > > > * g++.dg/warn/Wuninitialized-13.C: Ditto. > > > > * gcc.dg/Warray-bounds-51.c: Ditto. > > > > * gcc.dg/Warray-parameter-3.c: Ditto. > > > > * gcc.dg/Wstringop-overflow-13.c: Ditto. > > > > * gcc.dg/Wstringop-overflow-14.c: Ditto. > > > > * gcc.dg/Wstringop-overflow-21.c: Ditto. > > > > * gcc.dg/Wstringop-overflow-68.c: Ditto. > > > > * gcc.dg/gomp/pr46032-2.c: Ditto. > > > > * gcc.dg/gomp/pr46032-3.c: Ditto. > > > > * gcc.dg/gomp/simd-2.c: Ditto. > > > > * gcc.dg/gomp/simd-3.c: Ditto. > > > > * gcc.dg/graphite/fuse-1.c: Ditto. > > > > * gcc.dg/pr67089-6.c: Ditto. > > > > * gcc.dg/pr82929-2.c: Ditto. > > > > * gcc.dg/pr82929.c: Ditto. > > > > * gcc.dg/store_merging_1.c: Ditto. > > > > * gcc.dg/store_merging_11.c: Ditto. > > > > * gcc.dg/store_merging_15.c: Ditto. > > > > * gcc.dg/store_merging_16.c: Ditto. > > > > * gcc.dg/store_merging_19.c: Ditto. > > > > * gcc.dg/store_merging_24.c: Ditto. > > > > * gcc.dg/store_merging_25.c: Ditto. > > > > * gcc.dg/store_merging_28.c: Ditto. > > > > * gcc.dg/store_merging_30.c: Ditto. > > > > * gcc.dg/store_merging_5.c: Ditto. > > > > * gcc.dg/store_merging_7.c: Ditto. > > > > * gcc.dg/store_merging_8.c: Ditto. > > > > * gcc.dg/strlenopt-85.c: Ditto. > > > > * gcc.dg/tree-ssa/dump-6.c: Ditto. > > > > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > > > > * gcc.dg/tree-ssa/pr47059.c: Ditto. > > > > * gcc.dg/tree-ssa/pr86017.c: Ditto. > > > > * gcc.dg/tree-ssa/pr91482.c: Ditto. > > > > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > > > > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > > > > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > > > > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > > > > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > > > > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > > > > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > > > > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > > > > * gcc.dg/uninit-40.c: Ditto. > > > > * gcc.dg/unroll-7.c: Ditto. > > > > * gcc.misc-tests/help.exp: Ditto. > > > > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > > > > * gcc.target/i386/pr22141.c: Ditto. > > > > * gcc.target/i386/pr34012.c: Ditto. > > > > * gcc.target/i386/pr49781-1.c: Ditto. > > > > * gcc.target/i386/pr95798-1.c: Ditto. > > > > * gcc.target/i386/pr95798-2.c: Ditto. > > > > * gfortran.dg/pr77498.f: Ditto. > > > > --- > > > > gcc/common.opt | 2 +- > > > > gcc/doc/invoke.texi| 8 +--- > > > > gcc/opts.c | 18 +++--- > > > > .../c-c++-common/Wstringop-overflow-2.c| 2 +- > > > > gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- > > > > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > > > > gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- > > > > gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- > > > > gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- > > > > gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- > > > > gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- > > > > gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- > > > > gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- > > > > gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- > > > > gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- > > > > gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- > > > > gcc/testsuite/gcc.dg/pr82929.c | 2 +- > > > > gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- > > > > gcc/testsuite/gcc.dg/store_merging_11.c| 2 +- > > > > gcc/testsuite/gcc.dg/store_merging_15.c| 2 +- > > > >
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, 16 Sep 2021, Hongtao Liu wrote: > On Thu, Sep 16, 2021 at 4:23 PM Richard Biener via Gcc-patches > wrote: > > > > On Thu, 16 Sep 2021, liuhongt wrote: > > > > > Ping > > > rebased on latest trunk. > > > > > > gcc/ChangeLog: > > > > > > * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). > > > * doc/invoke.texi (Options That Control Optimization): Update > > > documents. > > > * opts.c (default_options_table): Enable auto-vectorization at > > > O2 with very-cheap cost model. > > > (finish_options): Use cheap cost model for > > > explicit -ftree{,-loop}-vectorize. > > > > > > gcc/testsuite/ChangeLog: > > > > > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > > > * g++.dg/tree-ssa/pr81408.C: Ditto. > > > * g++.dg/warn/Wuninitialized-13.C: Ditto. > > > * gcc.dg/Warray-bounds-51.c: Ditto. > > > * gcc.dg/Warray-parameter-3.c: Ditto. > > > * gcc.dg/Wstringop-overflow-13.c: Ditto. > > > * gcc.dg/Wstringop-overflow-14.c: Ditto. > > > * gcc.dg/Wstringop-overflow-21.c: Ditto. > > > * gcc.dg/Wstringop-overflow-68.c: Ditto. > > > * gcc.dg/gomp/pr46032-2.c: Ditto. > > > * gcc.dg/gomp/pr46032-3.c: Ditto. > > > * gcc.dg/gomp/simd-2.c: Ditto. > > > * gcc.dg/gomp/simd-3.c: Ditto. > > > * gcc.dg/graphite/fuse-1.c: Ditto. > > > * gcc.dg/pr67089-6.c: Ditto. > > > * gcc.dg/pr82929-2.c: Ditto. > > > * gcc.dg/pr82929.c: Ditto. > > > * gcc.dg/store_merging_1.c: Ditto. > > > * gcc.dg/store_merging_11.c: Ditto. > > > * gcc.dg/store_merging_15.c: Ditto. > > > * gcc.dg/store_merging_16.c: Ditto. > > > * gcc.dg/store_merging_19.c: Ditto. > > > * gcc.dg/store_merging_24.c: Ditto. > > > * gcc.dg/store_merging_25.c: Ditto. > > > * gcc.dg/store_merging_28.c: Ditto. > > > * gcc.dg/store_merging_30.c: Ditto. > > > * gcc.dg/store_merging_5.c: Ditto. > > > * gcc.dg/store_merging_7.c: Ditto. > > > * gcc.dg/store_merging_8.c: Ditto. > > > * gcc.dg/strlenopt-85.c: Ditto. > > > * gcc.dg/tree-ssa/dump-6.c: Ditto. > > > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > > > * gcc.dg/tree-ssa/pr47059.c: Ditto. > > > * gcc.dg/tree-ssa/pr86017.c: Ditto. > > > * gcc.dg/tree-ssa/pr91482.c: Ditto. > > > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > > > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > > > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > > > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > > > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > > > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > > > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > > > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > > > * gcc.dg/uninit-40.c: Ditto. > > > * gcc.dg/unroll-7.c: Ditto. > > > * gcc.misc-tests/help.exp: Ditto. > > > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > > > * gcc.target/i386/pr22141.c: Ditto. > > > * gcc.target/i386/pr34012.c: Ditto. > > > * gcc.target/i386/pr49781-1.c: Ditto. > > > * gcc.target/i386/pr95798-1.c: Ditto. > > > * gcc.target/i386/pr95798-2.c: Ditto. > > > * gfortran.dg/pr77498.f: Ditto. > > > --- > > > gcc/common.opt | 2 +- > > > gcc/doc/invoke.texi| 8 +--- > > > gcc/opts.c | 18 +++--- > > > .../c-c++-common/Wstringop-overflow-2.c| 2 +- > > > gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- > > > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > > > gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- > > > gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- > > > gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- > > > gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- > > > gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- > > > gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- > > > gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- > > > gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- > > > gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- > > > gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- > > > gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- > > > gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- > > > gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- > > > gcc/testsuite/gcc.dg/pr82929.c | 2 +- > > > gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- > > > gcc/testsuite/gcc.dg/store_merging_11.c| 2 +- > > > gcc/testsuite/gcc.dg/store_merging_15.c| 2 +- > > > gcc/testsuite/gcc.dg/store_merging_16.c| 2 +- > > > gcc/testsuite/gcc.dg/store_merging_19.c| 2 +- > > > gcc/testsuite/gcc.dg/store_merging_24.c| 2 +- > > > gcc/testsuite/gcc.dg/store_merging_25.c| 2 +- > > >
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, Sep 16, 2021 at 4:23 PM Richard Biener via Gcc-patches wrote: > > On Thu, 16 Sep 2021, liuhongt wrote: > > > Ping > > rebased on latest trunk. > > > > gcc/ChangeLog: > > > > * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). > > * doc/invoke.texi (Options That Control Optimization): Update > > documents. > > * opts.c (default_options_table): Enable auto-vectorization at > > O2 with very-cheap cost model. > > (finish_options): Use cheap cost model for > > explicit -ftree{,-loop}-vectorize. > > > > gcc/testsuite/ChangeLog: > > > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > > * g++.dg/tree-ssa/pr81408.C: Ditto. > > * g++.dg/warn/Wuninitialized-13.C: Ditto. > > * gcc.dg/Warray-bounds-51.c: Ditto. > > * gcc.dg/Warray-parameter-3.c: Ditto. > > * gcc.dg/Wstringop-overflow-13.c: Ditto. > > * gcc.dg/Wstringop-overflow-14.c: Ditto. > > * gcc.dg/Wstringop-overflow-21.c: Ditto. > > * gcc.dg/Wstringop-overflow-68.c: Ditto. > > * gcc.dg/gomp/pr46032-2.c: Ditto. > > * gcc.dg/gomp/pr46032-3.c: Ditto. > > * gcc.dg/gomp/simd-2.c: Ditto. > > * gcc.dg/gomp/simd-3.c: Ditto. > > * gcc.dg/graphite/fuse-1.c: Ditto. > > * gcc.dg/pr67089-6.c: Ditto. > > * gcc.dg/pr82929-2.c: Ditto. > > * gcc.dg/pr82929.c: Ditto. > > * gcc.dg/store_merging_1.c: Ditto. > > * gcc.dg/store_merging_11.c: Ditto. > > * gcc.dg/store_merging_15.c: Ditto. > > * gcc.dg/store_merging_16.c: Ditto. > > * gcc.dg/store_merging_19.c: Ditto. > > * gcc.dg/store_merging_24.c: Ditto. > > * gcc.dg/store_merging_25.c: Ditto. > > * gcc.dg/store_merging_28.c: Ditto. > > * gcc.dg/store_merging_30.c: Ditto. > > * gcc.dg/store_merging_5.c: Ditto. > > * gcc.dg/store_merging_7.c: Ditto. > > * gcc.dg/store_merging_8.c: Ditto. > > * gcc.dg/strlenopt-85.c: Ditto. > > * gcc.dg/tree-ssa/dump-6.c: Ditto. > > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > > * gcc.dg/tree-ssa/pr47059.c: Ditto. > > * gcc.dg/tree-ssa/pr86017.c: Ditto. > > * gcc.dg/tree-ssa/pr91482.c: Ditto. > > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > > * gcc.dg/uninit-40.c: Ditto. > > * gcc.dg/unroll-7.c: Ditto. > > * gcc.misc-tests/help.exp: Ditto. > > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > > * gcc.target/i386/pr22141.c: Ditto. > > * gcc.target/i386/pr34012.c: Ditto. > > * gcc.target/i386/pr49781-1.c: Ditto. > > * gcc.target/i386/pr95798-1.c: Ditto. > > * gcc.target/i386/pr95798-2.c: Ditto. > > * gfortran.dg/pr77498.f: Ditto. > > --- > > gcc/common.opt | 2 +- > > gcc/doc/invoke.texi| 8 +--- > > gcc/opts.c | 18 +++--- > > .../c-c++-common/Wstringop-overflow-2.c| 2 +- > > gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- > > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > > gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- > > gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- > > gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- > > gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- > > gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- > > gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- > > gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- > > gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- > > gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- > > gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- > > gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- > > gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- > > gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- > > gcc/testsuite/gcc.dg/pr82929.c | 2 +- > > gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- > > gcc/testsuite/gcc.dg/store_merging_11.c| 2 +- > > gcc/testsuite/gcc.dg/store_merging_15.c| 2 +- > > gcc/testsuite/gcc.dg/store_merging_16.c| 2 +- > > gcc/testsuite/gcc.dg/store_merging_19.c| 2 +- > > gcc/testsuite/gcc.dg/store_merging_24.c| 2 +- > > gcc/testsuite/gcc.dg/store_merging_25.c| 2 +- > > gcc/testsuite/gcc.dg/store_merging_28.c| 2 +- > > gcc/testsuite/gcc.dg/store_merging_30.c| 2 +- > > gcc/testsuite/gcc.dg/store_merging_5.c | 2 +- > > gcc/testsuite/gcc.dg/store_merging_7.c | 2 +- > >
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Thu, 16 Sep 2021, liuhongt wrote: > Ping > rebased on latest trunk. > > gcc/ChangeLog: > > * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). > * doc/invoke.texi (Options That Control Optimization): Update > documents. > * opts.c (default_options_table): Enable auto-vectorization at > O2 with very-cheap cost model. > (finish_options): Use cheap cost model for > explicit -ftree{,-loop}-vectorize. > > gcc/testsuite/ChangeLog: > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > * g++.dg/tree-ssa/pr81408.C: Ditto. > * g++.dg/warn/Wuninitialized-13.C: Ditto. > * gcc.dg/Warray-bounds-51.c: Ditto. > * gcc.dg/Warray-parameter-3.c: Ditto. > * gcc.dg/Wstringop-overflow-13.c: Ditto. > * gcc.dg/Wstringop-overflow-14.c: Ditto. > * gcc.dg/Wstringop-overflow-21.c: Ditto. > * gcc.dg/Wstringop-overflow-68.c: Ditto. > * gcc.dg/gomp/pr46032-2.c: Ditto. > * gcc.dg/gomp/pr46032-3.c: Ditto. > * gcc.dg/gomp/simd-2.c: Ditto. > * gcc.dg/gomp/simd-3.c: Ditto. > * gcc.dg/graphite/fuse-1.c: Ditto. > * gcc.dg/pr67089-6.c: Ditto. > * gcc.dg/pr82929-2.c: Ditto. > * gcc.dg/pr82929.c: Ditto. > * gcc.dg/store_merging_1.c: Ditto. > * gcc.dg/store_merging_11.c: Ditto. > * gcc.dg/store_merging_15.c: Ditto. > * gcc.dg/store_merging_16.c: Ditto. > * gcc.dg/store_merging_19.c: Ditto. > * gcc.dg/store_merging_24.c: Ditto. > * gcc.dg/store_merging_25.c: Ditto. > * gcc.dg/store_merging_28.c: Ditto. > * gcc.dg/store_merging_30.c: Ditto. > * gcc.dg/store_merging_5.c: Ditto. > * gcc.dg/store_merging_7.c: Ditto. > * gcc.dg/store_merging_8.c: Ditto. > * gcc.dg/strlenopt-85.c: Ditto. > * gcc.dg/tree-ssa/dump-6.c: Ditto. > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > * gcc.dg/tree-ssa/pr47059.c: Ditto. > * gcc.dg/tree-ssa/pr86017.c: Ditto. > * gcc.dg/tree-ssa/pr91482.c: Ditto. > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > * gcc.dg/uninit-40.c: Ditto. > * gcc.dg/unroll-7.c: Ditto. > * gcc.misc-tests/help.exp: Ditto. > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > * gcc.target/i386/pr22141.c: Ditto. > * gcc.target/i386/pr34012.c: Ditto. > * gcc.target/i386/pr49781-1.c: Ditto. > * gcc.target/i386/pr95798-1.c: Ditto. > * gcc.target/i386/pr95798-2.c: Ditto. > * gfortran.dg/pr77498.f: Ditto. > --- > gcc/common.opt | 2 +- > gcc/doc/invoke.texi| 8 +--- > gcc/opts.c | 18 +++--- > .../c-c++-common/Wstringop-overflow-2.c| 2 +- > gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- > gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- > gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- > gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- > gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- > gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- > gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- > gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- > gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- > gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- > gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- > gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- > gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- > gcc/testsuite/gcc.dg/pr82929.c | 2 +- > gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- > gcc/testsuite/gcc.dg/store_merging_11.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_15.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_16.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_19.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_24.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_25.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_28.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_30.c| 2 +- > gcc/testsuite/gcc.dg/store_merging_5.c | 2 +- > gcc/testsuite/gcc.dg/store_merging_7.c | 2 +- > gcc/testsuite/gcc.dg/store_merging_8.c | 2 +- > gcc/testsuite/gcc.dg/strlenopt-85.c| 2 +- > gcc/testsuite/gcc.dg/tree-ssa/dump-6.c | 2 +- > gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c | 2 +- > gcc/testsuite/gcc.dg/tree-ssa/pr47059.c| 2 +- >
[PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
Ping rebased on latest trunk. gcc/ChangeLog: * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). * doc/invoke.texi (Options That Control Optimization): Update documents. * opts.c (default_options_table): Enable auto-vectorization at O2 with very-cheap cost model. (finish_options): Use cheap cost model for explicit -ftree{,-loop}-vectorize. gcc/testsuite/ChangeLog: * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. * g++.dg/tree-ssa/pr81408.C: Ditto. * g++.dg/warn/Wuninitialized-13.C: Ditto. * gcc.dg/Warray-bounds-51.c: Ditto. * gcc.dg/Warray-parameter-3.c: Ditto. * gcc.dg/Wstringop-overflow-13.c: Ditto. * gcc.dg/Wstringop-overflow-14.c: Ditto. * gcc.dg/Wstringop-overflow-21.c: Ditto. * gcc.dg/Wstringop-overflow-68.c: Ditto. * gcc.dg/gomp/pr46032-2.c: Ditto. * gcc.dg/gomp/pr46032-3.c: Ditto. * gcc.dg/gomp/simd-2.c: Ditto. * gcc.dg/gomp/simd-3.c: Ditto. * gcc.dg/graphite/fuse-1.c: Ditto. * gcc.dg/pr67089-6.c: Ditto. * gcc.dg/pr82929-2.c: Ditto. * gcc.dg/pr82929.c: Ditto. * gcc.dg/store_merging_1.c: Ditto. * gcc.dg/store_merging_11.c: Ditto. * gcc.dg/store_merging_15.c: Ditto. * gcc.dg/store_merging_16.c: Ditto. * gcc.dg/store_merging_19.c: Ditto. * gcc.dg/store_merging_24.c: Ditto. * gcc.dg/store_merging_25.c: Ditto. * gcc.dg/store_merging_28.c: Ditto. * gcc.dg/store_merging_30.c: Ditto. * gcc.dg/store_merging_5.c: Ditto. * gcc.dg/store_merging_7.c: Ditto. * gcc.dg/store_merging_8.c: Ditto. * gcc.dg/strlenopt-85.c: Ditto. * gcc.dg/tree-ssa/dump-6.c: Ditto. * gcc.dg/tree-ssa/pr19210-1.c: Ditto. * gcc.dg/tree-ssa/pr47059.c: Ditto. * gcc.dg/tree-ssa/pr86017.c: Ditto. * gcc.dg/tree-ssa/pr91482.c: Ditto. * gcc.dg/tree-ssa/predcom-1.c: Ditto. * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-6.c: Ditto. * gcc.dg/tree-ssa/prefetch-8.c: Ditto. * gcc.dg/tree-ssa/prefetch-9.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. * gcc.dg/uninit-40.c: Ditto. * gcc.dg/unroll-7.c: Ditto. * gcc.misc-tests/help.exp: Ditto. * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. * gcc.target/i386/pr22141.c: Ditto. * gcc.target/i386/pr34012.c: Ditto. * gcc.target/i386/pr49781-1.c: Ditto. * gcc.target/i386/pr95798-1.c: Ditto. * gcc.target/i386/pr95798-2.c: Ditto. * gfortran.dg/pr77498.f: Ditto. --- gcc/common.opt | 2 +- gcc/doc/invoke.texi| 8 +--- gcc/opts.c | 18 +++--- .../c-c++-common/Wstringop-overflow-2.c| 2 +- gcc/testsuite/g++.dg/tree-ssa/pr81408.C| 2 +- gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- gcc/testsuite/gcc.dg/Warray-bounds-51.c| 2 +- gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-13.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-14.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-21.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-68.c | 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- gcc/testsuite/gcc.dg/pr67089-6.c | 2 +- gcc/testsuite/gcc.dg/pr82929-2.c | 2 +- gcc/testsuite/gcc.dg/pr82929.c | 2 +- gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- gcc/testsuite/gcc.dg/store_merging_11.c| 2 +- gcc/testsuite/gcc.dg/store_merging_15.c| 2 +- gcc/testsuite/gcc.dg/store_merging_16.c| 2 +- gcc/testsuite/gcc.dg/store_merging_19.c| 2 +- gcc/testsuite/gcc.dg/store_merging_24.c| 2 +- gcc/testsuite/gcc.dg/store_merging_25.c| 2 +- gcc/testsuite/gcc.dg/store_merging_28.c| 2 +- gcc/testsuite/gcc.dg/store_merging_30.c| 2 +- gcc/testsuite/gcc.dg/store_merging_5.c | 2 +- gcc/testsuite/gcc.dg/store_merging_7.c | 2 +- gcc/testsuite/gcc.dg/store_merging_8.c | 2 +- gcc/testsuite/gcc.dg/strlenopt-85.c| 2 +- gcc/testsuite/gcc.dg/tree-ssa/dump-6.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr47059.c| 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr86017.c| 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr91482.c| 2 +-
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Tue, Sep 7, 2021 at 12:37 AM Joseph Myers wrote: > > On Mon, 6 Sep 2021, liuhongt via Gcc-patches wrote: > > > Hi: > > As discussed in [1], most of (currently unopposed) targets want > > auto-vectorization at O2, and IMHO now would be a good time to enable O2 > > vectorization for GCC trunk, so it would leave enough time to expose > > related issues and fix them. > > > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > > Ok for trunk? > > This needs updates to the documentation of -O2 and -ftree-vectorize in > invoke.texi. Updated patch. - Update document for @item -O2 and @item -O3 - Use cheap cost model for explicit -ftree{,-loop}-vectorize. - Enable O2 vectorization at OPT_LEVELS_2_PLUS_SPEED_ONLY, > > -- > Joseph S. Myers > jos...@codesourcery.com -- BR, Hongtao From 1b343dd8e6b31dfc953ff002728e249a2a5ea29f Mon Sep 17 00:00:00 2001 From: liuhongt Date: Mon, 6 Sep 2021 13:48:49 +0800 Subject: [PATCH v2] Enable auto-vectorization at O2 with very-cheap cost model. gcc/ChangeLog: * common.opt (ftree-vectorize): Add Var(flag_tree_vectorize). * doc/invoke.texi (Options That Control Optimization): Update documents. * opts.c (default_options_table): Enable auto-vectorization at O2 with very-cheap cost model. (finish_options): Use cheap cost model for explicit -ftree{,-loop}-vectorize. gcc/testsuite/ChangeLog: * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. * g++.dg/tree-ssa/pr81408.C: Ditto. * g++.dg/warn/Wuninitialized-13.C: Ditto. * gcc.dg/Warray-bounds-51.c: Ditto. * gcc.dg/Warray-parameter-3.c: Ditto. * gcc.dg/Wstringop-overflow-13.c: Ditto. * gcc.dg/Wstringop-overflow-14.c: Ditto. * gcc.dg/Wstringop-overflow-21.c: Ditto. * gcc.dg/Wstringop-overflow-68.c: Ditto. * gcc.dg/gomp/pr46032-2.c: Ditto. * gcc.dg/gomp/pr46032-3.c: Ditto. * gcc.dg/gomp/simd-2.c: Ditto. * gcc.dg/gomp/simd-3.c: Ditto. * gcc.dg/graphite/fuse-1.c: Ditto. * gcc.dg/pr67089-6.c: Ditto. * gcc.dg/pr82929-2.c: Ditto. * gcc.dg/pr82929.c: Ditto. * gcc.dg/store_merging_1.c: Ditto. * gcc.dg/store_merging_11.c: Ditto. * gcc.dg/store_merging_15.c: Ditto. * gcc.dg/store_merging_16.c: Ditto. * gcc.dg/store_merging_19.c: Ditto. * gcc.dg/store_merging_24.c: Ditto. * gcc.dg/store_merging_25.c: Ditto. * gcc.dg/store_merging_28.c: Ditto. * gcc.dg/store_merging_30.c: Ditto. * gcc.dg/store_merging_5.c: Ditto. * gcc.dg/store_merging_7.c: Ditto. * gcc.dg/store_merging_8.c: Ditto. * gcc.dg/strlenopt-85.c: Ditto. * gcc.dg/tree-ssa/dump-6.c: Ditto. * gcc.dg/tree-ssa/pr19210-1.c: Ditto. * gcc.dg/tree-ssa/pr47059.c: Ditto. * gcc.dg/tree-ssa/pr86017.c: Ditto. * gcc.dg/tree-ssa/pr91482.c: Ditto. * gcc.dg/tree-ssa/predcom-1.c: Ditto. * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-6.c: Ditto. * gcc.dg/tree-ssa/prefetch-8.c: Ditto. * gcc.dg/tree-ssa/prefetch-9.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. * gcc.dg/uninit-40.c: Ditto. * gcc.dg/unroll-7.c: Ditto. * gcc.misc-tests/help.exp: Ditto. * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. * gcc.target/i386/pr22141.c: Ditto. * gcc.target/i386/pr34012.c: Ditto. * gcc.target/i386/pr49781-1.c: Ditto. * gcc.target/i386/pr95798-1.c: Ditto. * gcc.target/i386/pr95798-2.c: Ditto. * gfortran.dg/pr77498.f: Ditto. --- gcc/common.opt | 2 +- gcc/doc/invoke.texi | 8 +--- gcc/opts.c | 17 ++--- .../c-c++-common/Wstringop-overflow-2.c | 2 +- gcc/testsuite/g++.dg/tree-ssa/pr81408.C | 2 +- gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- gcc/testsuite/gcc.dg/Warray-bounds-51.c | 2 +- gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-13.c| 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-14.c| 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-21.c| 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-68.c| 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +- gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 +- gcc/testsuite/gcc.dg/graphite/fuse-1.c | 2 +- gcc/testsuite/gcc.dg/pr67089-6.c| 2 +- gcc/testsuite/gcc.dg/pr82929-2.c| 2 +- gcc/testsuite/gcc.dg/pr82929.c | 2 +- gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- gcc/testsuite/gcc.dg/store_merging_11.c | 2 +- gcc/testsuite/gcc.dg/store_merging_15.c | 2 +- gcc/testsuite/gcc.dg/store_merging_16.c | 2 +- gcc/testsuite/gcc.dg/store_merging_19.c | 2 +- gcc/testsuite/gcc.dg/store_merging_24.c | 2 +- gcc/testsuite/gcc.dg/store_merging_25.c | 2 +- gcc/testsuite/gcc.dg/store_merging_28.c | 2 +-
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, 6 Sep 2021, liuhongt via Gcc-patches wrote: > Hi: > As discussed in [1], most of (currently unopposed) targets want > auto-vectorization at O2, and IMHO now would be a good time to enable O2 > vectorization for GCC trunk, so it would leave enough time to expose > related issues and fix them. > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > Ok for trunk? This needs updates to the documentation of -O2 and -ftree-vectorize in invoke.texi. -- Joseph S. Myers jos...@codesourcery.com
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 6, 2021 at 2:30 PM Jakub Jelinek wrote: > > On Mon, Sep 06, 2021 at 02:18:59PM +0200, Richard Biener wrote: > > On Mon, Sep 6, 2021 at 1:15 PM Jakub Jelinek wrote: > > > > > > On Mon, Sep 06, 2021 at 07:15:41PM +0800, Hongtao Liu wrote: > > > > > So what about finish_options then? > > > > > default_options_optimization has only a single caller that then calls > > > > > read_cmdline_options and then finish_options. > > > > in finish_options > > > > (gdb) p opts_set->x_flag_tree_loop_vectorize > > > > $37 = 1 > > > > with -O2 -ftree-loop-vectorize, > > > > > > > > but > > > > 1000 if (opts->x_dump_base_name > > > > (gdb) p opts_set->x_flag_tree_loop_vectorize > > > > $38 = 0 > > > > for -O2 -ftree-vectorize??? > > > > > > > > Any magic for ftree-vectorize w/ EnabledBy??? > > > > > > I guess a way to get this working would be: > > > ; Alias to enable both -ftree-loop-vectorize and -ftree-slp-vectorize. > > > ftree-vectorize > > > -Common Optimization > > > +Common Var(flag_tree_vectorize) Optimization > > > Enable vectorization on trees. > > > > > > and then you can test both > > > opts_set->x_flag_tree_vectorize > > > and > > > opts_set->x_flag_tree_loop_vectorize > > > > Or make EnabledBy have set opts_set-> as well. > > That would change a little bit what *_set->x_* means. > > If user has explicit -O2, we have *_set->x_optimize set, > but don't enable it on all the suboptions that are implicitly > enabled because explicit -O2 has been used. > And isn't EnabledBy practically the same? If user writes > -Wall explicitly which implicitly enables hundreds of warning > options, do we want just Wall or also all the other options > marked as explicit? E.g. backend code than can't easily differentiate > between -Wwhatever and -Wall implying -Wwhatever and e.g. changing that > if implicit only. Hmm, good point. Richard. > > Jakub >
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 06, 2021 at 02:18:59PM +0200, Richard Biener wrote: > On Mon, Sep 6, 2021 at 1:15 PM Jakub Jelinek wrote: > > > > On Mon, Sep 06, 2021 at 07:15:41PM +0800, Hongtao Liu wrote: > > > > So what about finish_options then? > > > > default_options_optimization has only a single caller that then calls > > > > read_cmdline_options and then finish_options. > > > in finish_options > > > (gdb) p opts_set->x_flag_tree_loop_vectorize > > > $37 = 1 > > > with -O2 -ftree-loop-vectorize, > > > > > > but > > > 1000 if (opts->x_dump_base_name > > > (gdb) p opts_set->x_flag_tree_loop_vectorize > > > $38 = 0 > > > for -O2 -ftree-vectorize??? > > > > > > Any magic for ftree-vectorize w/ EnabledBy??? > > > > I guess a way to get this working would be: > > ; Alias to enable both -ftree-loop-vectorize and -ftree-slp-vectorize. > > ftree-vectorize > > -Common Optimization > > +Common Var(flag_tree_vectorize) Optimization > > Enable vectorization on trees. > > > > and then you can test both > > opts_set->x_flag_tree_vectorize > > and > > opts_set->x_flag_tree_loop_vectorize > > Or make EnabledBy have set opts_set-> as well. That would change a little bit what *_set->x_* means. If user has explicit -O2, we have *_set->x_optimize set, but don't enable it on all the suboptions that are implicitly enabled because explicit -O2 has been used. And isn't EnabledBy practically the same? If user writes -Wall explicitly which implicitly enables hundreds of warning options, do we want just Wall or also all the other options marked as explicit? E.g. backend code than can't easily differentiate between -Wwhatever and -Wall implying -Wwhatever and e.g. changing that if implicit only. Jakub
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 6, 2021 at 1:15 PM Jakub Jelinek wrote: > > On Mon, Sep 06, 2021 at 07:15:41PM +0800, Hongtao Liu wrote: > > > So what about finish_options then? > > > default_options_optimization has only a single caller that then calls > > > read_cmdline_options and then finish_options. > > in finish_options > > (gdb) p opts_set->x_flag_tree_loop_vectorize > > $37 = 1 > > with -O2 -ftree-loop-vectorize, > > > > but > > 1000 if (opts->x_dump_base_name > > (gdb) p opts_set->x_flag_tree_loop_vectorize > > $38 = 0 > > for -O2 -ftree-vectorize??? > > > > Any magic for ftree-vectorize w/ EnabledBy??? > > I guess a way to get this working would be: > ; Alias to enable both -ftree-loop-vectorize and -ftree-slp-vectorize. > ftree-vectorize > -Common Optimization > +Common Var(flag_tree_vectorize) Optimization > Enable vectorization on trees. > > and then you can test both > opts_set->x_flag_tree_vectorize > and > opts_set->x_flag_tree_loop_vectorize Or make EnabledBy have set opts_set-> as well. Richard. > Jakub >
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 06, 2021 at 07:15:41PM +0800, Hongtao Liu wrote: > > So what about finish_options then? > > default_options_optimization has only a single caller that then calls > > read_cmdline_options and then finish_options. > in finish_options > (gdb) p opts_set->x_flag_tree_loop_vectorize > $37 = 1 > with -O2 -ftree-loop-vectorize, > > but > 1000 if (opts->x_dump_base_name > (gdb) p opts_set->x_flag_tree_loop_vectorize > $38 = 0 > for -O2 -ftree-vectorize??? > > Any magic for ftree-vectorize w/ EnabledBy??? I guess a way to get this working would be: ; Alias to enable both -ftree-loop-vectorize and -ftree-slp-vectorize. ftree-vectorize -Common Optimization +Common Var(flag_tree_vectorize) Optimization Enable vectorization on trees. and then you can test both opts_set->x_flag_tree_vectorize and opts_set->x_flag_tree_loop_vectorize Jakub
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 6, 2021 at 7:01 PM Jakub Jelinek wrote: > > On Mon, Sep 06, 2021 at 06:58:37PM +0800, Hongtao Liu wrote: > > > process_options would mean it affects only the command line and not > > > __attribute__((optimize ("O2", "ftree-vectorize"))) > > > etc. > > > So, shouldn't it be instead done in default_options_optimization, > > > somewhere > > It seems default_options_optimization is before read_comline_options > > which means it can't handle cmdline option -O2 -ftree-vectorize. > > > > default_options_optimization (opts, opts_set, > > decoded_options, decoded_options_count, > > loc, lang_mask, , dc); > > > > read_cmdline_options (opts, opts_set, > > decoded_options, decoded_options_count, > > loc, lang_mask, > > , dc); > > So what about finish_options then? > default_options_optimization has only a single caller that then calls > read_cmdline_options and then finish_options. in finish_options (gdb) p opts_set->x_flag_tree_loop_vectorize $37 = 1 with -O2 -ftree-loop-vectorize, but 1000 if (opts->x_dump_base_name (gdb) p opts_set->x_flag_tree_loop_vectorize $38 = 0 for -O2 -ftree-vectorize??? Any magic for ftree-vectorize w/ EnabledBy??? > > Jakub > -- BR, Hongtao
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 6, 2021 at 11:41 AM Jakub Jelinek wrote: > > On Mon, Sep 06, 2021 at 11:18:47AM +0200, Richard Biener wrote: > > On Mon, Sep 6, 2021 at 10:47 AM liuhongt via Gcc-patches > > wrote: > > > > > > Hi: > > > As discussed in [1], most of (currently unopposed) targets want > > > auto-vectorization at O2, and IMHO now would be a good time to enable O2 > > > vectorization for GCC trunk, so it would leave enough time to expose > > > related issues and fix them. > > > > > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > > > Ok for trunk? > > > > It changes the cost model used when the user specifices > > -O2 -ftree-vectorize which used 'cheap' before but now sticks to > > 'very-cheap'. I guess adjusting the cost model in process_options > > might be possible when any(?) of the vectorizer flags were set > > explicitly? > > process_options would mean it affects only the command line and not > __attribute__((optimize ("O2", "ftree-vectorize"))) > etc. > So, shouldn't it be instead done in default_options_optimization, somewhere > among the > if (openacc_mode) > SET_OPTION_IF_UNSET (opts, opts_set, flag_ipa_pta, true); > > /* Track fields in field-sensitive alias analysis. */ > if (opt2) > SET_OPTION_IF_UNSET (opts, opts_set, param_max_fields_for_field_sensitive, > 100); > > if (opts->x_optimize_size) > /* We want to crossjump as much as possible. */ > SET_OPTION_IF_UNSET (opts, opts_set, param_min_crossjump_insns, 1); > > /* Restrict the amount of work combine does at -Og while retaining > most of its useful transforms. */ > if (opts->x_optimize_debug) > SET_OPTION_IF_UNSET (opts, opts_set, param_max_combine_insns, 2); > in there? > Like: > /* Use -fvect-cost-model=cheap instead of -fvect-cost-mode=very-cheap > by default with explicit -ftree-{loop,slp}-vectorize. */ > if (opts->x_optimize == 2 > && (opts_set->x_ftree_loop_vectorize > || opts_set->x_ftree_slp_vectorize)) > SET_OPTION_IF_UNSET (opts, opts_set, fvect_cost_model_, > VECT_COST_MODEL_CHEAP); > Though, unsure if that will work with -O2 -ftree-vectorize which is an > option without flag with EnabledBy on the other two options. One needs to check that, yes. > > Also, is: > +{ OPT_LEVELS_2_PLUS, OPT_ftree_loop_vectorize, NULL, 1 }, > +{ OPT_LEVELS_2_PLUS, OPT_ftree_slp_vectorize, NULL, 1 }, > what we really want, isn't that instead: > +{ OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_ftree_loop_vectorize, NULL, 1 }, > +{ OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_ftree_slp_vectorize, NULL, 1 }, > ? I mean, for -Os vectorization even in very-cheap model I'd think it > usually enlarges code size, and for -Og it is seriously harmful for > debugging experience, especially when DWARF <= 5 doesn't have anything that > would help debugging vectorized loops. I guess technically SLP vectorize would be fine for -Os, at least on archs with fixed size instruction lengths. I'm unsure whether the vectorizer cost model is good at tracking size though. -Og is optimize == 1 Now the issue is what we'd do for -O2 -ftree-slp-vectorize, do we want the very-cheap model for loop vectorization but cheap for SLP vectorization? I think the cost model differences (besides disabling) only make a difference for loop vectorization so it should probably be testing opts_set->x_ftree_loop_vectorize only and thus explicit/implicit enabling of loop vectorization should make the difference. (but yes, double-check how -ftree-vectorize arrives here) Richard. > > Jakub >
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 06, 2021 at 06:58:37PM +0800, Hongtao Liu wrote: > > process_options would mean it affects only the command line and not > > __attribute__((optimize ("O2", "ftree-vectorize"))) > > etc. > > So, shouldn't it be instead done in default_options_optimization, somewhere > It seems default_options_optimization is before read_comline_options > which means it can't handle cmdline option -O2 -ftree-vectorize. > > default_options_optimization (opts, opts_set, > decoded_options, decoded_options_count, > loc, lang_mask, , dc); > > read_cmdline_options (opts, opts_set, > decoded_options, decoded_options_count, > loc, lang_mask, > , dc); So what about finish_options then? default_options_optimization has only a single caller that then calls read_cmdline_options and then finish_options. Jakub
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 6, 2021 at 5:42 PM Jakub Jelinek via Gcc-patches wrote: > > On Mon, Sep 06, 2021 at 11:18:47AM +0200, Richard Biener wrote: > > On Mon, Sep 6, 2021 at 10:47 AM liuhongt via Gcc-patches > > wrote: > > > > > > Hi: > > > As discussed in [1], most of (currently unopposed) targets want > > > auto-vectorization at O2, and IMHO now would be a good time to enable O2 > > > vectorization for GCC trunk, so it would leave enough time to expose > > > related issues and fix them. > > > > > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > > > Ok for trunk? > > > > It changes the cost model used when the user specifices > > -O2 -ftree-vectorize which used 'cheap' before but now sticks to > > 'very-cheap'. I guess adjusting the cost model in process_options > > might be possible when any(?) of the vectorizer flags were set > > explicitly? > > process_options would mean it affects only the command line and not > __attribute__((optimize ("O2", "ftree-vectorize"))) > etc. > So, shouldn't it be instead done in default_options_optimization, somewhere It seems default_options_optimization is before read_comline_options which means it can't handle cmdline option -O2 -ftree-vectorize. default_options_optimization (opts, opts_set, decoded_options, decoded_options_count, loc, lang_mask, , dc); read_cmdline_options (opts, opts_set, decoded_options, decoded_options_count, loc, lang_mask, , dc); > among the > if (openacc_mode) > SET_OPTION_IF_UNSET (opts, opts_set, flag_ipa_pta, true); > > /* Track fields in field-sensitive alias analysis. */ > if (opt2) > SET_OPTION_IF_UNSET (opts, opts_set, param_max_fields_for_field_sensitive, > 100); > > if (opts->x_optimize_size) > /* We want to crossjump as much as possible. */ > SET_OPTION_IF_UNSET (opts, opts_set, param_min_crossjump_insns, 1); > > /* Restrict the amount of work combine does at -Og while retaining > most of its useful transforms. */ > if (opts->x_optimize_debug) > SET_OPTION_IF_UNSET (opts, opts_set, param_max_combine_insns, 2); > in there? > Like: > /* Use -fvect-cost-model=cheap instead of -fvect-cost-mode=very-cheap > by default with explicit -ftree-{loop,slp}-vectorize. */ > if (opts->x_optimize == 2 > && (opts_set->x_ftree_loop_vectorize > || opts_set->x_ftree_slp_vectorize)) > SET_OPTION_IF_UNSET (opts, opts_set, fvect_cost_model_, > VECT_COST_MODEL_CHEAP); > Though, unsure if that will work with -O2 -ftree-vectorize which is an > option without flag with EnabledBy on the other two options. > > Also, is: > +{ OPT_LEVELS_2_PLUS, OPT_ftree_loop_vectorize, NULL, 1 }, > +{ OPT_LEVELS_2_PLUS, OPT_ftree_slp_vectorize, NULL, 1 }, > what we really want, isn't that instead: > +{ OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_ftree_loop_vectorize, NULL, 1 }, > +{ OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_ftree_slp_vectorize, NULL, 1 }, > ? I mean, for -Os vectorization even in very-cheap model I'd think it > usually enlarges code size, and for -Og it is seriously harmful for > debugging experience, especially when DWARF <= 5 doesn't have anything that > would help debugging vectorized loops. > > Jakub > -- BR, Hongtao
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 06, 2021 at 11:18:47AM +0200, Richard Biener wrote: > On Mon, Sep 6, 2021 at 10:47 AM liuhongt via Gcc-patches > wrote: > > > > Hi: > > As discussed in [1], most of (currently unopposed) targets want > > auto-vectorization at O2, and IMHO now would be a good time to enable O2 > > vectorization for GCC trunk, so it would leave enough time to expose > > related issues and fix them. > > > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > > Ok for trunk? > > It changes the cost model used when the user specifices > -O2 -ftree-vectorize which used 'cheap' before but now sticks to > 'very-cheap'. I guess adjusting the cost model in process_options > might be possible when any(?) of the vectorizer flags were set > explicitly? process_options would mean it affects only the command line and not __attribute__((optimize ("O2", "ftree-vectorize"))) etc. So, shouldn't it be instead done in default_options_optimization, somewhere among the if (openacc_mode) SET_OPTION_IF_UNSET (opts, opts_set, flag_ipa_pta, true); /* Track fields in field-sensitive alias analysis. */ if (opt2) SET_OPTION_IF_UNSET (opts, opts_set, param_max_fields_for_field_sensitive, 100); if (opts->x_optimize_size) /* We want to crossjump as much as possible. */ SET_OPTION_IF_UNSET (opts, opts_set, param_min_crossjump_insns, 1); /* Restrict the amount of work combine does at -Og while retaining most of its useful transforms. */ if (opts->x_optimize_debug) SET_OPTION_IF_UNSET (opts, opts_set, param_max_combine_insns, 2); in there? Like: /* Use -fvect-cost-model=cheap instead of -fvect-cost-mode=very-cheap by default with explicit -ftree-{loop,slp}-vectorize. */ if (opts->x_optimize == 2 && (opts_set->x_ftree_loop_vectorize || opts_set->x_ftree_slp_vectorize)) SET_OPTION_IF_UNSET (opts, opts_set, fvect_cost_model_, VECT_COST_MODEL_CHEAP); Though, unsure if that will work with -O2 -ftree-vectorize which is an option without flag with EnabledBy on the other two options. Also, is: +{ OPT_LEVELS_2_PLUS, OPT_ftree_loop_vectorize, NULL, 1 }, +{ OPT_LEVELS_2_PLUS, OPT_ftree_slp_vectorize, NULL, 1 }, what we really want, isn't that instead: +{ OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_ftree_loop_vectorize, NULL, 1 }, +{ OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_ftree_slp_vectorize, NULL, 1 }, ? I mean, for -Os vectorization even in very-cheap model I'd think it usually enlarges code size, and for -Og it is seriously harmful for debugging experience, especially when DWARF <= 5 doesn't have anything that would help debugging vectorized loops. Jakub
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 6, 2021 at 5:19 PM Richard Biener via Gcc-patches wrote: > > On Mon, Sep 6, 2021 at 10:47 AM liuhongt via Gcc-patches > wrote: > > > > Hi: > > As discussed in [1], most of (currently unopposed) targets want > > auto-vectorization at O2, and IMHO now would be a good time to enable O2 > > vectorization for GCC trunk, so it would leave enough time to expose > > related issues and fix them. > > > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > > Ok for trunk? > > It changes the cost model used when the user specifices > -O2 -ftree-vectorize which used 'cheap' before but now sticks to > 'very-cheap'. I guess adjusting the cost model in process_options > might be possible when any(?) of the vectorizer flags were set > explicitly? So you're meaning the cheap cost model should be binded to -ftree-vectorize even for -O1 -ftree-vectorize. > > Richard. > > > PS: > > Other targets(than x86) may also need to adjust some tests under > > gcc.target/, > > this patch only adjusts gcc.target/i386 and other common tests. > > > > [1] https://gcc.gnu.org/pipermail/gcc/2021-September/237211.html > > gcc/ChangeLog: > > > > * opts.c (default_options_table): Enable auto-vectorization at > > O2 with very-cheap cost model. > > > > gcc/testsuite/ChangeLog: > > > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > > * g++.dg/tree-ssa/pr81408.C: Ditto. > > * g++.dg/warn/Wuninitialized-13.C: Ditto. > > * gcc.dg/Warray-bounds-51.c: Ditto. > > * gcc.dg/Warray-parameter-3.c: Ditto. > > * gcc.dg/Wstringop-overflow-13.c: Ditto. > > * gcc.dg/Wstringop-overflow-14.c: Ditto. > > * gcc.dg/Wstringop-overflow-21.c: Ditto. > > * gcc.dg/Wstringop-overflow-68.c: Ditto. > > * gcc.dg/gomp/pr46032-2.c: Ditto. > > * gcc.dg/gomp/pr46032-3.c: Ditto. > > * gcc.dg/gomp/simd-2.c: Ditto. > > * gcc.dg/gomp/simd-3.c: Ditto. > > * gcc.dg/graphite/fuse-1.c: Ditto. > > * gcc.dg/pr67089-6.c: Ditto. > > * gcc.dg/pr82929-2.c: Ditto. > > * gcc.dg/pr82929.c: Ditto. > > * gcc.dg/store_merging_1.c: Ditto. > > * gcc.dg/store_merging_11.c: Ditto. > > * gcc.dg/store_merging_15.c: Ditto. > > * gcc.dg/store_merging_16.c: Ditto. > > * gcc.dg/store_merging_19.c: Ditto. > > * gcc.dg/store_merging_24.c: Ditto. > > * gcc.dg/store_merging_25.c: Ditto. > > * gcc.dg/store_merging_28.c: Ditto. > > * gcc.dg/store_merging_30.c: Ditto. > > * gcc.dg/store_merging_5.c: Ditto. > > * gcc.dg/store_merging_7.c: Ditto. > > * gcc.dg/store_merging_8.c: Ditto. > > * gcc.dg/strlenopt-85.c: Ditto. > > * gcc.dg/tree-ssa/dump-6.c: Ditto. > > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > > * gcc.dg/tree-ssa/pr47059.c: Ditto. > > * gcc.dg/tree-ssa/pr86017.c: Ditto. > > * gcc.dg/tree-ssa/pr91482.c: Ditto. > > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > > * gcc.dg/uninit-40.c: Ditto. > > * gcc.dg/unroll-7.c: Ditto. > > * gcc.misc-tests/help.exp: Ditto. > > * gcc.target/i386/avx512er-vrcp28ps-4.c: Ditto. > > * gcc.target/i386/avx512er-vrsqrt28ps-4.c: Ditto. > > * gcc.target/i386/avx512er-vrsqrt28ps-6.c: Ditto. > > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > > * gcc.target/i386/pr22141.c: Ditto. > > * gcc.target/i386/pr34012.c: Ditto. > > * gcc.target/i386/pr49781-1.c: Ditto. > > * gcc.target/i386/pr52252-atom.c: Ditto. > > * gcc.target/i386/pr52252-core.c: Ditto. > > * gcc.target/i386/pr60451.c: Ditto. > > * gcc.target/i386/pr61403.c: Ditto. > > * gcc.target/i386/pr68483-1.c: Ditto. > > * gcc.target/i386/pr82460-2.c: Ditto. > > * gcc.target/i386/pr95798-1.c: Ditto. > > * gcc.target/i386/pr95798-2.c: Ditto. > > * gcc.target/i386/pr98365.c: Ditto. > > * gcc.target/i386/vect-abs-s16.c: Ditto. > > * gcc.target/i386/vect-abs-s32.c: Ditto. > > * gcc.target/i386/vect-abs-s8.c: Ditto. > > * gcc.target/i386/vect-pack-trunc-1.c: Ditto. > > * gcc.target/i386/vect-pack-trunc-2.c: Ditto. > > * gcc.target/i386/vect-perm-even-1.c: Ditto. > > * gcc.target/i386/vect-perm-odd-1.c: Ditto. > > * gcc.target/i386/vect-pr67800.c: Ditto. > > * gcc.target/i386/vect-unpack-1.c: Ditto. > > * gcc.target/i386/vect-unpack-2.c: Ditto. > > * gcc.target/i386/vect-unpack-3.c: Ditto. > > *
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 6, 2021 at 10:47 AM liuhongt via Gcc-patches wrote: > > Hi: > As discussed in [1], most of (currently unopposed) targets want > auto-vectorization at O2, and IMHO now would be a good time to enable O2 > vectorization for GCC trunk, so it would leave enough time to expose > related issues and fix them. > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > Ok for trunk? It changes the cost model used when the user specifices -O2 -ftree-vectorize which used 'cheap' before but now sticks to 'very-cheap'. I guess adjusting the cost model in process_options might be possible when any(?) of the vectorizer flags were set explicitly? Richard. > PS: > Other targets(than x86) may also need to adjust some tests under > gcc.target/, > this patch only adjusts gcc.target/i386 and other common tests. > > [1] https://gcc.gnu.org/pipermail/gcc/2021-September/237211.html > gcc/ChangeLog: > > * opts.c (default_options_table): Enable auto-vectorization at > O2 with very-cheap cost model. > > gcc/testsuite/ChangeLog: > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > * g++.dg/tree-ssa/pr81408.C: Ditto. > * g++.dg/warn/Wuninitialized-13.C: Ditto. > * gcc.dg/Warray-bounds-51.c: Ditto. > * gcc.dg/Warray-parameter-3.c: Ditto. > * gcc.dg/Wstringop-overflow-13.c: Ditto. > * gcc.dg/Wstringop-overflow-14.c: Ditto. > * gcc.dg/Wstringop-overflow-21.c: Ditto. > * gcc.dg/Wstringop-overflow-68.c: Ditto. > * gcc.dg/gomp/pr46032-2.c: Ditto. > * gcc.dg/gomp/pr46032-3.c: Ditto. > * gcc.dg/gomp/simd-2.c: Ditto. > * gcc.dg/gomp/simd-3.c: Ditto. > * gcc.dg/graphite/fuse-1.c: Ditto. > * gcc.dg/pr67089-6.c: Ditto. > * gcc.dg/pr82929-2.c: Ditto. > * gcc.dg/pr82929.c: Ditto. > * gcc.dg/store_merging_1.c: Ditto. > * gcc.dg/store_merging_11.c: Ditto. > * gcc.dg/store_merging_15.c: Ditto. > * gcc.dg/store_merging_16.c: Ditto. > * gcc.dg/store_merging_19.c: Ditto. > * gcc.dg/store_merging_24.c: Ditto. > * gcc.dg/store_merging_25.c: Ditto. > * gcc.dg/store_merging_28.c: Ditto. > * gcc.dg/store_merging_30.c: Ditto. > * gcc.dg/store_merging_5.c: Ditto. > * gcc.dg/store_merging_7.c: Ditto. > * gcc.dg/store_merging_8.c: Ditto. > * gcc.dg/strlenopt-85.c: Ditto. > * gcc.dg/tree-ssa/dump-6.c: Ditto. > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > * gcc.dg/tree-ssa/pr47059.c: Ditto. > * gcc.dg/tree-ssa/pr86017.c: Ditto. > * gcc.dg/tree-ssa/pr91482.c: Ditto. > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > * gcc.dg/uninit-40.c: Ditto. > * gcc.dg/unroll-7.c: Ditto. > * gcc.misc-tests/help.exp: Ditto. > * gcc.target/i386/avx512er-vrcp28ps-4.c: Ditto. > * gcc.target/i386/avx512er-vrsqrt28ps-4.c: Ditto. > * gcc.target/i386/avx512er-vrsqrt28ps-6.c: Ditto. > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > * gcc.target/i386/pr22141.c: Ditto. > * gcc.target/i386/pr34012.c: Ditto. > * gcc.target/i386/pr49781-1.c: Ditto. > * gcc.target/i386/pr52252-atom.c: Ditto. > * gcc.target/i386/pr52252-core.c: Ditto. > * gcc.target/i386/pr60451.c: Ditto. > * gcc.target/i386/pr61403.c: Ditto. > * gcc.target/i386/pr68483-1.c: Ditto. > * gcc.target/i386/pr82460-2.c: Ditto. > * gcc.target/i386/pr95798-1.c: Ditto. > * gcc.target/i386/pr95798-2.c: Ditto. > * gcc.target/i386/pr98365.c: Ditto. > * gcc.target/i386/vect-abs-s16.c: Ditto. > * gcc.target/i386/vect-abs-s32.c: Ditto. > * gcc.target/i386/vect-abs-s8.c: Ditto. > * gcc.target/i386/vect-pack-trunc-1.c: Ditto. > * gcc.target/i386/vect-pack-trunc-2.c: Ditto. > * gcc.target/i386/vect-perm-even-1.c: Ditto. > * gcc.target/i386/vect-perm-odd-1.c: Ditto. > * gcc.target/i386/vect-pr67800.c: Ditto. > * gcc.target/i386/vect-unpack-1.c: Ditto. > * gcc.target/i386/vect-unpack-2.c: Ditto. > * gcc.target/i386/vect-unpack-3.c: Ditto. > * gfortran.dg/pr77498.f: Ditto. > --- > gcc/opts.c | 6 +++--- > gcc/testsuite/c-c++-common/Wstringop-overflow-2.c | 2 +- > gcc/testsuite/g++.dg/tree-ssa/pr81408.C | 2 +- > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > gcc/testsuite/gcc.dg/Warray-bounds-51.c | 2 +- >
Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
On Mon, Sep 6, 2021 at 4:46 PM liuhongt via Gcc-patches wrote: > > Hi: > As discussed in [1], most of (currently unopposed) targets want > auto-vectorization at O2, and IMHO now would be a good time to enable O2 > vectorization for GCC trunk, so it would leave enough time to expose > related issues and fix them. > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > Ok for trunk? > > PS: > Other targets(than x86) may also need to adjust some tests under > gcc.target/, > this patch only adjusts gcc.target/i386 and other common tests. > > [1] https://gcc.gnu.org/pipermail/gcc/2021-September/237211.html > gcc/ChangeLog: > > * opts.c (default_options_table): Enable auto-vectorization at > O2 with very-cheap cost model. > > gcc/testsuite/ChangeLog: > > * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. > * g++.dg/tree-ssa/pr81408.C: Ditto. > * g++.dg/warn/Wuninitialized-13.C: Ditto. > * gcc.dg/Warray-bounds-51.c: Ditto. > * gcc.dg/Warray-parameter-3.c: Ditto. > * gcc.dg/Wstringop-overflow-13.c: Ditto. > * gcc.dg/Wstringop-overflow-14.c: Ditto. > * gcc.dg/Wstringop-overflow-21.c: Ditto. > * gcc.dg/Wstringop-overflow-68.c: Ditto. > * gcc.dg/gomp/pr46032-2.c: Ditto. > * gcc.dg/gomp/pr46032-3.c: Ditto. > * gcc.dg/gomp/simd-2.c: Ditto. > * gcc.dg/gomp/simd-3.c: Ditto. > * gcc.dg/graphite/fuse-1.c: Ditto. > * gcc.dg/pr67089-6.c: Ditto. > * gcc.dg/pr82929-2.c: Ditto. > * gcc.dg/pr82929.c: Ditto. > * gcc.dg/store_merging_1.c: Ditto. > * gcc.dg/store_merging_11.c: Ditto. > * gcc.dg/store_merging_15.c: Ditto. > * gcc.dg/store_merging_16.c: Ditto. > * gcc.dg/store_merging_19.c: Ditto. > * gcc.dg/store_merging_24.c: Ditto. > * gcc.dg/store_merging_25.c: Ditto. > * gcc.dg/store_merging_28.c: Ditto. > * gcc.dg/store_merging_30.c: Ditto. > * gcc.dg/store_merging_5.c: Ditto. > * gcc.dg/store_merging_7.c: Ditto. > * gcc.dg/store_merging_8.c: Ditto. > * gcc.dg/strlenopt-85.c: Ditto. > * gcc.dg/tree-ssa/dump-6.c: Ditto. > * gcc.dg/tree-ssa/pr19210-1.c: Ditto. > * gcc.dg/tree-ssa/pr47059.c: Ditto. > * gcc.dg/tree-ssa/pr86017.c: Ditto. > * gcc.dg/tree-ssa/pr91482.c: Ditto. > * gcc.dg/tree-ssa/predcom-1.c: Ditto. > * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. > * gcc.dg/tree-ssa/prefetch-3.c: Ditto. > * gcc.dg/tree-ssa/prefetch-6.c: Ditto. > * gcc.dg/tree-ssa/prefetch-8.c: Ditto. > * gcc.dg/tree-ssa/prefetch-9.c: Ditto. > * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. > * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. > * gcc.dg/uninit-40.c: Ditto. > * gcc.dg/unroll-7.c: Ditto. > * gcc.misc-tests/help.exp: Ditto. > * gcc.target/i386/avx512er-vrcp28ps-4.c: Ditto. > * gcc.target/i386/avx512er-vrsqrt28ps-4.c: Ditto. > * gcc.target/i386/avx512er-vrsqrt28ps-6.c: Ditto. > * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. > * gcc.target/i386/pr22141.c: Ditto. > * gcc.target/i386/pr34012.c: Ditto. > * gcc.target/i386/pr49781-1.c: Ditto. > * gcc.target/i386/pr52252-atom.c: Ditto. > * gcc.target/i386/pr52252-core.c: Ditto. > * gcc.target/i386/pr60451.c: Ditto. > * gcc.target/i386/pr61403.c: Ditto. > * gcc.target/i386/pr68483-1.c: Ditto. > * gcc.target/i386/pr82460-2.c: Ditto. > * gcc.target/i386/pr95798-1.c: Ditto. > * gcc.target/i386/pr95798-2.c: Ditto. > * gcc.target/i386/pr98365.c: Ditto. > * gcc.target/i386/vect-abs-s16.c: Ditto. > * gcc.target/i386/vect-abs-s32.c: Ditto. > * gcc.target/i386/vect-abs-s8.c: Ditto. > * gcc.target/i386/vect-pack-trunc-1.c: Ditto. > * gcc.target/i386/vect-pack-trunc-2.c: Ditto. > * gcc.target/i386/vect-perm-even-1.c: Ditto. > * gcc.target/i386/vect-perm-odd-1.c: Ditto. > * gcc.target/i386/vect-pr67800.c: Ditto. > * gcc.target/i386/vect-unpack-1.c: Ditto. > * gcc.target/i386/vect-unpack-2.c: Ditto. > * gcc.target/i386/vect-unpack-3.c: Ditto. > * gfortran.dg/pr77498.f: Ditto. > --- > gcc/opts.c | 6 +++--- > gcc/testsuite/c-c++-common/Wstringop-overflow-2.c | 2 +- > gcc/testsuite/g++.dg/tree-ssa/pr81408.C | 2 +- > gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- > gcc/testsuite/gcc.dg/Warray-bounds-51.c | 2 +- > gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- > gcc/testsuite/gcc.dg/Wstringop-overflow-13.c| 2 +- > gcc/testsuite/gcc.dg/Wstringop-overflow-14.c| 2 +- > gcc/testsuite/gcc.dg/Wstringop-overflow-21.c| 2 +- >
[PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
Hi: As discussed in [1], most of (currently unopposed) targets want auto-vectorization at O2, and IMHO now would be a good time to enable O2 vectorization for GCC trunk, so it would leave enough time to expose related issues and fix them. Bootstrapped and regtested on x86_64-linux-gnu{-m32,} Ok for trunk? PS: Other targets(than x86) may also need to adjust some tests under gcc.target/, this patch only adjusts gcc.target/i386 and other common tests. [1] https://gcc.gnu.org/pipermail/gcc/2021-September/237211.html gcc/ChangeLog: * opts.c (default_options_table): Enable auto-vectorization at O2 with very-cheap cost model. gcc/testsuite/ChangeLog: * c-c++-common/Wstringop-overflow-2.c: Adjust testcase. * g++.dg/tree-ssa/pr81408.C: Ditto. * g++.dg/warn/Wuninitialized-13.C: Ditto. * gcc.dg/Warray-bounds-51.c: Ditto. * gcc.dg/Warray-parameter-3.c: Ditto. * gcc.dg/Wstringop-overflow-13.c: Ditto. * gcc.dg/Wstringop-overflow-14.c: Ditto. * gcc.dg/Wstringop-overflow-21.c: Ditto. * gcc.dg/Wstringop-overflow-68.c: Ditto. * gcc.dg/gomp/pr46032-2.c: Ditto. * gcc.dg/gomp/pr46032-3.c: Ditto. * gcc.dg/gomp/simd-2.c: Ditto. * gcc.dg/gomp/simd-3.c: Ditto. * gcc.dg/graphite/fuse-1.c: Ditto. * gcc.dg/pr67089-6.c: Ditto. * gcc.dg/pr82929-2.c: Ditto. * gcc.dg/pr82929.c: Ditto. * gcc.dg/store_merging_1.c: Ditto. * gcc.dg/store_merging_11.c: Ditto. * gcc.dg/store_merging_15.c: Ditto. * gcc.dg/store_merging_16.c: Ditto. * gcc.dg/store_merging_19.c: Ditto. * gcc.dg/store_merging_24.c: Ditto. * gcc.dg/store_merging_25.c: Ditto. * gcc.dg/store_merging_28.c: Ditto. * gcc.dg/store_merging_30.c: Ditto. * gcc.dg/store_merging_5.c: Ditto. * gcc.dg/store_merging_7.c: Ditto. * gcc.dg/store_merging_8.c: Ditto. * gcc.dg/strlenopt-85.c: Ditto. * gcc.dg/tree-ssa/dump-6.c: Ditto. * gcc.dg/tree-ssa/pr19210-1.c: Ditto. * gcc.dg/tree-ssa/pr47059.c: Ditto. * gcc.dg/tree-ssa/pr86017.c: Ditto. * gcc.dg/tree-ssa/pr91482.c: Ditto. * gcc.dg/tree-ssa/predcom-1.c: Ditto. * gcc.dg/tree-ssa/predcom-dse-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-3.c: Ditto. * gcc.dg/tree-ssa/prefetch-6.c: Ditto. * gcc.dg/tree-ssa/prefetch-8.c: Ditto. * gcc.dg/tree-ssa/prefetch-9.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-18.c: Ditto. * gcc.dg/tree-ssa/ssa-dse-19.c: Ditto. * gcc.dg/uninit-40.c: Ditto. * gcc.dg/unroll-7.c: Ditto. * gcc.misc-tests/help.exp: Ditto. * gcc.target/i386/avx512er-vrcp28ps-4.c: Ditto. * gcc.target/i386/avx512er-vrsqrt28ps-4.c: Ditto. * gcc.target/i386/avx512er-vrsqrt28ps-6.c: Ditto. * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Ditto. * gcc.target/i386/pr22141.c: Ditto. * gcc.target/i386/pr34012.c: Ditto. * gcc.target/i386/pr49781-1.c: Ditto. * gcc.target/i386/pr52252-atom.c: Ditto. * gcc.target/i386/pr52252-core.c: Ditto. * gcc.target/i386/pr60451.c: Ditto. * gcc.target/i386/pr61403.c: Ditto. * gcc.target/i386/pr68483-1.c: Ditto. * gcc.target/i386/pr82460-2.c: Ditto. * gcc.target/i386/pr95798-1.c: Ditto. * gcc.target/i386/pr95798-2.c: Ditto. * gcc.target/i386/pr98365.c: Ditto. * gcc.target/i386/vect-abs-s16.c: Ditto. * gcc.target/i386/vect-abs-s32.c: Ditto. * gcc.target/i386/vect-abs-s8.c: Ditto. * gcc.target/i386/vect-pack-trunc-1.c: Ditto. * gcc.target/i386/vect-pack-trunc-2.c: Ditto. * gcc.target/i386/vect-perm-even-1.c: Ditto. * gcc.target/i386/vect-perm-odd-1.c: Ditto. * gcc.target/i386/vect-pr67800.c: Ditto. * gcc.target/i386/vect-unpack-1.c: Ditto. * gcc.target/i386/vect-unpack-2.c: Ditto. * gcc.target/i386/vect-unpack-3.c: Ditto. * gfortran.dg/pr77498.f: Ditto. --- gcc/opts.c | 6 +++--- gcc/testsuite/c-c++-common/Wstringop-overflow-2.c | 2 +- gcc/testsuite/g++.dg/tree-ssa/pr81408.C | 2 +- gcc/testsuite/g++.dg/warn/Wuninitialized-13.C | 2 +- gcc/testsuite/gcc.dg/Warray-bounds-51.c | 2 +- gcc/testsuite/gcc.dg/Warray-parameter-3.c | 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-13.c| 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-14.c| 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-21.c| 2 +- gcc/testsuite/gcc.dg/Wstringop-overflow-68.c| 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-2.c | 2 +- gcc/testsuite/gcc.dg/gomp/pr46032-3.c | 2 +- gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 +-