public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10460] tree-optimization/101158 - adjust SLP call matching sequence
@ 2022-02-17 10:48 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-02-17 10:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:578bc9d1cdd91694e4da393d32f0fddd213a6042
commit r10-10460-g578bc9d1cdd91694e4da393d32f0fddd213a6042
Author: Richard Biener <rguenther@suse.de>
Date: Tue Jun 22 09:24:24 2021 +0200
tree-optimization/101158 - adjust SLP call matching sequence
This moves the check for same operands after verifying we're
facing compatible calls.
2021-06-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/101158
* tree-vect-slp.c (vect_build_slp_tree_1): Move same operand
checking after checking for matching operation.
* gfortran.dg/pr101158.f90: New testcase.
(cherry picked from commit 7a22d8a764418265680a6bb9a9aec31e984eb015)
Diff:
---
gcc/testsuite/gfortran.dg/pr101158.f90 | 25 +++++++++++++++++++++++++
gcc/tree-vect-slp.c | 24 ++++++++++++------------
2 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/gcc/testsuite/gfortran.dg/pr101158.f90 b/gcc/testsuite/gfortran.dg/pr101158.f90
new file mode 100644
index 00000000000..9a4d9a2d7ae
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr101158.f90
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-options "-O1 -ftree-slp-vectorize -fwrapv" }
+! { dg-additional-options "-march=armv8-a+sve" { target aarch64-*-* } }
+
+subroutine sprpl5 (left)
+ implicit none
+
+ integer :: left
+ integer :: avail1, avail2, delx1, delx2, i2, ic
+
+ ic = left
+ delx1 = ic / 2
+ delx2 = delx1 + 1
+ i2 = ic + delx2
+ avail1 = i2
+ avail2 = 1
+
+ do delx1 = 1, 2
+ ic = left + nint (real (left) / 2)
+ if (ic .ge. avail1) avail1 = ic + 1
+
+ i2 = ic + delx2
+ if (i2 .le. avail2) avail2 = i2 + 1
+ end do
+end subroutine sprpl5
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index aa3087fe3a4..551e03c1219 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -969,31 +969,31 @@ vect_build_slp_tree_1 (unsigned char *swap,
continue;
}
- if (need_same_oprnds)
+ if (!load_p && rhs_code == CALL_EXPR)
{
- tree other_op1 = (call_stmt
- ? gimple_call_arg (call_stmt, 1)
- : gimple_assign_rhs2 (stmt));
- if (!operand_equal_p (first_op1, other_op1, 0))
+ if (!compatible_calls_p (as_a <gcall *> (stmts[0]->stmt),
+ as_a <gcall *> (stmt)))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: different shift "
- "arguments in %G", stmt);
+ "Build SLP failed: different calls in %G",
+ stmt);
/* Mismatch. */
continue;
}
}
- if (!load_p && rhs_code == CALL_EXPR)
+ if (need_same_oprnds)
{
- if (!compatible_calls_p (as_a <gcall *> (stmts[0]->stmt),
- as_a <gcall *> (stmt)))
+ tree other_op1 = (call_stmt
+ ? gimple_call_arg (call_stmt, 1)
+ : gimple_assign_rhs2 (stmt));
+ if (!operand_equal_p (first_op1, other_op1, 0))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: different calls in %G",
- stmt);
+ "Build SLP failed: different shift "
+ "arguments in %G", stmt);
/* Mismatch. */
continue;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-17 10:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 10:48 [gcc r10-10460] tree-optimization/101158 - adjust SLP call matching sequence Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).