Skip to content

Commit 39ae5bf

Browse files
committed
[CSSPGO] Fix an AV caused by a block that has only pseudo pseudo instructions.
Reviewed By: wenlei Differential Revision: https://reviews.llvm.org/D101415
1 parent 465204d commit 39ae5bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/CodeGen/RegAllocGreedy.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,10 +1324,10 @@ bool RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
13241324

13251325
// Abort if the spill cannot be inserted at the MBB' start
13261326
MachineBasicBlock *MBB = MF->getBlockNumbered(Number);
1327-
if (!MBB->empty() &&
1328-
SlotIndex::isEarlierInstr(
1329-
LIS->getInstructionIndex(*MBB->getFirstNonDebugInstr()),
1330-
SA->getFirstSplitPoint(Number)))
1327+
auto FirstNonDebugInstr = MBB->getFirstNonDebugInstr();
1328+
if (FirstNonDebugInstr != MBB->end() &&
1329+
SlotIndex::isEarlierInstr(LIS->getInstructionIndex(*FirstNonDebugInstr),
1330+
SA->getFirstSplitPoint(Number)))
13311331
return false;
13321332
// Interference for the live-in value.
13331333
if (Intf.first() <= Indexes->getMBBStartIdx(Number))

0 commit comments

Comments
 (0)