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

Unified Diff: src/IceRegAlloc.cpp

Issue 1450233002: Subzero: Fix a performance regression in the register allocator. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 1 month 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 57b0a3a27c67945b88384f5ee284e1cc771cc388..cbe59b7d0518f906543d2ef11d126496d2da1069 100644
--- a/src/IceRegAlloc.cpp
+++ b/src/IceRegAlloc.cpp
@@ -98,6 +98,9 @@ void LinearScan::initForGlobal() {
UnhandledPrecolored.reserve(Vars.size());
// Gather the live ranges of all variables and add them to the Unhandled set.
for (Variable *Var : Vars) {
+ // Don't consider rematerializable variables.
+ if (Var->isRematerializable())
+ continue;
// Explicitly don't consider zero-weight variables, which are meant to be
// spill slots.
if (Var->mustNotHaveReg())
@@ -201,6 +204,8 @@ void LinearScan::initForInfOnly() {
if (Inst.isDeleted())
continue;
FOREACH_VAR_IN_INST(Var, Inst) {
+ if (Var->isRematerializable())
+ continue;
if (Var->getIgnoreLiveness())
continue;
if (Var->hasReg() || Var->mustHaveReg()) {
@@ -211,7 +216,7 @@ void LinearScan::initForInfOnly() {
}
}
if (const Variable *Var = Inst.getDest()) {
- if (!Var->getIgnoreLiveness() &&
+ if (!Var->isRematerializable() && !Var->getIgnoreLiveness() &&
(Var->hasReg() || Var->mustHaveReg())) {
if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
LRBegin[Var->getIndex()] = Inst.getNumber();
@@ -226,6 +231,8 @@ void LinearScan::initForInfOnly() {
UnhandledPrecolored.reserve(NumVars);
for (SizeT i = 0; i < Vars.size(); ++i) {
Variable *Var = Vars[i];
+ if (Var->isRematerializable())
+ continue;
if (LRBegin[i] != Inst::NumberSentinel) {
if (LREnd[i] == Inst::NumberSentinel) {
DefsWithoutUses.push_back(i);
@@ -284,6 +291,8 @@ void LinearScan::initForSecondChance() {
Unhandled.reserve(Vars.size());
UnhandledPrecolored.reserve(Vars.size());
for (Variable *Var : Vars) {
+ if (Var->isRematerializable())
+ continue;
if (Var->hasReg()) {
Var->untrimLiveRange();
Var->setRegNumTmp(Var->getRegNum());
@@ -567,6 +576,8 @@ void LinearScan::filterFreeWithInactiveRanges(IterationState &Iter) {
// early exit check that turns a guaranteed O(N^2) algorithm into expected
// linear complexity.
void LinearScan::filterFreeWithPrecoloredRanges(IterationState &Iter) {
+ // TODO(stichnot): Partition UnhandledPrecolored according to register class,
+ // to restrict the number of overlap comparisons needed.
for (Variable *Item : reverse_range(UnhandledPrecolored)) {
assert(Item->hasReg());
if (Iter.Cur->rangeEndsBefore(Item))
« 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