From: Prathamesh Kulkarni Date: Tue, 6 Sep 2022 09:48:04 +0000 (+0530) Subject: tree-ssa-forwprop.cc: Adjust res_type when operands have differing vector lengths. X-Git-Tag: basepoints/gcc-14~4713 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e55674b86a10e695cea2f45c0472402b97cc2dfb;p=thirdparty%2Fgcc.git tree-ssa-forwprop.cc: Adjust res_type when operands have differing vector lengths. gcc/ * tree-ssa-forwprop.cc (simplify_permutation): Set res_type to a vector type with same element type as arg0, and length as op2. --- diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index fdc4bc8909d2..4b693ef095c5 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -2661,7 +2661,9 @@ simplify_permutation (gimple_stmt_iterator *gsi) /* Shuffle of a constructor. */ bool ret = false; - tree res_type = TREE_TYPE (arg0); + tree res_type + = build_vector_type (TREE_TYPE (TREE_TYPE (arg0)), + TYPE_VECTOR_SUBPARTS (TREE_TYPE (op2))); tree opt = fold_ternary (VEC_PERM_EXPR, res_type, arg0, arg1, op2); if (!opt || (TREE_CODE (opt) != CONSTRUCTOR && TREE_CODE (opt) != VECTOR_CST))