On Wed, 2 Aug 2023 at 14:17, Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > On Mon, 31 Jul 2023, Jeff Law wrote: > > > > > > > On 7/28/23 01:05, Richard Biener via Gcc-patches wrote: > > > The following delays sinking of loads within the same innermost > > > loop when it was unconditional before. That's a not uncommon > > > issue preventing vectorization when masked loads are not available. > > > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > > > > > I have a followup patch improving sinking that without this would > > > cause more of the problematic sinking - now that we have a second > > > sink pass after loop opts this looks like a reasonable approach? > > > > > > OK? > > > > > > Thanks, > > > Richard. > > > > > > PR tree-optimization/92335 > > > * tree-ssa-sink.cc (select_best_block): Before loop > > > optimizations avoid sinking unconditional loads/stores > > > in innermost loops to conditional executed places. > > > > > > * gcc.dg/tree-ssa/ssa-sink-10.c: Disable vectorizing. > > > * gcc.dg/tree-ssa/predcom-9.c: Clone from ssa-sink-10.c, > > > expect predictive commoning to happen instead of sinking. > > > * gcc.dg/vect/pr65947-3.c: Adjust. > > I think it's reasonable -- there's probably going to be cases where it's not > > great, but more often than not I think it's going to be a reasonable > > heuristic. > > > > If there is undesirable fallout, better to find it over the coming months > > than > > next spring. So I'd suggest we go forward now to give more time to find any > > pathological cases (if they exist). > > Agreed, I've pushed this now. Hi Richard, After this patch (committed in 399c8dd44ff44f4b496223c7cc980651c4d6f6a0), pr65947-7.c "failed" for aarch64-linux-gnu: FAIL: gcc.dg/vect/pr65947-7.c scan-tree-dump-not vect "LOOP VECTORIZED" FAIL: gcc.dg/vect/pr65947-7.c -flto -ffat-lto-objects scan-tree-dump-not vect "LOOP VECTORIZED"
/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" { target { ! vect_fold_extract_last } } } } */ With your commit, condition_reduction in pr65947-7.c gets vectorized regardless of vect_fold_extract_last, which gates the above test (which is an improvement, because the function didn't get vectorized before the commit). The attached patch thus removes the gating on vect_fold_extract_last, and the test passes again. OK to commit ? Thanks, Prathamesh > > Richard.
diff --git a/gcc/testsuite/gcc.dg/vect/pr65947-7.c b/gcc/testsuite/gcc.dg/vect/pr65947-7.c index 16cdcd1c6eb..7dabae81abf 100644 --- a/gcc/testsuite/gcc.dg/vect/pr65947-7.c +++ b/gcc/testsuite/gcc.dg/vect/pr65947-7.c @@ -52,5 +52,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_fold_extract_last } } } */ -/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" { target { ! vect_fold_extract_last } } } } */ +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */