public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3724] tree-optimization/102421 - copy alignment info when splitting groups
@ 2021-09-21 8:39 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-09-21 8:39 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:55b989de7679a486ad674fb154408de26ac96467
commit r12-3724-g55b989de7679a486ad674fb154408de26ac96467
Author: Richard Biener <rguenther@suse.de>
Date: Tue Sep 21 09:39:12 2021 +0200
tree-optimization/102421 - copy alignment info when splitting groups
This makes sure to copy and adjust alignment info when we are splitting
DR groups after alignment analysis.
2021-09-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/102421
* tree-vect-loop.c (vect_dissolve_slp_only_groups): Copy and
adjust alignment info.
* g++.dg/vect/pr102421.cc: New testcase.
Diff:
---
gcc/testsuite/g++.dg/vect/pr102421.cc | 34 ++++++++++++++++++++++++++++++++++
gcc/tree-vect-loop.c | 19 +++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/gcc/testsuite/g++.dg/vect/pr102421.cc b/gcc/testsuite/g++.dg/vect/pr102421.cc
new file mode 100644
index 00000000000..ccab6955c67
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr102421.cc
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+/* { dg-additional-options "-march=armv8.2-a+sve" { target aarch64-*-* } } */
+
+#include <vector>
+
+template<typename ValueType>
+struct BasicVector
+{
+ ValueType& operator[](int i) { return x_[i]; }
+ ValueType operator[](int i) const { return x_[i]; }
+ ValueType x_[3];
+};
+typedef int ivec1[3];
+typedef BasicVector<double> RVec1;
+void foo (
+ std::vector<RVec1> &x_,
+ std::vector<RVec1> &xp_,
+ int homenr,
+ unsigned short* cFREEZE,
+ const ivec1* nFreeze)
+{
+ std::vector<RVec1> xp = xp_;
+ std::vector<RVec1> x = x_;
+ for (int i = 0; i < homenr; i++)
+ {
+ const int g = cFREEZE[i];
+ for (int d = 0; d < 3; d++)
+ {
+ if (nFreeze[g][d] == 0)
+ x[i][d] = xp[i][d];
+ }
+ }
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 5a5b8da2e77..e94356d76e9 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2047,6 +2047,7 @@ vect_dissolve_slp_only_groups (loop_vec_info loop_vinfo)
if (STMT_VINFO_GROUPED_ACCESS (stmt_info))
{
stmt_vec_info first_element = DR_GROUP_FIRST_ELEMENT (stmt_info);
+ dr_vec_info *dr_info = STMT_VINFO_DR_INFO (first_element);
unsigned int group_size = DR_GROUP_SIZE (first_element);
/* Check if SLP-only groups. */
@@ -2067,6 +2068,24 @@ vect_dissolve_slp_only_groups (loop_vec_info loop_vinfo)
DR_GROUP_GAP (vinfo) = 0;
else
DR_GROUP_GAP (vinfo) = group_size - 1;
+ /* Duplicate and adjust alignment info, it needs to
+ be present on each group leader, see dr_misalignment. */
+ if (vinfo != first_element)
+ {
+ dr_vec_info *dr_info2 = STMT_VINFO_DR_INFO (vinfo);
+ dr_info2->target_alignment = dr_info->target_alignment;
+ int misalignment = dr_info->misalignment;
+ if (misalignment != DR_MISALIGNMENT_UNKNOWN)
+ {
+ HOST_WIDE_INT diff
+ = (TREE_INT_CST_LOW (DR_INIT (dr_info2->dr))
+ - TREE_INT_CST_LOW (DR_INIT (dr_info->dr)));
+ unsigned HOST_WIDE_INT align_c
+ = dr_info->target_alignment.to_constant ();
+ misalignment = (misalignment + diff) % align_c;
+ }
+ dr_info2->misalignment = misalignment;
+ }
vinfo = next;
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-21 8:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 8:39 [gcc r12-3724] tree-optimization/102421 - copy alignment info when splitting groups 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).