Commit 9f60faac authored by Stephan Herhut's avatar Stephan Herhut Committed by Commit Bot

[wasm] Always run GVN to remove codegen artifacts

Code generation for stack checks and protected loads produces duplicate
loads of the stack pointer and memory base address. Without gvn these
turn into actual move operations and sign conversions. Even worse, as
turbofan seems to hoist the stack pointer loads to early blocks, I saw
a high register pressure and many spills.

While there is some compile time cost for gvn, I expect it to be rather
low. On the positive side, I see about a 5% performance inprovement for
some benchmarks. If compilation time turns out to be an issue, we can
still revert.

Change-Id: I13be2ace5b27c51c32430d0cb14fbbe8f31fbf6f
Reviewed-on: https://chromium-review.googlesource.com/1095335Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53657}
parent 507c29c9
......@@ -994,13 +994,14 @@ PipelineWasmCompilationJob::Status PipelineWasmCompilationJob::PrepareJobImpl(
PipelineWasmCompilationJob::Status
PipelineWasmCompilationJob::ExecuteJobImpl() {
pipeline_.RunPrintAndVerify("Machine", true);
PipelineData* data = &data_;
PipelineRunScope scope(data, "wasm optimization");
if (FLAG_wasm_opt || asmjs_origin_) {
// WASM compilations must *always* be independent of the isolate.
Isolate* isolate = nullptr;
PipelineData* data = &data_;
PipelineRunScope scope(data, "wasm optimization");
GraphReducer graph_reducer(scope.zone(), data->graph(),
data->mcgraph()->Dead());
// WASM compilations must *always* be independent of the isolate.
Isolate* isolate = nullptr;
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), scope.zone());
ValueNumberingReducer value_numbering(scope.zone(), data->graph()->zone());
......@@ -1013,8 +1014,14 @@ PipelineWasmCompilationJob::ExecuteJobImpl() {
AddReducer(data, &graph_reducer, &common_reducer);
AddReducer(data, &graph_reducer, &value_numbering);
graph_reducer.ReduceGraph();
pipeline_.RunPrintAndVerify("wasm optimization", true);
} else {
GraphReducer graph_reducer(scope.zone(), data->graph(),
data->mcgraph()->Dead());
ValueNumberingReducer value_numbering(scope.zone(), data->graph()->zone());
AddReducer(data, &graph_reducer, &value_numbering);
graph_reducer.ReduceGraph();
}
pipeline_.RunPrintAndVerify("wasm optimization", true);
if (data_.node_origins()) {
data_.node_origins()->RemoveDecorator();
......
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