https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107920
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Something like this should fix the issue (note setting the location should be
done also):
diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc
b/gcc/config/aarch64/aarch64-sve-builtins-base.cc
index 6347407555f..d0a0a3a0a46 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc
@@ -1232,6 +1232,15 @@ public:
tree mem_ref_op = fold_build2 (MEM_REF, access_type, arg1, zero);
gimple *mem_ref_stmt
= gimple_build_assign (mem_ref_lhs, mem_ref_op);
+
+ // Set the location of load
+ gimple_set_location (mem_ref_stmt, gimple_location (f.call));
+
+ // Set the vuse for the load from the call
+ tree reaching_vuse = gimple_vuse (f.call);
+ gcc_assert (reaching_vuse && TREE_CODE (reaching_vuse) == SSA_NAME);
+ gimple_set_vuse (mem_ref_stmt, reaching_vuse);
+
gsi_insert_before (f.gsi, mem_ref_stmt, GSI_SAME_STMT);
int source_nelts = TYPE_VECTOR_SUBPARTS (access_type).to_constant ();