5 #include "src/compiler/graph-trimmer.h" 7 #include "src/compiler/graph.h" 13 GraphTrimmer::GraphTrimmer(Zone* zone, Graph* graph)
14 : graph_(graph), is_live_(graph, 2), live_(zone) {
15 live_.reserve(graph->NodeCount());
19 GraphTrimmer::~GraphTrimmer() =
default;
22 void GraphTrimmer::TrimGraph() {
24 MarkAsLive(graph()->end());
26 for (
size_t i = 0;
i < live_.size(); ++
i) {
27 Node*
const live = live_[
i];
28 for (Node*
const input : live->inputs()) MarkAsLive(input);
31 for (Node*
const live : live_) {
33 for (Edge edge : live->use_edges()) {
34 Node*
const user = edge.from();
36 if (FLAG_trace_turbo_trimming) {
37 StdoutStream{} <<
"DeadLink: " << *user <<
"(" << edge.index()
38 <<
") -> " << *live << std::endl;
40 edge.UpdateTo(
nullptr);