Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 5340452

Browse files
author
Quentin Colombet
committed
[LiveRangeEdit] Don't mess up with LiveInterval when a new vreg is created.
In r283838, we added the capability of splitting unspillable register. When doing so we had to make sure the split live-ranges were also unspillable and we did that by marking the related live-ranges in the delegate method that is called when a new vreg is created. However, by accessing the live-range there, we also triggered their lazy computation (LiveIntervalAnalysis::getInterval) which is not what we want in general. Indeed, later code in LiveRangeEdit is going to build the live-ranges this lazy computation may mess up that computation resulting in assertion failures. Namely, the createEmptyIntervalFrom method expect that the live-range is going to be empty, not computed. Thanks to Mikael Holmén <[email protected]> for noticing and reporting the problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293934 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e14e112 commit 5340452

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/CodeGen/LiveRangeEdit.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ LiveInterval &LiveRangeEdit::createEmptyIntervalFrom(unsigned OldReg) {
3737
VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
3838
}
3939
LiveInterval &LI = LIS.createEmptyInterval(VReg);
40+
if (Parent && !Parent->isSpillable())
41+
LI.markNotSpillable();
4042
// Create empty subranges if the OldReg's interval has them. Do not create
4143
// the main range here---it will be constructed later after the subranges
4244
// have been finalized.
@@ -52,6 +54,14 @@ unsigned LiveRangeEdit::createFrom(unsigned OldReg) {
5254
if (VRM) {
5355
VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
5456
}
57+
// FIXME: Getting the interval here actually computes it.
58+
// In theory, this may not be what we want, but in practice
59+
// the createEmptyIntervalFrom API is used when this is not
60+
// the case. Generally speaking we just want to annotate the
61+
// LiveInterval when it gets created but we cannot do that at
62+
// the moment.
63+
if (Parent && !Parent->isSpillable())
64+
LIS.getInterval(VReg).markNotSpillable();
5565
return VReg;
5666
}
5767

@@ -442,9 +452,6 @@ LiveRangeEdit::MRI_NoteNewVirtualRegister(unsigned VReg)
442452
if (VRM)
443453
VRM->grow();
444454

445-
if (Parent && !Parent->isSpillable())
446-
LIS.getInterval(VReg).markNotSpillable();
447-
448455
NewRegs.push_back(VReg);
449456
}
450457

0 commit comments

Comments
 (0)