Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(631)

Unified Diff: src/IceRegAlloc.cpp

Issue 1373823006: Subzero. Fixes a bug in the register allocator range eviction. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: merge Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceRegAlloc.cpp
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp
index 50e014aa5f2018f522a910f519c16d20b46f1294..480b9077c6956209817c11f578431f090b71fa05 100644
--- a/src/IceRegAlloc.cpp
+++ b/src/IceRegAlloc.cpp
@@ -652,17 +652,15 @@ void LinearScan::handleNoFreeRegisters(IterationState &Iter) {
} else {
// Evict all live ranges in Active that register number MinWeightIndex is
// assigned to.
+ const llvm::SmallBitVector &Aliases = *RegAliases[MinWeightIndex];
for (SizeT I = Active.size(); I > 0; --I) {
const SizeT Index = I - 1;
Variable *Item = Active[Index];
- if (Item->getRegNumTmp() == MinWeightIndex) {
- dumpLiveRangeTrace("Evicting ", Item);
- const llvm::SmallBitVector &Aliases = *RegAliases[MinWeightIndex];
- for (int32_t RegAlias = Aliases.find_first(); RegAlias >= 0;
- RegAlias = Aliases.find_next(RegAlias)) {
- --RegUses[RegAlias];
- assert(RegUses[RegAlias] >= 0);
- }
+ int32_t RegNum = Item->getRegNumTmp();
+ if (Aliases[RegNum]) {
+ dumpLiveRangeTrace("Evicting A ", Item);
+ --RegUses[RegNum];
+ assert(RegUses[RegNum] >= 0);
Item->setRegNumTmp(Variable::NoRegister);
moveItem(Active, Index, Handled);
}
@@ -678,16 +676,14 @@ void LinearScan::handleNoFreeRegisters(IterationState &Iter) {
// especially bad if we would end up evicting an infinite-weight but
// currently-inactive live range. The most common situation for this
// would be a scratch register kill set for call instructions.
- if (Item->getRegNumTmp() == MinWeightIndex &&
- Item->rangeOverlaps(Iter.Cur)) {
- dumpLiveRangeTrace("Evicting ", Item);
+ if (Aliases[Item->getRegNumTmp()] && Item->rangeOverlaps(Iter.Cur)) {
+ dumpLiveRangeTrace("Evicting I ", Item);
Item->setRegNumTmp(Variable::NoRegister);
moveItem(Inactive, Index, Handled);
}
}
// Assign the register to Cur.
Iter.Cur->setRegNumTmp(MinWeightIndex);
- const llvm::SmallBitVector &Aliases = *RegAliases[MinWeightIndex];
for (int32_t RegAlias = Aliases.find_first(); RegAlias >= 0;
RegAlias = Aliases.find_next(RegAlias)) {
assert(RegUses[RegAlias] >= 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698