https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114736

--- Comment #1 from prathamesh3492 at gcc dot gnu.org ---
Investigating this a bit further, the ICE appears with gfortran-13 because for
the testcase, because length of postorder traversal over SLP graph (27) doesn't
match number of nodes (28), and thus we hit the following assert in
create_partitions:

   /* Calculate a postorder of the graph, ignoring edges that correspond
     to natural latch edges in the cfg.  Reading the vector from the end
     to the beginning gives the reverse postorder.  */
  auto_vec<int> initial_rpo;
  graphds_dfs (m_slpg, &m_leafs[0], m_leafs.length (), &initial_rpo,
               false, NULL, skip_cfg_latch_edges);
  gcc_assert (initial_rpo.length () == m_vertices.length ());

Postorder traversal of graph (initial_rpo) shows:
vertices: [ 0 1 2 3 4 5 6 7 8 9 22 23 24 10 11 12 13 14 15 16 17
            18 19 20 21 25 27 ]
Vertex 26 seems to be missing, which corresponds to bb15, and thus
initial_rpo.length() is one less than m_vertices.length().

(If we don't ignore cfg latch edges during dfs walk, then it seems to "work",
but that's not right approach I guess...)

The issue doesn't reproduce with master, running git bisect showed it went away
after:
http://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=43da77a4f1636280c4259402c9c2c543e6ec6c0b

With 43da77a4, vect_slp_function splits the region at offending bb15, because
it is loop header, and it's containing loop gets marked as dont_vectorize by
ifcvt.
slp dump shows:
t5.f90:1:21: missed: splitting region at dont-vectorize loop 3 entry at bb15

So, bb15 doesn't get passed to vect_slp_bbs and eventually to
create_partitions,
avoiding the assert. So I am wondering if the issue has gone latent on trunk
rather than fixed since presence or absence of loop->dont_vectorize shouldn't
affect correctness of BB vectorizer ?

Perhaps not relevant, but this issue seems to surface only with -O3 -
mcpu=neoverse-v2. It doesn't surface with -O3, or -O3 -mcpu=generic+sve2 or
even trying out equivalent -march options corresponding to neoverse-v2:
-march=armv9-a+rng+crc+i8mm+bf16+sve2-bitperm+memtag+profile.

Thanks,
Prathamesh

Reply via email to