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

Side by Side Diff: src/IceRegAlloc.cpp

Issue 417933004: Subzero: Fix a regalloc eviction bug. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Add Jan's test Created 6 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/regalloc_evict_non_overlap.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceRegAlloc.cpp - Linear-scan implementation -----------===// 1 //===- subzero/src/IceRegAlloc.cpp - Linear-scan implementation -----------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file implements the LinearScan class, which performs the 10 // This file implements the LinearScan class, which performs the
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 Active.erase(I); 338 Active.erase(I);
339 Handled.push_back(Item); 339 Handled.push_back(Item);
340 } 340 }
341 } 341 }
342 // Do the same for Inactive. 342 // Do the same for Inactive.
343 for (UnorderedRanges::iterator I = Inactive.begin(), E = Inactive.end(); 343 for (UnorderedRanges::iterator I = Inactive.begin(), E = Inactive.end();
344 I != E; I = Next) { 344 I != E; I = Next) {
345 Next = I; 345 Next = I;
346 ++Next; 346 ++Next;
347 LiveRangeWrapper Item = *I; 347 LiveRangeWrapper Item = *I;
348 if (Item.Var->getRegNumTmp() == MinWeightIndex) { 348 // Note: The Item.overlaps(Cur) clause is not part of the
349 // description of AssignMemLoc() in the original paper. But
350 // there doesn't seem to be any need to evict an inactive
351 // live range that doesn't overlap with the live range
352 // currently being considered. It's especially bad if we
353 // would end up evicting an infinite-weight but
354 // currently-inactive live range. The most common situation
355 // for this would be a scratch register kill set for call
356 // instructions.
357 if (Item.Var->getRegNumTmp() == MinWeightIndex &&
358 Item.overlaps(Cur)) {
349 if (Func->getContext()->isVerbose(IceV_LinearScan)) { 359 if (Func->getContext()->isVerbose(IceV_LinearScan)) {
350 Str << "Evicting "; 360 Str << "Evicting ";
351 Item.dump(Func); 361 Item.dump(Func);
352 Str << "\n"; 362 Str << "\n";
353 } 363 }
354 Item.Var->setRegNumTmp(Variable::NoRegister); 364 Item.Var->setRegNumTmp(Variable::NoRegister);
355 Inactive.erase(I); 365 Inactive.erase(I);
356 Handled.push_back(Item); 366 Handled.push_back(Item);
357 } 367 }
358 } 368 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 } 468 }
459 Str << "++++++ Inactive:\n"; 469 Str << "++++++ Inactive:\n";
460 for (UnorderedRanges::const_iterator I = Inactive.begin(), E = Inactive.end(); 470 for (UnorderedRanges::const_iterator I = Inactive.begin(), E = Inactive.end();
461 I != E; ++I) { 471 I != E; ++I) {
462 I->dump(Func); 472 I->dump(Func);
463 Str << "\n"; 473 Str << "\n";
464 } 474 }
465 } 475 }
466 476
467 } // end of namespace Ice 477 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/regalloc_evict_non_overlap.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698