]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/123117 - fix sign conversion check
authorRichard Biener <rguenther@suse.de>
Tue, 24 Feb 2026 08:50:17 +0000 (09:50 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 24 Feb 2026 13:52:25 +0000 (14:52 +0100)
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.

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

index 931c0798a813c9060334fcef30848e8792c06c53..b5544414ca6eb463d9a23735fa77364ecdfbc1dd 100644 (file)
@@ -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])))),