re PR tree-optimization/68861 (FAIL: libgomp.fortran/vla8.f90 -O3 -g execution...
authorRichard Biener <rguenther@suse.de>
Wed, 16 Dec 2015 13:45:40 +0000 (13:45 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 16 Dec 2015 13:45:40 +0000 (13:45 +0000)
2015-12-16  Richard Biener  <rguenther@suse.de>

PR tree-optimization/68861
* tree-vect-slp.c (vect_build_slp_tree): Properly handle
duplicate stmts when applying swapping to stmts.

From-SVN: r231689

gcc/ChangeLog
gcc/tree-vect-slp.c

index 78dc4e3b21dd70fb45686417e07b9274a565d680..c74d25a5478e17fa7dbf120c45d4ee93796adf11 100644 (file)
@@ -1,3 +1,9 @@
+2015-12-16  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/68861
+       * tree-vect-slp.c (vect_build_slp_tree): Properly handle
+       duplicate stmts when applying swapping to stmts.
+
 2015-12-16  Kirill Yukhin  <kirill.yukhin@intel.com>
 
        * config/i386/i386-c.c (ix86_target_macros_internal): Remove
index f57c859cd4ad1cc7008acb3b31520e9fb7256d4d..6955e15775e6c8d782036443e1881fe62cfd5d09 100644 (file)
@@ -1049,11 +1049,29 @@ vect_build_slp_tree (vec_info *vinfo,
                 if we end up building the operand from scalars as
                 we'll continue to process swapped operand two.  */
              for (j = 0; j < group_size; ++j)
-               if (!matches[j])
+               {
+                 gimple *stmt = SLP_TREE_SCALAR_STMTS (*node)[j];
+                 gimple_set_plf (stmt, GF_PLF_1, false);
+               }
+             for (j = 0; j < group_size; ++j)
+               {
+                 gimple *stmt = SLP_TREE_SCALAR_STMTS (*node)[j];
+                 if (!matches[j])
+                   {
+                     /* Avoid swapping operands twice.  */
+                     if (gimple_plf (stmt, GF_PLF_1))
+                       continue;
+                     swap_ssa_operands (stmt, gimple_assign_rhs1_ptr (stmt),
+                                        gimple_assign_rhs2_ptr (stmt));
+                     gimple_set_plf (stmt, GF_PLF_1, true);
+                   }
+               }
+             /* Verify we swap all duplicates or none.  */
+             if (flag_checking)
+               for (j = 0; j < group_size; ++j)
                  {
                    gimple *stmt = SLP_TREE_SCALAR_STMTS (*node)[j];
-                   swap_ssa_operands (stmt, gimple_assign_rhs1_ptr (stmt),
-                                      gimple_assign_rhs2_ptr (stmt));
+                   gcc_assert (gimple_plf (stmt, GF_PLF_1) == ! matches[j]);
                  }
 
              /* If we have all children of child built up from scalars then