diff options
author | Richard Biener <rguenther@suse.de> | 2025-09-04 09:33:58 +0200 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2025-09-04 12:36:30 +0200 |
commit | 56e7010eef88d941c59e3d677b7bc67a890c210d (patch) | |
tree | 7a8b6722032e9a8d745258df84dadd73a4695350 /gcc/testsuite/gcc.dg | |
parent | e8969a86c1052e2949028f38daf8e273e7ecb106 (diff) | |
download | gcc-56e7010eef88d941c59e3d677b7bc67a890c210d.zip gcc-56e7010eef88d941c59e3d677b7bc67a890c210d.tar.gz gcc-56e7010eef88d941c59e3d677b7bc67a890c210d.tar.bz2 |
tree-optimization/121768 - bogus double reduction detected
The following changes how we detect double reductions, in particular
not setting vect_double_reduction_def on the outer PHIs when the inner
loop doesn't satisfy double reduction constraints. It also simplifies
the setup a bit by not having to detect wheter we process an inner
loop of a double reduction.
PR tree-optimization/121768
* tree-vect-loop.cc (vect_inner_phi_in_double_reduction_p): Remove.
(vect_analyze_scalar_cycles_1): Analyze inner loops of
double reductions immediately and only mark fully recognized
double reductions. Skip already analyzed inner loops.
(vect_is_simple_reduction): Change double_reduc from a flag
to an output of the inner loop PHI and to whether we are
processing an inner loop of a double reduction.
* gcc.dg/vect/pr121768.c: New testcase.
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr121768.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/pr121768.c b/gcc/testsuite/gcc.dg/vect/pr121768.c new file mode 100644 index 0000000..b302f79 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr121768.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-tree-dce -fno-inline" } */ + +int a, b, c; +char d(char p) { return p; } +int main () { + while (c) { + for (b = 2; b; b--) { + int *g = &a; + *g = d((d(*g) >= 128) | b); + } + c--; + } + return 0; +} |