diff options
author | Richard Biener <rguenther@suse.de> | 2024-10-10 14:15:13 +0200 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2024-10-10 15:26:17 +0200 |
commit | 7ce2229d54d575d788b016f941aafd0464ea77f7 (patch) | |
tree | 37132725fbed1aefba8d37b14be6ec7f97bc4ca4 /gcc | |
parent | a2e06b7f081a3d2e50e3afa8d3f1676a05099707 (diff) | |
download | gcc-7ce2229d54d575d788b016f941aafd0464ea77f7.zip gcc-7ce2229d54d575d788b016f941aafd0464ea77f7.tar.gz gcc-7ce2229d54d575d788b016f941aafd0464ea77f7.tar.bz2 |
tree-optimization/117060 - fix oversight in vect_build_slp_tree_1
We are failing to match call vs. non-call when dealing with matching
loads or stores.
PR tree-optimization/117060
* tree-vect-slp.cc (vect_build_slp_tree_1): When comparing
calls also fail if the first isn't a call.
* gfortran.dg/pr117060.f90: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr117060.f90 | 21 | ||||
-rw-r--r-- | gcc/tree-vect-slp.cc | 5 |
2 files changed, 24 insertions, 2 deletions
diff --git a/gcc/testsuite/gfortran.dg/pr117060.f90 b/gcc/testsuite/gfortran.dg/pr117060.f90 new file mode 100644 index 0000000..50004e1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr117060.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! { dg-options "-O2" } + +subroutine foo (out) + +implicit none + +real :: out(*) +integer :: i,k +real :: a(100) +real :: b(100) + +k = 0 +do i = 1, 10 + k = k + 1 + out(k) = a(i) + k = k + 1 + out(k) = sqrt((a(3*i)-b(4))**2 + (a(3*i+1)-b(4+1))**2) +end do + +end subroutine diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 8b53b0f..9bf6ae4 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -1367,8 +1367,9 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, && first_stmt_code != CFN_MASK_LOAD && first_stmt_code != CFN_MASK_STORE) { - if (!compatible_calls_p (as_a <gcall *> (stmts[0]->stmt), - call_stmt)) + if (!is_a <gcall *> (stmts[0]->stmt) + || !compatible_calls_p (as_a <gcall *> (stmts[0]->stmt), + call_stmt)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, |