diff options
author | Richard Biener <rguenther@suse.de> | 2024-04-16 11:33:48 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2024-04-16 12:37:04 +0200 |
commit | f949481a1f7ab973608a4ffcc0e342ab5a74e8e4 (patch) | |
tree | a128546f9ef66436955cea1f9f29cfd047a4c72e | |
parent | 45a41ace55d0ffb1097e374868242329788ec82a (diff) | |
download | gcc-f949481a1f7ab973608a4ffcc0e342ab5a74e8e4.zip gcc-f949481a1f7ab973608a4ffcc0e342ab5a74e8e4.tar.gz gcc-f949481a1f7ab973608a4ffcc0e342ab5a74e8e4.tar.bz2 |
tree-optimization/114736 - SLP DFS walk issue
The following fixes a DFS walk issue when identifying to be ignored
latch edges. We have (bogus) SLP_TREE_REPRESENTATIVEs for VEC_PERM
nodes so those have to be explicitly ignored as possibly being PHIs.
PR tree-optimization/114736
* tree-vect-slp.cc (vect_optimize_slp_pass::is_cfg_latch_edge):
Do not consider VEC_PERM_EXPRs as PHI use.
* gfortran.dg/vect/pr114736.f90: New testcase.
-rw-r--r-- | gcc/testsuite/gfortran.dg/vect/pr114736.f90 | 14 | ||||
-rw-r--r-- | gcc/tree-vect-slp.cc | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gcc/testsuite/gfortran.dg/vect/pr114736.f90 b/gcc/testsuite/gfortran.dg/vect/pr114736.f90 new file mode 100644 index 0000000..cdbfb6f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr114736.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! { dg-additional-options "-O3" } + +SUBROUTINE MY_ROUTINE (N, A, B ) +IMPLICIT NONE +INTEGER, INTENT(IN) :: N +COMPLEX, INTENT(IN) :: A(N) +COMPLEX, INTENT(OUT) :: B(N) +INTEGER :: II +B(:) = (1.,0.) +DO II = 1, N-1 + B(II) = A(N-II+1) / A(N-II) +ENDDO +END SUBROUTINE MY_ROUTINE diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index f57684c..30589e1 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -4309,7 +4309,8 @@ vect_optimize_slp_pass::is_cfg_latch_edge (graph_edge *ud) { slp_tree use = m_vertices[ud->src].node; slp_tree def = m_vertices[ud->dest].node; - if (SLP_TREE_DEF_TYPE (use) != vect_internal_def + if ((SLP_TREE_DEF_TYPE (use) != vect_internal_def + || SLP_TREE_CODE (use) == VEC_PERM_EXPR) || SLP_TREE_DEF_TYPE (def) != vect_internal_def) return false; |