From e98b4b0695f727dda44c366f5de906edf06cf7e9 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88829 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAllocPBQP.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/CodeGen/RegAllocPBQP.cpp b/lib/CodeGen/RegAllocPBQP.cpp index 5757e475546..c677d341bef 100644 --- a/lib/CodeGen/RegAllocPBQP.cpp +++ b/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;