[PATCH] D138517: [CodeGen] Use cloneVirtualRegister in LiveIntervals and LiveRangeEdit
Christudasan Devadasan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 22 11:26:06 PST 2022
cdevadas created this revision.
cdevadas added reviewers: arsenm, qcolombet.
Herald added subscribers: hiraditya, MatzeB.
Herald added a project: All.
cdevadas requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
It is needed to invoke the delegate methods effectively whenever a
virtual register is cloned from an existing register of the same class.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D138517
Files:
llvm/lib/CodeGen/LiveIntervals.cpp
llvm/lib/CodeGen/LiveRangeEdit.cpp
Index: llvm/lib/CodeGen/LiveRangeEdit.cpp
===================================================================
--- llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -33,7 +33,7 @@
LiveInterval &LiveRangeEdit::createEmptyIntervalFrom(Register OldReg,
bool createSubRanges) {
- Register VReg = MRI.createVirtualRegister(MRI.getRegClass(OldReg));
+ Register VReg = MRI.cloneVirtualRegister(OldReg);
if (VRM)
VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
@@ -53,7 +53,7 @@
}
Register LiveRangeEdit::createFrom(Register OldReg) {
- Register VReg = MRI.createVirtualRegister(MRI.getRegClass(OldReg));
+ Register VReg = MRI.cloneVirtualRegister(OldReg);
if (VRM) {
VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
}
Index: llvm/lib/CodeGen/LiveIntervals.cpp
===================================================================
--- llvm/lib/CodeGen/LiveIntervals.cpp
+++ llvm/lib/CodeGen/LiveIntervals.cpp
@@ -1743,9 +1743,8 @@
return;
LLVM_DEBUG(dbgs() << " Split " << NumComp << " components: " << LI << '\n');
Register Reg = LI.reg();
- const TargetRegisterClass *RegClass = MRI->getRegClass(Reg);
for (unsigned I = 1; I < NumComp; ++I) {
- Register NewVReg = MRI->createVirtualRegister(RegClass);
+ Register NewVReg = MRI->cloneVirtualRegister(Reg);
LiveInterval &NewLI = createEmptyInterval(NewVReg);
SplitLIs.push_back(&NewLI);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138517.477261.patch
Type: text/x-patch
Size: 1491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221122/95b52dc7/attachment.bin>
More information about the llvm-commits
mailing list