MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / SplitBlockAfterOpPhiOrOpVariable

Method SplitBlockAfterOpPhiOrOpVariable

source/fuzz/fuzzer_pass.cpp:680–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

678}
679
680opt::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
703uint32_t FuzzerPass::FindOrCreateLocalVariable(
704 uint32_t pointer_type_id, uint32_t function_id,

Callers

nothing calls this directly

Calls 10

MaybeFindBlockFunction · 0.85
IsLoopHeaderMethod · 0.80
NextNodeMethod · 0.80
GetFreshIdMethod · 0.80
FindBlockMethod · 0.80
beginMethod · 0.45
opcodeMethod · 0.45
GetParentMethod · 0.45

Tested by

no test coverage detected