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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |53947

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> r15-5024 causes a similar phi order difference. For somereason processing in
> the  PHIs in a different order causes difference in the vectorization.

It was not the PHI order that matters here (I tried making the order of the
phis random and that didn't change anything) but rather the ssa name order (see
PR 114010 too).

Doing this :
```
[apinski@xeond2 gcc]$ git diff tree-ssanames.cc
diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
index d138c1fe521..6b556f98b56 100644
--- a/gcc/tree-ssanames.cc
+++ b/gcc/tree-ssanames.cc
@@ -353,6 +353,7 @@ make_ssa_name_fn (struct function *fn, tree var, gimple
*stmt,
                  unsigned int version)
 {
   tree t;
+  unsigned tt = rand();
   gcc_assert (VAR_P (var)
              || TREE_CODE (var) == PARM_DECL
              || TREE_CODE (var) == RESULT_DECL
@@ -370,7 +371,7 @@ make_ssa_name_fn (struct function *fn, tree var, gimple
*stmt,
       ssa_name_nodes_created++;
     }
   /* If our free list has an element, then use it.  */
-  else if (!vec_safe_is_empty (FREE_SSANAMES (fn)))
+  else if ((tt&1) && !vec_safe_is_empty (FREE_SSANAMES (fn)))
     {
       t = FREE_SSANAMES (fn)->pop ();
       ssa_name_nodes_reused++;

```

Causes the difference in the vectorizer even before r15-5024 .


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

Reply via email to