[AArch64] Fix for the pre-indexed paired load/store optimization.
authorStelios Ioannou <stelios.ioannou@arm.com>
Wed, 5 May 2021 10:02:33 +0000 (11:02 +0100)
committerStelios Ioannou <stelios.ioannou@arm.com>
Wed, 5 May 2021 14:15:07 +0000 (15:15 +0100)
commit3f4bad5eadacfc5322817eaa062dd272b52cfc54
treead6079e637538fad0b1400adfb187c98c85133ed
parente994e74bca49831eb649e7c67955e9de7a1784b6
[AArch64] Fix for the pre-indexed paired load/store optimization.

This patch fixes an issue where a pre-indexed store e.g.,
STR x1, [x0, #24]! with a store like STR x0, [x0, #8] are
merged into a single store: STP x1, x0, [x0, #24]!
. They shouldn’t be merged because the second store uses
x0 as both the stored value and the address and so it needs to be using the updated x0.
Therefore, it should not be folded into a STP <>pre.

Additionally a new test case is added to verify this fix.

Differential Revision: https://reviews.llvm.org/D101888

Change-Id: I26f1985ac84e970961e2cdca23c590fa6773851a
llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
llvm/test/CodeGen/AArch64/strpre-str-merge.mir