| 678 | } |
| 679 | |
| 680 | opt::BasicBlock* FuzzerPass::SplitBlockAfterOpPhiOrOpVariable( |
| 681 | uint32_t block_id) { |
| 682 | auto block = fuzzerutil::MaybeFindBlock(GetIRContext(), block_id); |
| 683 | assert(block && "|block_id| must be a block label"); |
| 684 | assert(!block->IsLoopHeader() && "|block_id| cannot be a loop header"); |
| 685 | |
| 686 | // Find the first non-OpPhi and non-OpVariable instruction. |
| 687 | auto non_phi_or_var_inst = &*block->begin(); |
| 688 | while (non_phi_or_var_inst->opcode() == spv::Op::OpPhi || |
| 689 | non_phi_or_var_inst->opcode() == spv::Op::OpVariable) { |
| 690 | non_phi_or_var_inst = non_phi_or_var_inst->NextNode(); |
| 691 | } |
| 692 | |
| 693 | // Split the block. |
| 694 | uint32_t new_block_id = GetFuzzerContext()->GetFreshId(); |
| 695 | ApplyTransformation(TransformationSplitBlock( |
| 696 | MakeInstructionDescriptor(GetIRContext(), non_phi_or_var_inst), |
| 697 | new_block_id)); |
| 698 | |
| 699 | // We need to return the newly-created block. |
| 700 | return &*block->GetParent()->FindBlock(new_block_id); |
| 701 | } |
| 702 | |
| 703 | uint32_t FuzzerPass::FindOrCreateLocalVariable( |
| 704 | uint32_t pointer_type_id, uint32_t function_id, |
nothing calls this directly
no test coverage detected