| 576 | } |
| 577 | |
| 578 | uint32_t GetLoopFromMergeBlock(opt::IRContext* ir_context, |
| 579 | uint32_t merge_block_id) { |
| 580 | uint32_t result = 0; |
| 581 | ir_context->get_def_use_mgr()->WhileEachUse( |
| 582 | merge_block_id, |
| 583 | [ir_context, &result](opt::Instruction* use_instruction, |
| 584 | uint32_t use_index) -> bool { |
| 585 | switch (use_instruction->opcode()) { |
| 586 | case spv::Op::OpLoopMerge: |
| 587 | // The merge block operand is the first operand in OpLoopMerge. |
| 588 | if (use_index == 0) { |
| 589 | result = ir_context->get_instr_block(use_instruction)->id(); |
| 590 | return false; |
| 591 | } |
| 592 | return true; |
| 593 | default: |
| 594 | return true; |
| 595 | } |
| 596 | }); |
| 597 | return result; |
| 598 | } |
| 599 | |
| 600 | uint32_t FindFunctionType(opt::IRContext* ir_context, |
| 601 | const std::vector<uint32_t>& type_ids) { |
no test coverage detected