Commit 92d8e450 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

Revert "[turbofan] trim effect chain nodes when they have no side-effect"

This reverts commit e02f5611.

Reason for revert: Regresses compile time: chromium:803840

Original change's description:
> [turbofan] trim effect chain nodes when they have no side-effect
>
> Bug:
> Change-Id: Ic1b6dc6fcd8bfc4f0c3dbb101a38106aa3596a12
> Reviewed-on: https://chromium-review.googlesource.com/863886
> Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50588}

TBR=jarin@chromium.org,tebbi@chromium.org

Change-Id: I631840ca3b79272108d5696e6dc68d671774e35c
Bug: 
Reviewed-on: https://chromium-review.googlesource.com/883521
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50833}
parent 90e50cc2
......@@ -5,7 +5,6 @@
#include "src/compiler/graph-trimmer.h"
#include "src/compiler/graph.h"
#include "src/compiler/node-properties.h"
namespace v8 {
namespace internal {
......@@ -19,19 +18,6 @@ GraphTrimmer::GraphTrimmer(Zone* zone, Graph* graph)
GraphTrimmer::~GraphTrimmer() {}
namespace {
bool IsSideEffectFree(const Operator* op) {
switch (op->opcode()) {
case IrOpcode::kLoad:
case IrOpcode::kLoadElement:
case IrOpcode::kLoadField:
case IrOpcode::kTypeGuard:
return true;
default:
return false;
}
}
} // namespace
void GraphTrimmer::TrimGraph() {
// Mark end node as live.
......@@ -39,44 +25,8 @@ void GraphTrimmer::TrimGraph() {
// Compute transitive closure of live nodes.
for (size_t i = 0; i < live_.size(); ++i) {
Node* const live = live_[i];
for (Edge edge : live->input_edges()) {
Node* input = edge.to();
if (NodeProperties::IsEffectEdge(edge)) {
while (IsSideEffectFree(input->op())) {
// Side-effect free effect chain nodes can be removed from the effect
// chain when only their effect output is used. So we ignore the
// effect chain use when determining liveness.
DCHECK_EQ(1, input->op()->EffectInputCount());
input = NodeProperties::GetEffectInput(input);
}
}
MarkAsLive(input);
}
for (Node* const input : live->inputs()) MarkAsLive(input);
}
// Remove unused side-effect-free nodes from the effect chain.
// These are exactly the nodes we skipped before and that don't have value
// uses. This has to be done before we remove dead->live edges because we need
// to read the effect predecessor from the dead effect chain node.
for (Node* const live : live_) {
DCHECK(IsLive(live));
for (Edge edge : live->input_edges()) {
Node* input = edge.to();
if (NodeProperties::IsEffectEdge(edge)) {
Node* new_input = input;
while (!IsLive(new_input)) {
DCHECK(IsSideEffectFree(new_input->op()));
if (FLAG_trace_turbo_trimming) {
OFStream os(stdout);
os << "DeadEffectChainNode: " << *new_input << std::endl;
}
new_input = NodeProperties::GetEffectInput(new_input);
}
if (new_input != input) edge.UpdateTo(new_input);
}
}
}
// Remove dead->live edges.
for (Node* const live : live_) {
DCHECK(IsLive(live));
......
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