summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-30 21:03:36 +0000
committerChris Lattner <sabre@nondot.org>2005-08-30 21:03:36 +0000
commit4d602bed10311f87cc0f1c4d2cd29c92f3da1e63 (patch)
tree11058ff92b68d1d6a2ccd1981ec471739a8c79f0 /llvm/lib
parent38b3704d28204b16e0749026ba70850a8cf4839c (diff)
downloadbcm5719-llvm-4d602bed10311f87cc0f1c4d2cd29c92f3da1e63.tar.gz
bcm5719-llvm-4d602bed10311f87cc0f1c4d2cd29c92f3da1e63.zip
When checking the fixed intervals, don't forget to check for register aliases.
This fixes PR621 and Regression/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll llvm-svn: 23158
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/RegAllocLinearScan.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLinearScan.cpp b/llvm/lib/CodeGen/RegAllocLinearScan.cpp
index 06682dd11e6..584316ecd76 100644
--- a/llvm/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/llvm/lib/CodeGen/RegAllocLinearScan.cpp
@@ -444,10 +444,16 @@ void RA::assignRegOrStackSlotAtInterval(LiveInterval* cur)
unsigned physReg = getFreePhysReg(cur);
if (physReg) {
// We got a register. However, if it's in the fixed_ list, we might
- // conflict with it. Check to see if we conflict with it.
+ // conflict with it. Check to see if we conflict with it or any of its
+ // aliases.
+ std::set<unsigned> RegAliases;
+ for (const unsigned *AS = mri_->getAliasSet(physReg); *AS; ++AS)
+ RegAliases.insert(*AS);
+
bool ConflictsWithFixed = false;
for (unsigned i = 0, e = fixed_.size(); i != e; ++i) {
- if (physReg == fixed_[i].first->reg) {
+ if (physReg == fixed_[i].first->reg ||
+ RegAliases.count(fixed_[i].first->reg)) {
// Okay, this reg is on the fixed list. Check to see if we actually
// conflict.
IntervalPtr &IP = fixed_[i];
@@ -457,11 +463,11 @@ void RA::assignRegOrStackSlotAtInterval(LiveInterval* cur)
IP.second = II;
if (II != I->begin() && II->start > StartPosition)
--II;
- if (cur->overlapsFrom(*I, II))
+ if (cur->overlapsFrom(*I, II)) {
ConflictsWithFixed = true;
+ break;
+ }
}
-
- break;
}
}
OpenPOWER on IntegriCloud