aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 15:53:23 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2018-03-26 15:53:23 +0000
commitb9b75b8cb639016dc8093204124b7ba1f942f35c (patch)
tree02cf3d3798d23da25a60c99250ff670b985268bb /llvm/lib/CodeGen/MachinePipeliner.cpp
parent785b6cec114dc4e6ae1b6ffedeb52eaeee4a62c2 (diff)
downloadllvm-b9b75b8cb639016dc8093204124b7ba1f942f35c.zip
llvm-b9b75b8cb639016dc8093204124b7ba1f942f35c.tar.gz
llvm-b9b75b8cb639016dc8093204124b7ba1f942f35c.tar.bz2
[Pipeliner] Pipeliner should mark physical registers as used
The software pipeliner attempts to delete dead instructions after generating the pipelined loop. The code looks for uses of each instruction. Physical registers should be treated differently because the use chains do not exist. The code that checks for dead instructions should assume that definitions of physical registers are used if the operand doesn't contain the dead flag. Patch by Brendon Cahoon. llvm-svn: 328509
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachinePipeliner.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 17c2564..527f1e4 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -2934,6 +2934,13 @@ void SwingSchedulerDAG::removeDeadInstructions(MachineBasicBlock *KernelBB,
if (!MOI->isReg() || !MOI->isDef())
continue;
unsigned reg = MOI->getReg();
+ // Assume physical registers are used, unless they are marked dead.
+ if (TargetRegisterInfo::isPhysicalRegister(reg)) {
+ used = !MOI->isDead();
+ if (used)
+ break;
+ continue;
+ }
unsigned realUses = 0;
for (MachineRegisterInfo::use_iterator UI = MRI.use_begin(reg),
EI = MRI.use_end();
@@ -3650,7 +3657,7 @@ static SUnit *multipleIterations(SUnit *SU, SwingSchedulerDAG *DAG) {
for (auto &P : SU->Preds)
if (DAG->isBackedge(SU, P) && P.getSUnit()->getInstr()->isPHI())
for (auto &S : P.getSUnit()->Succs)
- if (S.getKind() == SDep::Order && S.getSUnit()->getInstr()->isPHI())
+ if (S.getKind() == SDep::Data && S.getSUnit()->getInstr()->isPHI())
return P.getSUnit();
return nullptr;
}