]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Avoid left around copies when value-numbering BBs
authorRichard Biener <rguenther@suse.de>
Wed, 4 Oct 2023 13:25:33 +0000 (15:25 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 5 Oct 2023 08:23:32 +0000 (10:23 +0200)
The following makes sure to treat values whose definition we didn't
visit as available since those by definition must dominate the entry
of the region.  That avoids unpropagated copies after if-conversion
and resulting SLP discovery fails (which doesn't handle plain copies).

* tree-ssa-sccvn.cc (rpo_elim::eliminate_avail): Not
visited value numbers are available itself.

gcc/tree-ssa-sccvn.cc

index e46498568cbe553cc815be9a5addefbec15a64ef..d2aab38c2d209d95c4aa8847a76863f12d0d3857 100644 (file)
@@ -7688,7 +7688,11 @@ rpo_elim::eliminate_avail (basic_block bb, tree op)
     {
       if (SSA_NAME_IS_DEFAULT_DEF (valnum))
        return valnum;
-      vn_avail *av = VN_INFO (valnum)->avail;
+      vn_ssa_aux_t valnum_info = VN_INFO (valnum);
+      /* See above.  */
+      if (!valnum_info->visited)
+       return valnum;
+      vn_avail *av = valnum_info->avail;
       if (!av)
        return NULL_TREE;
       if (av->location == bb->index)