aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2022-06-20 10:08:21 +0100
committerDavid Green <david.green@arm.com>2022-06-20 10:08:21 +0100
commit76f60931e2acedfe69aef614b07f902fbc814838 (patch)
tree3f34f42fd7ce966ba7d1b864c11e7f7b0a71cff3 /llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
parent8c3fa31701c4b874138c52266e7ab96818092f47 (diff)
downloadllvm-76f60931e2acedfe69aef614b07f902fbc814838.zip
llvm-76f60931e2acedfe69aef614b07f902fbc814838.tar.gz
llvm-76f60931e2acedfe69aef614b07f902fbc814838.tar.bz2
[ARM] Allow distributing postinc with PHI uses
Although this doesn't usually come up, we can have uses of the BaseAccess of a distributed postinc being a PHI. This doesn't need the usual dominance check as we will dominate along the phi edge, allowing us to still create a postinc load/store. Differential Revision: https://reviews.llvm.org/D127676
Diffstat (limited to 'llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
index fb9d686..0a38f56 100644
--- a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
+++ b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
@@ -2896,10 +2896,12 @@ bool ARMPreAllocLoadStoreOpt::DistributeIncrements(Register Base) {
LLVM_DEBUG(dbgs() << "\nAttempting to distribute increments on VirtualReg "
<< Base.virtRegIndex() << "\n");
- // Make sure that Increment has no uses before BaseAccess.
+ // Make sure that Increment has no uses before BaseAccess that are not PHI
+ // uses.
for (MachineInstr &Use :
MRI->use_nodbg_instructions(Increment->getOperand(0).getReg())) {
- if (!DT->dominates(BaseAccess, &Use) || &Use == BaseAccess) {
+ if (&Use == BaseAccess || (Use.getOpcode() != TargetOpcode::PHI &&
+ !DT->dominates(BaseAccess, &Use))) {
LLVM_DEBUG(dbgs() << " BaseAccess doesn't dominate use of increment\n");
return false;
}