[llvm] f3d8a93 - [ModuloSchedule] Support instructions with > 1 destination when walking canonical use.
Hendrik Greving via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 11:44:12 PDT 2020
Author: Hendrik Greving
Date: 2020-06-08T11:43:59-07:00
New Revision: f3d8a9397003b6645f19a4dd11cc1165ce75bd7d
URL: https://github.com/llvm/llvm-project/commit/f3d8a9397003b6645f19a4dd11cc1165ce75bd7d
DIFF: https://github.com/llvm/llvm-project/commit/f3d8a9397003b6645f19a4dd11cc1165ce75bd7d.diff
LOG: [ModuloSchedule] Support instructions with > 1 destination when walking canonical use.
Fixes a minor bug that led to finding the wrong register if the definition had more
than one register destination.
Added:
Modified:
llvm/lib/CodeGen/ModuloSchedule.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp
index a4b994b15806..a8088dc77cf4 100644
--- a/llvm/lib/CodeGen/ModuloSchedule.cpp
+++ b/llvm/lib/CodeGen/ModuloSchedule.cpp
@@ -1710,16 +1710,17 @@ PeelingModuloScheduleExpander::getPhiCanonicalReg(MachineInstr *CanonicalPhi,
MachineInstr *Phi) {
unsigned distance = PhiNodeLoopIteration[Phi];
MachineInstr *CanonicalUse = CanonicalPhi;
+ Register CanonicalUseReg = CanonicalUse->getOperand(0).getReg();
for (unsigned I = 0; I < distance; ++I) {
assert(CanonicalUse->isPHI());
assert(CanonicalUse->getNumOperands() == 5);
unsigned LoopRegIdx = 3, InitRegIdx = 1;
if (CanonicalUse->getOperand(2).getMBB() == CanonicalUse->getParent())
std::swap(LoopRegIdx, InitRegIdx);
- CanonicalUse =
- MRI.getVRegDef(CanonicalUse->getOperand(LoopRegIdx).getReg());
+ CanonicalUseReg = CanonicalUse->getOperand(LoopRegIdx).getReg();
+ CanonicalUse = MRI.getVRegDef(CanonicalUseReg);
}
- return CanonicalUse->getOperand(0).getReg();
+ return CanonicalUseReg;
}
void PeelingModuloScheduleExpander::peelPrologAndEpilogs() {
More information about the llvm-commits
mailing list