[llvm] r328509 - [Pipeliner] Pipeliner should mark physical registers as used
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 26 08:53:23 PDT 2018
Author: kparzysz
Date: Mon Mar 26 08:53:23 2018
New Revision: 328509
URL: http://llvm.org/viewvc/llvm-project?rev=328509&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/CodeGen/MachinePipeliner.cpp
Modified: llvm/trunk/lib/CodeGen/MachinePipeliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachinePipeliner.cpp?rev=328509&r1=328508&r2=328509&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachinePipeliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachinePipeliner.cpp Mon Mar 26 08:53:23 2018
@@ -2934,6 +2934,13 @@ void SwingSchedulerDAG::removeDeadInstru
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 *
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;
}
More information about the llvm-commits
mailing list