From 53b728c27c76f3b97139ebfd8dc8d219c275b4fc Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 9 Sep 2008 20:22:01 +0000 Subject: Fix PR2757. Ignore liveinterval register allocation preference if the preference register is not in the right register class. This can happen due to sub-register coalescing. llvm-svn: 56006 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/RegAllocLinearScan.cpp') diff --git a/llvm/lib/CodeGen/RegAllocLinearScan.cpp b/llvm/lib/CodeGen/RegAllocLinearScan.cpp index 91dda771475..2cfa755d169 100644 --- a/llvm/lib/CodeGen/RegAllocLinearScan.cpp +++ b/llvm/lib/CodeGen/RegAllocLinearScan.cpp @@ -1036,7 +1036,7 @@ unsigned RALinScan::getFreePhysReg(LiveInterval *cur) { // If copy coalescer has assigned a "preferred" register, check if it's // available first. if (cur->preference) { - if (prt_->isRegAvail(cur->preference)) { + if (prt_->isRegAvail(cur->preference) && RC->contains(cur->preference)) { DOUT << "\t\tassigned the preferred register: " << tri_->getName(cur->preference) << "\n"; return cur->preference; -- cgit v1.2.3