Lines Matching refs:Node
9 #include "src/compiler/node-properties.h"
24 Reduction DeadCodeElimination::Reduce(Node* node) {
25 switch (node->opcode()) {
27 return ReduceEnd(node);
30 return ReduceLoopOrMerge(node);
32 return ReduceNode(node);
39 Reduction DeadCodeElimination::ReduceEnd(Node* node) {
40 DCHECK_EQ(IrOpcode::kEnd, node->opcode());
41 int const input_count = node->InputCount();
45 Node* const input = node->InputAt(i);
49 if (i != live_input_count) node->ReplaceInput(live_input_count, input);
55 node->TrimInputCount(live_input_count);
56 NodeProperties::ChangeOp(node, common()->End(live_input_count));
57 return Changed(node);
64 Reduction DeadCodeElimination::ReduceLoopOrMerge(Node* node) {
65 DCHECK(IrOpcode::IsMergeOpcode(node->opcode()));
66 int const input_count = node->InputCount();
68 // Count the number of live inputs to {node} and compact them on the fly, also
73 if (node->opcode() != IrOpcode::kLoop ||
74 node->InputAt(0)->opcode() != IrOpcode::kDead) {
76 Node* const input = node->InputAt(i);
81 node->ReplaceInput(live_input_count, input);
82 for (Node* const use : node->uses()) {
96 for (Node* const use : node->uses()) {
100 DCHECK_EQ(IrOpcode::kLoop, node->opcode());
104 return Replace(node->InputAt(0));
108 // Trim input count for the {Merge} or {Loop} node.
111 for (Node* const use : node->uses()) {
113 use->ReplaceInput(live_input_count, node);
118 TrimMergeOrPhi(node, live_input_count);
119 return Changed(node);
125 Reduction DeadCodeElimination::ReduceNode(Node* node) {
126 // If {node} has exactly one control input and this is {Dead},
127 // replace {node} with {Dead}.
128 int const control_input_count = node->op()->ControlInputCount();
131 Node* control = NodeProperties::GetControlInput(node);
137 void DeadCodeElimination::TrimMergeOrPhi(Node* node, int size) {
138 const Operator* const op = common()->ResizeMergeOrPhi(node->op(), size);
139 node->TrimInputCount(OperatorProperties::GetTotalInputCount(op));
140 NodeProperties::ChangeOp(node, op);