From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/96376 - do check alignment for invariant loads
Date: Fri, 15 Jan 2021 14:50:33 +0100 (CET) [thread overview]
Message-ID: <nycvar.YFH.7.76.2101151450190.16049@elmra.sevgm.obk> (raw)
The testcases show that we fail to disregard alignment for invariant
loads. The patch handles them like we handle gather and scatter.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
2021-01-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/96376
* tree-vect-stmts.c (get_load_store_type): Disregard alignment
for VMAT_INVARIANT.
---
gcc/tree-vect-stmts.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 4d72c4db2f7..f180ced3124 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -2378,19 +2378,26 @@ get_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
else
{
int cmp = compare_step_with_zero (vinfo, stmt_info);
- if (cmp < 0)
- *memory_access_type = get_negative_load_store_type
- (vinfo, stmt_info, vectype, vls_type, ncopies);
- else if (cmp == 0)
+ if (cmp == 0)
{
gcc_assert (vls_type == VLS_LOAD);
*memory_access_type = VMAT_INVARIANT;
+ /* Invariant accesses perform only component accesses, alignment
+ is irrelevant for them. */
+ *alignment_support_scheme = dr_unaligned_supported;
}
else
- *memory_access_type = VMAT_CONTIGUOUS;
- *alignment_support_scheme
- = vect_supportable_dr_alignment (vinfo,
- STMT_VINFO_DR_INFO (stmt_info), false);
+ {
+ if (cmp < 0)
+ *memory_access_type = get_negative_load_store_type
+ (vinfo, stmt_info, vectype, vls_type, ncopies);
+ else
+ *memory_access_type = VMAT_CONTIGUOUS;
+ *alignment_support_scheme
+ = vect_supportable_dr_alignment (vinfo,
+ STMT_VINFO_DR_INFO (stmt_info),
+ false);
+ }
}
if ((*memory_access_type == VMAT_ELEMENTWISE
--
2.26.2
reply other threads:[~2021-01-15 13:50 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=nycvar.YFH.7.76.2101151450190.16049@elmra.sevgm.obk \
--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).