Skip to content
Snippets Groups Projects
Commit 96cde778 authored by Danylo Piliaiev's avatar Danylo Piliaiev :flag_ua: Committed by Eric Engestrom
Browse files

nir/opt_if: Fix opt_if_simplification when else branch has jump

Consider the following case:

 if ssa_1 {
    block block_2:
    /* succs: block_4 */
 } else {
    block block_3:
    ...
    break
    /* succs: block_5 */
 }

 block block_4:
 vec1 32 ssa_100 = phi block_2: ssa_2

After block_3 extraction and reinsertion, phi->pred becomes invalid
and isn't updated by reinsertion since it is unreachable from block_3.

Call nir_opt_remove_phis_block before moving block to eliminate single
source phis after the if.

Closes: mesa/mesa#3282


Fixes: e3e929f8
Signed-off-by: default avatarDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
Reviewed-by: default avatarTimothy Arceri <tarceri@itsqueeze.com>
Part-of: <mesa/mesa!5945>
(cherry picked from commit 6f94b3da)
parent c334f842
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment