Commit 7f62e122 authored by jarin's avatar jarin Committed by Commit bot

Revert of [turbofan] optimize spills in defered blocks (patchset #3 id:240001...

Revert of [turbofan] optimize spills in defered blocks (patchset #3 id:240001 of https://codereview.chromium.org/1551013002/ )

Reason for revert:
Regresses lots of benchmarks: https://crbug.com/579900

Original issue's description:
> [turbofan] optimize spills in defered blocks
>
> Up to now, for ranges spilled in deferred blocks, we would spill every
> time a range would switch from using a register to spill slots. That can
> be redundant, leading to avoidable code size  cost.
>
> This change addresses this issue, by performing the spills as early as
> possible.
>
> BUG=
>
> Committed: https://crrev.com/7c54dc33855b8ac31f26b309671f9b5481a74376
> Cr-Commit-Position: refs/heads/master@{#33413}

TBR=bmeurer@chromium.org,mtrofin@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/1612013002

Cr-Commit-Position: refs/heads/master@{#33431}
parent b3517e2b
...@@ -119,7 +119,6 @@ void LiveRangeSeparator::Splinter() { ...@@ -119,7 +119,6 @@ void LiveRangeSeparator::Splinter() {
void LiveRangeMerger::MarkRangesSpilledInDeferredBlocks() { void LiveRangeMerger::MarkRangesSpilledInDeferredBlocks() {
const InstructionSequence *code = data()->code();
for (TopLevelLiveRange *top : data()->live_ranges()) { for (TopLevelLiveRange *top : data()->live_ranges()) {
if (top == nullptr || top->IsEmpty() || top->splinter() == nullptr || if (top == nullptr || top->IsEmpty() || top->splinter() == nullptr ||
top->HasSpillOperand() || !top->splinter()->HasSpillRange()) { top->HasSpillOperand() || !top->splinter()->HasSpillRange()) {
...@@ -133,10 +132,7 @@ void LiveRangeMerger::MarkRangesSpilledInDeferredBlocks() { ...@@ -133,10 +132,7 @@ void LiveRangeMerger::MarkRangesSpilledInDeferredBlocks() {
break; break;
} }
} }
if (child == nullptr) { if (child == nullptr) top->MarkSpilledInDeferredBlock();
top->TreatAsSpilledInDeferredBlock(data()->allocation_zone(),
code->InstructionBlockCount());
}
} }
} }
......
This diff is collapsed.
...@@ -579,17 +579,14 @@ class TopLevelLiveRange final : public LiveRange { ...@@ -579,17 +579,14 @@ class TopLevelLiveRange final : public LiveRange {
// and instead let the LiveRangeConnector perform the spills within the // and instead let the LiveRangeConnector perform the spills within the
// deferred blocks. If so, we insert here spills for non-spilled ranges // deferred blocks. If so, we insert here spills for non-spilled ranges
// with slot use positions. // with slot use positions.
void TreatAsSpilledInDeferredBlock(Zone* zone, int total_block_count) { void MarkSpilledInDeferredBlock() {
spill_start_index_ = -1; spill_start_index_ = -1;
spilled_in_deferred_blocks_ = true; spilled_in_deferred_blocks_ = true;
spill_move_insertion_locations_ = nullptr; spill_move_insertion_locations_ = nullptr;
list_of_blocks_requiring_spill_operands_ =
new (zone) BitVector(total_block_count, zone);
} }
void CommitSpillInDeferredBlocks(RegisterAllocationData* data, bool TryCommitSpillInDeferredBlock(InstructionSequence* code,
const InstructionOperand& spill_operand, const InstructionOperand& spill_operand);
BitVector* necessary_spill_points);
TopLevelLiveRange* splintered_from() const { return splintered_from_; } TopLevelLiveRange* splintered_from() const { return splintered_from_; }
bool IsSplinter() const { return splintered_from_ != nullptr; } bool IsSplinter() const { return splintered_from_ != nullptr; }
...@@ -620,8 +617,7 @@ class TopLevelLiveRange final : public LiveRange { ...@@ -620,8 +617,7 @@ class TopLevelLiveRange final : public LiveRange {
struct SpillMoveInsertionList; struct SpillMoveInsertionList;
SpillMoveInsertionList* GetSpillMoveInsertionLocations() const { SpillMoveInsertionList* spill_move_insertion_locations() const {
DCHECK(!IsSpilledOnlyInDeferredBlocks());
return spill_move_insertion_locations_; return spill_move_insertion_locations_;
} }
TopLevelLiveRange* splinter() const { return splinter_; } TopLevelLiveRange* splinter() const { return splinter_; }
...@@ -638,16 +634,6 @@ class TopLevelLiveRange final : public LiveRange { ...@@ -638,16 +634,6 @@ class TopLevelLiveRange final : public LiveRange {
void MarkHasPreassignedSlot() { has_preassigned_slot_ = true; } void MarkHasPreassignedSlot() { has_preassigned_slot_ = true; }
bool has_preassigned_slot() const { return has_preassigned_slot_; } bool has_preassigned_slot() const { return has_preassigned_slot_; }
void AddBlockRequiringSpillOperand(RpoNumber block_id) {
DCHECK(IsSpilledOnlyInDeferredBlocks());
GetListOfBlocksRequiringSpillOperands()->Add(block_id.ToInt());
}
BitVector* GetListOfBlocksRequiringSpillOperands() const {
DCHECK(IsSpilledOnlyInDeferredBlocks());
return list_of_blocks_requiring_spill_operands_;
}
private: private:
void SetSplinteredFrom(TopLevelLiveRange* splinter_parent); void SetSplinteredFrom(TopLevelLiveRange* splinter_parent);
...@@ -664,12 +650,7 @@ class TopLevelLiveRange final : public LiveRange { ...@@ -664,12 +650,7 @@ class TopLevelLiveRange final : public LiveRange {
InstructionOperand* spill_operand_; InstructionOperand* spill_operand_;
SpillRange* spill_range_; SpillRange* spill_range_;
}; };
union {
SpillMoveInsertionList* spill_move_insertion_locations_; SpillMoveInsertionList* spill_move_insertion_locations_;
BitVector* list_of_blocks_requiring_spill_operands_;
};
// TODO(mtrofin): generalize spilling after definition, currently specialized // TODO(mtrofin): generalize spilling after definition, currently specialized
// just for spill in a single deferred block. // just for spill in a single deferred block.
bool spilled_in_deferred_blocks_; bool spilled_in_deferred_blocks_;
...@@ -1144,7 +1125,6 @@ class ReferenceMapPopulator final : public ZoneObject { ...@@ -1144,7 +1125,6 @@ class ReferenceMapPopulator final : public ZoneObject {
}; };
class LiveRangeBoundArray;
// Insert moves of the form // Insert moves of the form
// //
// Operand(child_(k+1)) = Operand(child_k) // Operand(child_(k+1)) = Operand(child_k)
...@@ -1177,10 +1157,6 @@ class LiveRangeConnector final : public ZoneObject { ...@@ -1177,10 +1157,6 @@ class LiveRangeConnector final : public ZoneObject {
const InstructionBlock* pred, const InstructionBlock* pred,
const InstructionOperand& pred_op); const InstructionOperand& pred_op);
void CommitSpillsInDeferredBlocks(TopLevelLiveRange* range,
LiveRangeBoundArray* array,
Zone* temp_zone);
RegisterAllocationData* const data_; RegisterAllocationData* const data_;
DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment