https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114674
--- Comment #1 from Di Zhao <dizhao at os dot amperecomputing.com> ---
Here's a quick fix I tried, that works on the small test case above:
diff --git a/gcc/config/aarch64/aarch64-ldp-fusion.cc
b/gcc/config/aarch64/aarch64-ldp-fusion.cc
index 365dcf48b22..43478ede72b 100644
--- a/gcc/config/aarch64/aarch64-ldp-fusion.cc
+++ b/gcc/config/aarch64/aarch64-ldp-fusion.cc
@@ -1735,6 +1735,9 @@ ldp_bb_info::fuse_pair (bool load_p,
rtx new_mem = adjust_address_nv (effective_base,
mode_for_mem,
adjust_amt);
+ // Keep original alignment info for ldp/stp policy.
+ set_mem_align (new_mem, MEM_ALIGN (change_mem));
+
rtx new_set = load_p
? gen_rtx_SET (change_reg, new_mem)
: gen_rtx_SET (new_mem, change_reg);
Is is OK?