summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit6da915ac865084e35452b3b6cb71cd0d721e4c33 (patch)
tree17923bdade06f30712f4b3a7463898a9e240571c /llvm/lib/CodeGen/RegAllocPBQP.cpp
parent4c808dfc583efb124ee7a309b48713f862ed45ce (diff)
downloadbcm5719-llvm-6da915ac865084e35452b3b6cb71cd0d721e4c33.tar.gz
bcm5719-llvm-6da915ac865084e35452b3b6cb71cd0d721e4c33.zip
Added an assert to the PBQP allocator to catch infinite cost solutions which might otherwise lead to miscompilations.
llvm-svn: 88829
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocPBQP.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocPBQP.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegAllocPBQP.cpp b/llvm/lib/CodeGen/RegAllocPBQP.cpp
index 5757e475546..c677d341bef 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<PBQP::PBQPNum>::infinity() &&
+ "Invalid (infinite cost) solution for PBQP problem.");
+
// Set to true if we have any spills
bool anotherRoundNeeded = false;
OpenPOWER on IntegriCloud