--- /dev/null
+// { dg-require-effective-target c++11 }
+// { dg-require-effective-target int32plus }
+
+#include <vector>
+#include <tuple>
+#include <algorithm>
+
+int main()
+{
+ const int n = 4;
+ std::vector<std::tuple<int,int,double>> vec
+ = { { 1597201307, 1817606674, 0. },
+ { 1380347796, 1721941769, 0.},
+ {837975613, 1032707773, 0.},
+ {1173654292, 2020064272, 0.} } ;
+ int sup1 = 0;
+ for(int i=0;i<n;++i)
+ sup1=std::max(sup1,std::max(std::get<0>(vec[i]),std::get<1>(vec[i])));
+ int sup2 = 0;
+ for(int i=0;i<n;++i)
+ sup2=std::max(std::max(sup2,std::get<0>(vec[i])),std::get<1>(vec[i]));
+ if (sup1 != sup2)
+ std::abort ();
+ return 0;
+}
the loop exit phi node. */
if (REDUC_GROUP_FIRST_ELEMENT (stmt_info))
{
- stmt_vec_info dest_stmt_info
- = vect_orig_stmt (SLP_TREE_SCALAR_STMTS (slp_node)[group_size - 1]);
+ /* The last statement in the reduction chain produces the live-out
+ value. Note SLP optimization can shuffle scalar stmts to
+ optimize permutations so we have to search for the last stmt. */
+ stmt_vec_info dest_stmt_info;
+ FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (slp_node), k, dest_stmt_info)
+ if (!REDUC_GROUP_NEXT_ELEMENT (dest_stmt_info))
+ break;
+ dest_stmt_info = vect_orig_stmt (dest_stmt_info);
scalar_dest = gimple_assign_lhs (dest_stmt_info->stmt);
group_size = 1;
}