Skip to content

Commit bd45ce6

Browse files
preamesmahesh-attarde
authored andcommitted
[RegAlloc] Strengthen asserts in LiveRangeEdit::scanRemattable [nfc] (llvm#160765)
We should always be able to find the VNInfo in the original live interval which corresponds to the subset we're trying to spill, and the only cases where we have a VNInfo without a definition instruction are if the vni is unused, or corresponds to a phi. Adjust the code structure to explicitly check for PHIDef, and assert the stronger conditions.
1 parent 67aaf45 commit bd45ce6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/CodeGen/LiveRangeEdit.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ void LiveRangeEdit::scanRemattable() {
7575
Register Original = VRM->getOriginal(getReg());
7676
LiveInterval &OrigLI = LIS.getInterval(Original);
7777
VNInfo *OrigVNI = OrigLI.getVNInfoAt(VNI->def);
78-
if (!OrigVNI)
78+
assert(OrigVNI && "Corrupt interval mapping?");
79+
if (OrigVNI->isPHIDef())
7980
continue;
8081
MachineInstr *DefMI = LIS.getInstructionFromIndex(OrigVNI->def);
81-
if (!DefMI)
82-
continue;
82+
assert(DefMI && "Missing instruction for def slot");
8383
if (TII.isReMaterializable(*DefMI))
8484
Remattable.insert(OrigVNI);
8585
}

0 commit comments

Comments
 (0)