diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-03-26 16:17:06 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-03-26 16:17:06 +0000 |
commit | 42f8f944d97b9345c7b75006ba37ee0168047792 (patch) | |
tree | fd701d3836377e9937ca03dfba2632d2eb0d51c5 /lib/CodeGen/MachinePipeliner.cpp | |
parent | 1e6d98ea5e19f4bf43896edd3002902b8e82aabe (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r-- | lib/CodeGen/MachinePipeliner.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/MachinePipeliner.cpp b/lib/CodeGen/MachinePipeliner.cpp index e968f3a6e2c..78a34f01bab 100644 --- a/lib/CodeGen/MachinePipeliner.cpp +++ b/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. |