From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/101158 - adjust SLP call matching sequence
Date: Tue, 22 Jun 2021 11:00:34 +0200 (CEST) [thread overview]
Message-ID: <2p16284-p293-9989-r3qr-231s9o932o35@fhfr.qr> (raw)
This moves the check for same operands after verifying we're
facing compatible calls.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
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.
---
gcc/testsuite/gfortran.dg/pr101158.f90 | 25 +++++++++++++++++++++
gcc/tree-vect-slp.c | 31 +++++++++++++-------------
2 files changed, 41 insertions(+), 15 deletions(-)
create mode 100644 gcc/testsuite/gfortran.dg/pr101158.f90
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 b9f91e7c7ba..6c98acbe722 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1177,21 +1177,6 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
continue;
}
- if (need_same_oprnds)
- {
- 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 shift "
- "arguments in %G", stmt);
- /* Mismatch. */
- continue;
- }
- }
if (!load_p
&& first_stmt_code == BIT_FIELD_REF
&& (TREE_OPERAND (gimple_assign_rhs1 (first_stmt_info->stmt), 0)
@@ -1231,6 +1216,22 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
continue;
}
+ if (need_same_oprnds)
+ {
+ 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 shift "
+ "arguments in %G", stmt);
+ /* Mismatch. */
+ continue;
+ }
+ }
+
if (!types_compatible_p (vectype, *node_vectype))
{
if (dump_enabled_p ())
--
2.26.2
reply other threads:[~2021-06-22 9:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2p16284-p293-9989-r3qr-231s9o932o35@fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).