summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 16:17:06 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 16:17:06 +0000
commit40df8a2b98b5a753d38972777659be34fd03322e (patch)
tree8aeb9bb54f72cc2a01dccb7f9f00b2fa97ee0f06 /llvm/lib/CodeGen/MachinePipeliner.cpp
parent55cb4986a47acd7296c0a026bd53a507baeb03a7 (diff)
downloadbcm5719-llvm-40df8a2b98b5a753d38972777659be34fd03322e.tar.gz
bcm5719-llvm-40df8a2b98b5a753d38972777659be34fd03322e.zip
[Pipeliner] Enable more base+offset dependence changes in pipeliner
The pipeliner changes dependences between base+offset instructions (loads and stores) so that the instructions have more flexibility to be scheduled with respect to each other. This occurs when the pipeliner is able to compute that the instructions will not alias if their order is changed. The prevous code enforced the alias property by checking if the base register is the same, and that the offset values are either both positive or negative. This patch improves the alias check by using the API areMemAccessesTriviallyDisjoint instead. This enables more cases, especially if the offset is a negative value. The pipeliner uses the function by creating a new instruction with the offset used in the next iteration. Patch by Brendon Cahoon. llvm-svn: 328538
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachinePipeliner.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index e968f3a6e2c..78a34f01bab 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -3454,10 +3454,15 @@ bool SwingSchedulerDAG::canUseLastOffsetValue(MachineInstr *MI,
if (!TII->getBaseAndOffsetPosition(*PrevDef, BasePos1, OffsetPos1))
return false;
- // Make sure offset values are both positive or both negative.
+ // Make sure that the instructions do not access the same memory location in
+ // the next iteration.
int64_t LoadOffset = MI->getOperand(OffsetPosLd).getImm();
int64_t StoreOffset = PrevDef->getOperand(OffsetPos1).getImm();
- if ((LoadOffset >= 0) != (StoreOffset >= 0))
+ MachineInstr *NewMI = MF.CloneMachineInstr(MI);
+ NewMI->getOperand(OffsetPosLd).setImm(LoadOffset + StoreOffset);
+ bool Disjoint = TII->areMemAccessesTriviallyDisjoint(*NewMI, *PrevDef);
+ MF.DeleteMachineInstr(NewMI);
+ if (!Disjoint)
return false;
// Set the return value once we determine that we return true.
OpenPOWER on IntegriCloud