forwprop: Use lhs type instead of arg0 in folding VEC_PERM_EXPR.

gcc/ChangeLog:

	* tree-ssa-forwprop.cc (simplify_permutation): Use lhs type
	instead of TREE_TYPE (arg0) as result type in folding VEC_PERM_EXPR.
This commit is contained in:
Prathamesh Kulkarni 2022-07-19 17:43:26 +05:30
parent f082bc79c1
commit 4c32313025

View File

@ -2661,7 +2661,7 @@ simplify_permutation (gimple_stmt_iterator *gsi)
/* Shuffle of a constructor. */
bool ret = false;
tree res_type = TREE_TYPE (arg0);
tree res_type = TREE_TYPE (gimple_assign_lhs (stmt));
tree opt = fold_ternary (VEC_PERM_EXPR, res_type, arg0, arg1, op2);
if (!opt
|| (TREE_CODE (opt) != CONSTRUCTOR && TREE_CODE (opt) != VECTOR_CST))