The following fixes the sign conversion check added to properly check
whether the BIT_FIELD_REF does a sign conversion on the original
vector elements instead of a conversion to the target constructor
element type. This avoids disabling all unpacking conversions.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
PR tree-optimization/123117
PR target/120234
* tree-ssa-forwprop.cc (simplify_vector_constructor): Fix
sign conversion check guarding unpacking.
---
gcc/tree-ssa-forwprop.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index 931c0798a81..b5544414ca6 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -4080,7 +4080,7 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
== TYPE_PRECISION (TREE_TYPE (type)))
&& orig_elem_type[0]
&& useless_type_conversion_p (orig_elem_type[0],
- TREE_TYPE (type))
+ TREE_TYPE (TREE_TYPE (orig[0])))
&& mode_for_vector (as_a <scalar_mode>
(TYPE_MODE (TREE_TYPE (TREE_TYPE (orig[0])))),
nelts * 2).exists ()
@@ -4122,7 +4122,7 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
== 2 * TYPE_PRECISION (TREE_TYPE (type)))
&& orig_elem_type[0]
&& useless_type_conversion_p (orig_elem_type[0],
- TREE_TYPE (type))
+ TREE_TYPE (TREE_TYPE
(orig[0])))
&& mode_for_vector (as_a <scalar_mode>
(TYPE_MODE
(TREE_TYPE (TREE_TYPE (orig[0])))),
--
2.51.0