Commit ee657f0b authored by bgeron's avatar bgeron Committed by Commit bot

[compiler] Introduce a simple store-store elimination, disabled by default.

R=jarin@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2087483003
Cr-Commit-Position: refs/heads/master@{#37220}
parent e9a93a9c
......@@ -998,6 +998,8 @@ v8_source_set("v8_base") {
"src/compiler/source-position.h",
"src/compiler/state-values-utils.cc",
"src/compiler/state-values-utils.h",
"src/compiler/store-store-elimination.cc",
"src/compiler/store-store-elimination.h",
"src/compiler/tail-call-optimization.cc",
"src/compiler/tail-call-optimization.h",
"src/compiler/type-hint-analyzer.cc",
......
......@@ -58,6 +58,7 @@
#include "src/compiler/simplified-lowering.h"
#include "src/compiler/simplified-operator-reducer.h"
#include "src/compiler/simplified-operator.h"
#include "src/compiler/store-store-elimination.h"
#include "src/compiler/tail-call-optimization.h"
#include "src/compiler/type-hint-analyzer.h"
#include "src/compiler/typer.h"
......@@ -1031,6 +1032,15 @@ struct EffectControlLinearizationPhase {
}
};
struct StoreStoreEliminationPhase {
static const char* phase_name() { return "Store-store elimination"; }
void Run(PipelineData* data, Zone* temp_zone) {
StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone);
store_store_elimination.Run();
}
};
struct MemoryOptimizationPhase {
static const char* phase_name() { return "memory optimization"; }
......@@ -1474,6 +1484,11 @@ bool PipelineImpl::OptimizeGraph(Linkage* linkage) {
Run<EffectControlLinearizationPhase>();
RunPrintAndVerify("Effect and control linearized", true);
if (FLAG_turbo_store_elimination) {
Run<StoreStoreEliminationPhase>();
RunPrintAndVerify("Store-store elimination", true);
}
Run<BranchEliminationPhase>();
RunPrintAndVerify("Branch conditions eliminated", true);
......
This diff is collapsed.
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMPILER_STORE_STORE_ELIMINATION_H_
#define V8_COMPILER_STORE_STORE_ELIMINATION_H_
#include "src/compiler/common-operator.h"
#include "src/compiler/graph-reducer.h"
#include "src/compiler/js-graph.h"
namespace v8 {
namespace internal {
namespace compiler {
// Forward declarations.
class CommonOperatorBuilder;
class JSGraph;
class StoreStoreElimination final {
public:
StoreStoreElimination(JSGraph* js_graph, Zone* temp_zone);
~StoreStoreElimination();
void Run();
private:
static bool IsEligibleNode(Node* node);
void ReduceEligibleNode(Node* node);
JSGraph* jsgraph() const { return jsgraph_; }
Zone* temp_zone() const { return temp_zone_; }
JSGraph* const jsgraph_;
Zone* const temp_zone_;
};
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_STORE_STORE_ELIMINATION_H_
......@@ -483,6 +483,8 @@ DEFINE_BOOL(turbo_instruction_scheduling, false,
"enable instruction scheduling in TurboFan")
DEFINE_BOOL(turbo_stress_instruction_scheduling, false,
"randomly schedule instructions to stress dependency tracking")
DEFINE_BOOL(turbo_store_elimination, false,
"enable store-store elimination in TurboFan")
// Flags for native WebAssembly.
DEFINE_BOOL(expose_wasm, false, "expose WASM interface to JavaScript")
......
......@@ -662,6 +662,8 @@
'compiler/source-position.h',
'compiler/state-values-utils.cc',
'compiler/state-values-utils.h',
'compiler/store-store-elimination.cc',
'compiler/store-store-elimination.h',
'compiler/tail-call-optimization.cc',
'compiler/tail-call-optimization.h',
'compiler/type-hint-analyzer.cc',
......
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