From 6da915ac865084e35452b3b6cb71cd0d721e4c33 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sun, 15 Nov 2009 04:39:51 +0000 Subject: [PATCH] Added an assert to the PBQP allocator to catch infinite cost solutions which might otherwise lead to miscompilations. llvm-svn: 88829 --- llvm/lib/CodeGen/RegAllocPBQP.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llvm/lib/CodeGen/RegAllocPBQP.cpp b/llvm/lib/CodeGen/RegAllocPBQP.cpp index 5757e4755469..c677d341bef9 100644 --- a/llvm/lib/CodeGen/RegAllocPBQP.cpp +++ b/llvm/lib/CodeGen/RegAllocPBQP.cpp @@ -693,6 +693,11 @@ void PBQPRegAlloc::addStackInterval(const LiveInterval *spilled, } bool PBQPRegAlloc::mapPBQPToRegAlloc(const PBQP::Solution &solution) { + + // Assert that this is a valid solution to the regalloc problem. + assert(solution.getCost() != std::numeric_limits::infinity() && + "Invalid (infinite cost) solution for PBQP problem."); + // Set to true if we have any spills bool anotherRoundNeeded = false;