Skip to content

spirv-fuzz: Refactor ForEachInstructionWithInstructionDescriptor #3714

@Vasniktel

Description

@Vasniktel

We've had an internal discussion on the fact that we might want to skip unreachable blocks in ForEachInstructionWithInstructionDescriptor. We could implement that with DominatorAnalysis but it might be too expensive to reinitialize it every time. The reason being is that we can potentially invalidate all analysis in the module on each iteration over the module's instructions in ForEachInstructionWithInstructionDescriptor.

Solutions:

  1. Use DFS. We would need to recompute this every time as well, though. Maybe there is a way to do this efficiently but ForEachInstructionWithInstructionDescriptor might get more complicated than it has to be.
  2. Prohibit any changes to the module in ForEachInstructionWithInstructionDescriptor. I'm not sure how to enforce this rule. Making the method constant won't help here. We could probably copy all required instructions into a vector first and then apply the user's callback to those instructions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions