From 3257d6e954c9650940162f08613fee25602ec5d4 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 25 Jul 2024 12:46:30 +0200 Subject: tree-optimization/116081 - typedef vs. non-typedef in vectorization 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-vect-loop.cc') diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index d7d628e..856ce49 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -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) { -- cgit v1.1