]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/116081 - typedef vs. non-typedef in vectorization
authorRichard Biener <rguenther@suse.de>
Thu, 25 Jul 2024 10:46:30 +0000 (12:46 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 25 Jul 2024 11:44:52 +0000 (13:44 +0200)
The following fixes the code generation difference when using
a typedef for the scalar type.  The issue is using a pointer
equality test for an INTEGER_CST which fails when the types
are different variants.

PR tree-optimization/116081
* tree-vect-loop.cc (get_initial_defs_for_reduction):
Use operand_equal_p for comparing the element with the
neutral op.

gcc/tree-vect-loop.cc

index d7d628efa60f98be099a6f02af9e82aa60ae1327..856ce491c3ec40867b934110d1e3f789d9a057b9 100644 (file)
@@ -5652,7 +5652,7 @@ get_initial_defs_for_reduction (loop_vec_info loop_vinfo,
              init = gimple_build_vector_from_val (&ctor_seq, vector_type,
                                                   neutral_op);
              int k = nunits;
-             while (k > 0 && elts[k - 1] == neutral_op)
+             while (k > 0 && operand_equal_p (elts[k - 1], neutral_op))
                k -= 1;
              while (k > 0)
                {