summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/RegAllocPBQP.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2009-11-15 04:39:51 +0000
committerLang Hames <lhames@gmail.com>2009-11-15 04:39:51 +0000
commite98b4b0695f727dda44c366f5de906edf06cf7e9 (patch)
tree3deb18c2018a4d452948385cf40a45f89041145a /lib/CodeGen/RegAllocPBQP.cpp
parent40c67b5832877935a555fc63bfaa735332c79700 (diff)
downloadexternal_llvm-e98b4b0695f727dda44c366f5de906edf06cf7e9.zip
external_llvm-e98b4b0695f727dda44c366f5de906edf06cf7e9.tar.gz
external_llvm-e98b4b0695f727dda44c366f5de906edf06cf7e9.tar.bz2
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
Diffstat (limited to 'lib/CodeGen/RegAllocPBQP.cpp')
-rw-r--r--lib/CodeGen/RegAllocPBQP.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocPBQP.cpp b/lib/CodeGen/RegAllocPBQP.cpp
index 5757e47..c677d34 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<PBQP::PBQPNum>::infinity() &&
+ "Invalid (infinite cost) solution for PBQP problem.");
+
// Set to true if we have any spills
bool anotherRoundNeeded = false;