From f858466018346e3b59acb9e3ac7dfd5ba4c0d0a9 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Mon, 23 Mar 2009 18:24:37 +0000 Subject: Fix PR3391 and PR3864. Reg allocator infinite looping. llvm-svn: 67544 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/RegAllocLinearScan.cpp') diff --git a/llvm/lib/CodeGen/RegAllocLinearScan.cpp b/llvm/lib/CodeGen/RegAllocLinearScan.cpp index e8296a74775..912135a57f6 100644 --- a/llvm/lib/CodeGen/RegAllocLinearScan.cpp +++ b/llvm/lib/CodeGen/RegAllocLinearScan.cpp @@ -869,8 +869,12 @@ void RALinScan::assignRegOrStackSlotAtInterval(LiveInterval* cur) if (cur->weight == HUGE_VALF || li_->getApproximateInstructionCount(*cur) == 0) { // Spill a physical register around defs and uses. - li_->spillPhysRegAroundRegDefsUses(*cur, minReg, *vrm_); - assignRegOrStackSlotAtInterval(cur); + if (li_->spillPhysRegAroundRegDefsUses(*cur, minReg, *vrm_)) + assignRegOrStackSlotAtInterval(cur); + else { + cerr << "Ran out of registers during register allocation!\n"; + exit(1); + } return; } } -- cgit v1.2.3