* [PATCH] vect: Don't update inits for simd_lane_access DRs [PR102789]
@ 2021-10-25 3:01 Kewen.Lin
2021-10-25 7:20 ` Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Kewen.Lin @ 2021-10-25 3:01 UTC (permalink / raw)
To: GCC Patches; +Cc: Jakub Jelinek, Richard Biener, Bill Schmidt
Hi,
As PR102789 shows, when vectorizer does some peelings for alignment
in prologue, function vect_update_inits_of_drs would update the
inits of some drs. But as the failed case, we shouldn't update the
dr for simd_lane_access, it has the fixed-length storage mainly for
the main loop, the update can make the access out of bound and access
the unexpected elements.
I tried to test this broadly to ensure it's safe, since I was not
sure if it's reasonable to exclude all kinds of simd_lane_access drs.
The testings didn't catch any failures, I hope this is on the right
track.
It's bootstrapped and regtested on:
- x86_64-redhat-linux
- aarch64-linux-gnu
- powerpc64le-linux-gnu P9
- powerpc64-linux-gnu P8 and P7.
Is it ok for trunk?
BR,
Kewen
-----
gcc/ChangeLog:
PR tree-optimization/102789
* tree-vect-loop-manip.c (vect_update_inits_of_drs): Do not
update inits of simd_lane_access.
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 4988c93fdb6..378b1026baa 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -1820,7 +1820,8 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters,
FOR_EACH_VEC_ELT (datarefs, i, dr)
{
dr_vec_info *dr_info = loop_vinfo->lookup_dr (dr);
- if (!STMT_VINFO_GATHER_SCATTER_P (dr_info->stmt))
+ if (!STMT_VINFO_GATHER_SCATTER_P (dr_info->stmt)
+ && !STMT_VINFO_SIMD_LANE_ACCESS_P (dr_info->stmt))
vect_update_init_of_dr (dr_info, niters, code);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] vect: Don't update inits for simd_lane_access DRs [PR102789]
2021-10-25 3:01 [PATCH] vect: Don't update inits for simd_lane_access DRs [PR102789] Kewen.Lin
@ 2021-10-25 7:20 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2021-10-25 7:20 UTC (permalink / raw)
To: Kewen.Lin; +Cc: GCC Patches, Richard Biener, Bill Schmidt
On Mon, Oct 25, 2021 at 11:01:35AM +0800, Kewen.Lin wrote:
> gcc/ChangeLog:
>
> PR tree-optimization/102789
> * tree-vect-loop-manip.c (vect_update_inits_of_drs): Do not
> update inits of simd_lane_access.
Ok, thanks.
> diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
> index 4988c93fdb6..378b1026baa 100644
> --- a/gcc/tree-vect-loop-manip.c
> +++ b/gcc/tree-vect-loop-manip.c
> @@ -1820,7 +1820,8 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters,
> FOR_EACH_VEC_ELT (datarefs, i, dr)
> {
> dr_vec_info *dr_info = loop_vinfo->lookup_dr (dr);
> - if (!STMT_VINFO_GATHER_SCATTER_P (dr_info->stmt))
> + if (!STMT_VINFO_GATHER_SCATTER_P (dr_info->stmt)
> + && !STMT_VINFO_SIMD_LANE_ACCESS_P (dr_info->stmt))
> vect_update_init_of_dr (dr_info, niters, code);
> }
> }
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-25 7:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 3:01 [PATCH] vect: Don't update inits for simd_lane_access DRs [PR102789] Kewen.Lin
2021-10-25 7:20 ` Jakub Jelinek
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).