88 return Next::ReduceInputGraphBranch(input_index, branch);
92 TRACE(
"[structural] Calling ReduceInputGraphBranch for index: %u\n",
93 static_cast<unsigned int>(input_index.id()));
98 Block* current_if_true;
99 Block* current_if_false;
100 const BranchOp* current_branch = &branch;
110 Asm().input_graph().Get(current_branch->
condition());
119 Asm().input_graph())) {
120 TRACE(
"\t [break] End of only-pure-ops cascade reached.\n");
125 if (!switch_var.
valid()) {
126 switch_var = current_var;
127 }
else if (switch_var != current_var) {
128 TRACE(
"\t [bailout] Not all branches compare the same variable.\n");
133 current_if_true = current_branch->
if_false;
134 current_if_false = current_branch->
if_true;
144 "\t [bailout] Branch with different condition than Word32 "
150 const Operation& right_op = Asm().input_graph().Get(
equal->right());
153 "\t [bailout] No Word32 constant on the right side of Equal.\n");
160 Asm().input_graph())) {
161 TRACE(
"\t [break] End of only-pure-ops cascade reached.\n");
165 value = const_op.
word32();
170 if (!switch_var.
valid()) {
171 switch_var = current_var;
172 }
else if (switch_var != current_var) {
173 TRACE(
"\t [bailout] Not all branches compare the same variable.\n");
177 current_if_true = current_branch->
if_true;
178 current_if_false = current_branch->
if_false;
179 current_branch_hint = current_branch->
hint;
182 DCHECK(current_if_true && current_if_false);
207 if (cases.
size() == 0) {
209 hint = current_branch_hint;
222 cases.
emplace_back(value, Asm().MapToNewGraph(current_if_true), hint);
226 false_blocks.
push_back(current_if_false);
233 TRACE(
"\t [break] Reached end of the if-else cascade.\n");
242 if (cases.
size() <= 2) {
243 TRACE(
"\t [bailout] Cascade with less than 2 levels of nesting.\n");
257 auto it = std::adjacent_find(
260 if (it != cases.
end()) {
261 TRACE(
"\t [bailout] Multiple cases with the value %d.\n", (*it).value);
265 TRACE(
"[reduce] Successfully emit a Switch with %zu cases.\n",
267 return EmitSwitch(switch_var, cases, false_blocks, current_if_false,