Skip to content
Snippets Groups Projects
Forked from Mesa / mesa
Source project has a limited visibility.
  • Juan A. Suárez's avatar
    b43b55d4
    nir/spirv: return after emitting a branch in block · b43b55d4
    Juan A. Suárez authored
    
    When emitting a branch in a block, it does not make sense to continue
    processing further instructions, as they will not be reachable.
    
    This fixes a nasty case with a loop with a branch that both then-part
    and else-part exits the loop:
    
    %1 = OpLabel
         OpLoopMerge %2 %3 None
         OpBranchConditional %false %2 %2
    %3 = OpLabel
         OpBranch %1
    %2 = OpLabel
        [...]
    
    We know that block %1 will branch always to block %2, which is the merge
    block for the loop. And thus a break is emitted. If we keep continuing
    processing further instructions, we will be processing the branch
    conditional and thus emitting the proper NIR conditional, which leads to
    instructions after the break.
    
    This fixes dEQP-VK.graphicsfuzz.continue-and-merge.
    
    CC: Jason Ekstrand <jason@jlekstrand.net>
    Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
    b43b55d4
    History
    nir/spirv: return after emitting a branch in block
    Juan A. Suárez authored
    
    When emitting a branch in a block, it does not make sense to continue
    processing further instructions, as they will not be reachable.
    
    This fixes a nasty case with a loop with a branch that both then-part
    and else-part exits the loop:
    
    %1 = OpLabel
         OpLoopMerge %2 %3 None
         OpBranchConditional %false %2 %2
    %3 = OpLabel
         OpBranch %1
    %2 = OpLabel
        [...]
    
    We know that block %1 will branch always to block %2, which is the merge
    block for the loop. And thus a break is emitted. If we keep continuing
    processing further instructions, we will be processing the branch
    conditional and thus emitting the proper NIR conditional, which leads to
    instructions after the break.
    
    This fixes dEQP-VK.graphicsfuzz.continue-and-merge.
    
    CC: Jason Ekstrand <jason@jlekstrand.net>
    Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>