summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 15:45:55 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 15:45:55 +0000
commit785b6cec114dc4e6ae1b6ffedeb52eaeee4a62c2 (patch)
treeb74231799a05e6cc62a5b8f606f9ae1773f4f158 /llvm/lib/CodeGen/MachinePipeliner.cpp
parent615e753e09ff4d93ef067fb221433f5cb50b3c46 (diff)
downloadbcm5719-llvm-785b6cec114dc4e6ae1b6ffedeb52eaeee4a62c2.tar.gz
bcm5719-llvm-785b6cec114dc4e6ae1b6ffedeb52eaeee4a62c2.zip
[Pipeliner] Correctly update memoperands in the epilog
The pipeliner needs to be conservative when updating the memoperands of instructions in the epilog. Previously, the pipeliner was changing the offset of the memoperand based upon the scheduling stage. However, that is incorrect when control flow branches around the kernel code. The bug enabled a load and store to the same stack offset to be swapped. This patch fixes the bug by updating the size of the memoperands to be UINT_MAX. This conservative value means that dependences will be created between other loads and stores. Patch by Brendon Cahoon. llvm-svn: 328508
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachinePipeliner.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 86d2c2e3552..17c256439c7 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -2489,7 +2489,9 @@ void SwingSchedulerDAG::generateEpilog(SMSchedule &Schedule, unsigned LastStage,
continue;
MachineInstr *In = &BBI;
if (Schedule.isScheduledAtStage(getSUnit(In), StageNum)) {
- MachineInstr *NewMI = cloneInstr(In, EpilogStage - LastStage, 0);
+ // Instructions with memoperands in the epilog are updated with
+ // conservative values.
+ MachineInstr *NewMI = cloneInstr(In, UINT_MAX, 0);
updateInstruction(NewMI, i == 1, EpilogStage, 0, Schedule, VRMap);
NewBB->push_back(NewMI);
InstrMap[NewMI] = In;
@@ -3157,7 +3159,7 @@ void SwingSchedulerDAG::updateMemOperands(MachineInstr &NewMI,
continue;
}
unsigned Delta;
- if (computeDelta(OldMI, Delta)) {
+ if (Num != UINT_MAX && computeDelta(OldMI, Delta)) {
int64_t AdjOffset = Delta * Num;
NewMemRefs[Refs++] =
MF.getMachineMemOperand(MMO, AdjOffset, MMO->getSize());
OpenPOWER on IntegriCloud