...the test passes with --param sra-max-scalarization-size-Ospeed.
Verified on aarch64 and with stage1 compiler for hppa, powerpc, sparc, s390.
On alpha, tree-optimized is:
MEM[(int[8] *)&a] = { 0, 1 };
MEM[(int[8] *)&a + 8B] = { 2, 3 };
MEM[(int[8] *)&a + 16B] = { 4, 5 };
MEM[(int[8] *)&a + 24B] = { 6, 7 };
_23 = a[0];
_29 = a[1];
sum_30 = _23 + _29;
_36 = a[2];
sum_37 = sum_30 + _36;
Which is beyond the scope of these changes to DOM to optimize.
On powerpc64, the test passes with -mcpu=power8 (the loop is vectorized as a
reduction); however, without that, similar code is generated to Alpha (the
vectorizer decides the reduction is not worthwhile without SIMD support), and
the test fails; hence, I've XFAILed for powerpc, but I think I could condition
the XFAIL on powerpc64 && !check_p8vector_hw_available, if preferred?
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/ssa-dom-cse-2.c: Remove XFAIL for powerpc(32), hppa,
aarch64, sparc, s390. Add --param sra-max-scalarization-size-Ospeed.
---
gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c
b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c
index 9eccdc9..748448e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fno-tree-fre -fno-tree-pre -fdump-tree-optimized" } */
+/* { dg-options "-O3 -fno-tree-fre -fno-tree-pre -fdump-tree-optimized --param
sra-max-scalarization-size-Ospeed=32" } */
int
foo ()
@@ -17,7 +17,8 @@ foo ()
/* After late unrolling the above loop completely DOM should be
able to optimize this to return 28. */
-/* See PR63679 and PR64159, if the target forces the initializer to memory then
- DOM is not able to perform this optimization. */
+/* On alpha, the vectorizer generates writes of two vector elements at once,
+ but the loop reads only one element at a time, and DOM cannot resolve these.
+ The same happens on powerpc depending on the SIMD support available. */
-/* { dg-final { scan-tree-dump "return 28;" "optimized" { xfail aarch64*-*-*
alpha*-*-* hppa*-*-* powerpc*-*-* sparc*-*-* s390*-*-* } } } */
+/* { dg-final { scan-tree-dump "return 28;" "optimized" { xfail alpha*-*-*
powerpc64*-*-* } } } */
--
1.9.1