nir: fix opt_if_loop_last_continue()
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 20 Mar 2019 11:59:40 +0000 (22:59 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 21 Mar 2019 22:58:18 +0000 (09:58 +1100)
commita1bd9dd5bcd6e4aa9a5cf33d9901046f68d3d580
treef38d2403126a3ba139a892e5d341d1e54f977b69
parent620df57dbb74f1001fcdf5b401f5bc7555f8884b
nir: fix opt_if_loop_last_continue()

Rather than skipping code that looked like this:

     loop {
        ...
        if (cond) {
           do_work_1();
           continue;
        } else {
           break;
        }
        do_work_2();
     }

Previously we would turn this into:

     loop {
        ...
        if (cond) {
           do_work_1();
           continue;
        } else {
           do_work_2();
           break;
        }
     }

This was clearly wrong. This change checks for this case and makes
sure we now leave it for nir_opt_dead_cf() to clean up.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/nir/nir_opt_if.c