Skip to content

Commit

Permalink
Fix FuzzerPassCopyObjects
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasniktel committed Sep 24, 2020
1 parent d93cfdd commit f672169
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions source/fuzz/fuzzer_pass_copy_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ void FuzzerPassCopyObjects::Apply() {
"The opcode of the instruction we might insert before must be "
"the same as the opcode in the descriptor for the instruction");

if (GetTransformationContext()->GetFactManager()->BlockIsDead(
block->id())) {
// Don't create synonyms in dead blocks.
return;
}

// Check whether it is legitimate to insert a copy before this
// instruction.
if (!fuzzerutil::CanInsertOpcodeBeforeInstruction(SpvOpCopyObject,
Expand All @@ -56,16 +62,10 @@ void FuzzerPassCopyObjects::Apply() {

const auto relevant_instructions = FindAvailableInstructions(
function, block, inst_it,
[this, block](opt::IRContext* ir_context, opt::Instruction* inst) {
[this](opt::IRContext* ir_context, opt::Instruction* inst) {
return TransformationAddSynonym::IsInstructionValid(
ir_context, *GetTransformationContext(), inst,
protobufs::TransformationAddSynonym::COPY_OBJECT) &&
(!GetTransformationContext()
->GetFactManager()
->BlockIsDead(block->id()) ||
ir_context->get_type_mgr()
->GetType(inst->type_id())
->AsPointer());
ir_context, *GetTransformationContext(), inst,
protobufs::TransformationAddSynonym::COPY_OBJECT);
});

// At this point, |relevant_instructions| contains all the instructions
Expand Down

0 comments on commit f672169

Please sign in to comment.