ir3/lower_subgroups: Fix potential infinite loop

I was trying to be clever here, skipping ahead to the newly-created
block and processing the remaining instructions after the split in the
same loop. But if the last instruction in a block was lowered, the saved
next instruction would be the head of the block before the split, not
the new block, and we would compare it to the new block so we wouldn't
stop like we were supposed to. Stop being so clever, and just restart
processing with the new block after lowering an instruction.

Because we're wrapping the actual transform in yet another loop, and the
restarting logic is a bit tricky, refactor the actual lowering into a
separate lower_instr function. Otherwise we'd be mixing the two and
indenting the actual logic even more.

Part-of: <mesa/mesa!13928>
Status Name Job ID Coverage
  Container
created debian/android_build #16157862
manual debian/arm_build #16157866
aarch64 manual
created debian/arm_test #16157871
created debian/i386_build #16157859
created debian/ppc64el_build #16157860
created debian/s390x_build #16157861
created debian/x86_build #16157858
manual debian/x86_build-base #16157857
manual
manual debian/x86_test-base #16157863
manual
created debian/x86_test-gl #16157864
created debian/x86_test-vk #16157865
manual fedora/x86_build #16157867
manual
created kernel+rootfs_amd64 #16157868
created kernel+rootfs_arm64 #16157869
aarch64
created kernel+rootfs_armhf #16157870
aarch64
manual windows_build_vs2019 #16157872
windows shell 1809 mesa manual
 
  Build X86 64
created debian-clang #16157879
created debian-clover #16157880
created debian-clover-testing #16157875
created debian-gallium #16157876
created debian-release #16157877
created debian-testing #16157873
created debian-testing-asan #16157874
created debian-vulkan #16157881
created fedora-release #16157878
 
  Build Misc
created debian-android #16157882
created debian-arm64 #16157884
aarch64
created debian-arm64-asan #16157885
aarch64
created debian-arm64-build-test #16157886
aarch64
created debian-armhf #16157883
aarch64
created debian-i386 #16157888
created debian-mingw32-x86_64 #16157891
created debian-ppc64el #16157890
created debian-s390x #16157889
kvm
created windows-vs2019 #16157887
windows docker 1809 mesa
 
  Amd
created radeonsi-stoney-gl:amd64 1/5 #16157900
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radeonsi-stoney-gl:amd64 2/5 #16157901
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radeonsi-stoney-gl:amd64 3/5 #16157902
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radeonsi-stoney-gl:amd64 4/5 #16157903
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radeonsi-stoney-gl:amd64 5/5 #16157905
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radeonsi-stoney-piglit-gl:amd64 #16157910
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radeonsi-stoney-traces:amd64 #16157908
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radeonsi-stoney-va:amd64 #16157913
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radv-fossils #16157899
created radv-navy_flounder-traces #16157893
amdgpu:codename:NAVY_FLOUNDER manual
created radv-navy_flounder-vkd3d-proton #16157892
amdgpu:codename:NAVY_FLOUNDER manual
created radv_polaris10_vkcts #16157895
polaris10 manual
created radv-raven-traces #16157894
amdgpu:codename:RAVEN manual
created radv_stoney_vkcts:amd64 1/3 #16157896
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radv_stoney_vkcts:amd64 2/3 #16157897
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
created radv_stoney_vkcts:amd64 3/3 #16157898
mesa-ci-x86-64-lava-hp-11A-G6-EE-grunt
 
  Intel
created i915-g33-deqp #16157915
anholt-g33 manual
created i915-g33-piglit #16157918
anholt-g33 manual
created i915-g33-traces #16157921
anholt-g33 manual
created iris-amly-deqp 1/3 #16157938
mesa-ci-x86-64-lava-asus-C433TA-AJ0005-rammus manual
created iris-amly-deqp 2/3 #16157941
mesa-ci-x86-64-lava-asus-C433TA-AJ0005-rammus manual
created iris-amly-deqp 3/3 #16157943
mesa-ci-x86-64-lava-asus-C433TA-AJ0005-rammus manual
created iris-amly-egl #16157959
mesa-ci-x86-64-lava-asus-C433TA-AJ0005-rammus manual
created iris-amly-piglit 1/3 #16157961
mesa-ci-x86-64-lava-asus-C433TA-AJ0005-rammus manual
created iris-amly-piglit 2/3 #16157963
mesa-ci-x86-64-lava-asus-C433TA-AJ0005-rammus manual
created iris-amly-piglit 3/3 #16157965
mesa-ci-x86-64-lava-asus-C433TA-AJ0005-rammus manual
created iris-amly-traces #16157971
mesa-ci-x86-64-lava-asus-C433TA-AJ0005-rammus manual
created iris-apl-deqp 1/3 #16157923
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral
created iris-apl-deqp 2/3 #16157926
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral
created iris-apl-deqp 3/3 #16157927
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral
created iris-apl-egl #16157929
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral
created iris-apl-traces #16157967
mesa-ci-x86-64-lava-asus-C523NA-A20057-coral
created iris-cml-deqp 1/2 #16157955
mesa-ci-x86-64-lava-asus-C436FA-flip-hatch manual
created iris-cml-deqp 2/2 #16157957
mesa-ci-x86-64-lava-asus-C436FA-flip-hatch manual
created iris-cml-traces #16157977
mesa-ci-x86-64-lava-asus-C436FA-flip-hatch manual
created iris-glk-deqp 1/2 #16157932
mesa-ci-x86-64-lava-hp-x360-12b-ca0010nr-n4020-octopus manual
created iris-glk-deqp 2/2 #16157933
mesa-ci-x86-64-lava-hp-x360-12b-ca0010nr-n4020-octopus manual
created iris-glk-egl #16157936
mesa-ci-x86-64-lava-hp-x360-12b-ca0010nr-n4020-octopus manual
created iris-glk-traces #16157969
mesa-ci-x86-64-lava-hp-x360-12b-ca0010nr-n4020-octopus manual
created iris-kbl-deqp 1/3 #16157946
mesa-ci-x86-64-lava-hp-x360-14-G1-sona manual
created iris-kbl-deqp 2/3 #16157948
mesa-ci-x86-64-lava-hp-x360-14-G1-sona manual
created iris-kbl-deqp 3/3 #16157951
mesa-ci-x86-64-lava-hp-x360-14-G1-sona manual
created iris-kbl-traces #16157973
mesa-ci-x86-64-lava-hp-x360-14-G1-sona manual
created iris-whl-deqp #16157953
mesa-ci-x86-64-lava-dell-latitude-5400-4305U-sarien manual
created iris-whl-traces #16157975
mesa-ci-x86-64-lava-dell-latitude-5400-4305U-sarien manual
 
  Arm
created panfrost-g52-gl:arm64 1/3 #16157993
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3
created panfrost-g52-gl:arm64 2/3 #16157995
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3
created panfrost-g52-gl:arm64 3/3 #16157998
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3
created panfrost-g52-piglit-gl:arm64 1/2 #16158001
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3 manual
created panfrost-g52-piglit-gl:arm64 2/2 #16158004
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3 manual
created panfrost-g52-vk:arm64 #16157999
mesa-ci-x86-64-lava-meson-g12b-a311d-khadas-vim3
created panfrost-g72-gl:arm64 1/3 #16158006
mesa-ci-x86-64-lava-mt8183-kukui-jacuzzi-juniper-sku16
created panfrost-g72-gl:arm64 2/3 #16158008
mesa-ci-x86-64-lava-mt8183-kukui-jacuzzi-juniper-sku16
created panfrost-g72-gl:arm64 3/3 #16158010
mesa-ci-x86-64-lava-mt8183-kukui-jacuzzi-juniper-sku16
created panfrost-t720-gles2:arm64 #16157979
mesa-ci-x86-64-lava-sun50i-h6-pine-h64
created panfrost-t760-gles2:armhf #16157981
mesa-ci-x86-64-lava-rk3288-veyron-jaq
created panfrost-t760-traces:armhf #16157983
mesa-ci-x86-64-lava-rk3288-veyron-jaq
created panfrost-t860-gl:arm64 1/3 #16157985
mesa-ci-x86-64-lava-rk3399-gru-kevin
created panfrost-t860-gl:arm64 2/3 #16157987
mesa-ci-x86-64-lava-rk3399-gru-kevin
created panfrost-t860-gl:arm64 3/3 #16157989
mesa-ci-x86-64-lava-rk3399-gru-kevin
created panfrost-t860-traces:arm64 #16157991
mesa-ci-x86-64-lava-rk3399-gru-kevin
 
  Broadcom
created v3d-rpi4-egl:armhf #16158028
igalia-rpi4
created v3d-rpi4-gles:armhf 1/8 #16158020
igalia-rpi4
created v3d-rpi4-gles:armhf 2/8 #16158021
igalia-rpi4
created v3d-rpi4-gles:armhf 3/8 #16158022
igalia-rpi4
created v3d-rpi4-gles:armhf 4/8 #16158023
igalia-rpi4
created v3d-rpi4-gles:armhf 5/8 #16158024
igalia-rpi4
created v3d-rpi4-gles:armhf 6/8 #16158025
igalia-rpi4
created v3d-rpi4-gles:armhf 7/8 #16158026
igalia-rpi4
created v3d-rpi4-gles:armhf 8/8 #16158027
igalia-rpi4
created v3d-rpi4-piglit:armhf 1/4 #16158029
igalia-rpi4
created v3d-rpi4-piglit:armhf 2/4 #16158030
igalia-rpi4
created v3d-rpi4-piglit:armhf 3/4 #16158031
igalia-rpi4
created v3d-rpi4-piglit:armhf 4/4 #16158032
igalia-rpi4
created v3dv-rpi4-vk:arm64 1/8 #16158033
igalia-rpi4
created v3dv-rpi4-vk:arm64 2/8 #16158034
igalia-rpi4
created v3dv-rpi4-vk:arm64 3/8 #16158035
igalia-rpi4
created v3dv-rpi4-vk:arm64 4/8 #16158036
igalia-rpi4
created v3dv-rpi4-vk:arm64 5/8 #16158037
igalia-rpi4
created v3dv-rpi4-vk:arm64 6/8 #16158038
igalia-rpi4
created v3dv-rpi4-vk:arm64 7/8 #16158039
igalia-rpi4
created v3dv-rpi4-vk:arm64 8/8 #16158040
igalia-rpi4
created vc4-rpi3-egl:armhf #16158013
igalia-rpi3
created vc4-rpi3-gles:armhf 1/2 #16158011
igalia-rpi3
created vc4-rpi3-gles:armhf 2/2 #16158012
igalia-rpi3
created vc4-rpi3-piglit-quick_gl:armhf 1/4 #16158014
igalia-rpi3 manual
created vc4-rpi3-piglit-quick_gl:armhf 2/4 #16158015
igalia-rpi3 manual
created vc4-rpi3-piglit-quick_gl:armhf 3/4 #16158016
igalia-rpi3 manual
created vc4-rpi3-piglit-quick_gl:armhf 4/4 #16158017
igalia-rpi3 manual
created vc4-rpi3-piglit-quick_shader:armhf 1/2 #16158018
igalia-rpi3 manual
created vc4-rpi3-piglit-quick_shader:armhf 2/2 #16158019
igalia-rpi3 manual
 
  Freedreno
created a306_gl 1/5 #16158041
google-freedreno-db410c
created a306_gl 2/5 #16158042
google-freedreno-db410c
created a306_gl 3/5 #16158043
google-freedreno-db410c
created a306_gl 4/5 #16158044
google-freedreno-db410c
created a306_gl 5/5 #16158045
google-freedreno-db410c
created a306-traces #16158046
google-freedreno-db410c
created a530_gl 1/5 #16158047
google-freedreno-db820c manual
created a530_gl 2/5 #16158048
google-freedreno-db820c manual
created a530_gl 3/5 #16158049
google-freedreno-db820c manual
created a530_gl 4/5 #16158050
google-freedreno-db820c manual
created a530_gl 5/5 #16158051
google-freedreno-db820c manual
created a530_piglit_gl #16158052
google-freedreno-db820c manual
created a530_piglit_shader 1/2 #16158053
google-freedreno-db820c manual
created a530_piglit_shader 2/2 #16158054
google-freedreno-db820c manual
created a530-traces #16158055
google-freedreno-db820c manual
created a618_vk 1/7 #16158057
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen
created a618_vk 2/7 #16158060
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen
created a618_vk 3/7 #16158063
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen
created a618_vk 4/7 #16158066
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen
created a618_vk 5/7 #16158068
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen
created a618_vk 6/7 #16158070
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen
created a618_vk 7/7 #16158073
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen
created a618_vk_full 1/2 #16158074
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen manual
created a618_vk_full 2/2 #16158075
mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen manual
created a630_egl #16158080
google-freedreno-cheza
created a630_gl 1/4 #16158076
google-freedreno-cheza
created a630_gl 2/4 #16158077
google-freedreno-cheza
created a630_gl 3/4 #16158078
google-freedreno-cheza
created a630_gl 4/4 #16158079
google-freedreno-cheza
created a630_gles_asan #16158081
google-freedreno-cheza manual
created a630_piglit #16158088
google-freedreno-cheza
created a630-traces #16158089
google-freedreno-cheza
created a630_vk 1/3 #16158082
google-freedreno-cheza
created a630_vk 2/3 #16158083
google-freedreno-cheza
created a630_vk 3/3 #16158084
google-freedreno-cheza
created a630_vk_asan #16158087
google-freedreno-cheza manual
created a630_vk_full 1/2 #16158085
google-freedreno-cheza manual
created a630_vk_full 2/2 #16158086
google-freedreno-cheza manual
 
  Etnaviv
created gc2000_gles2 #16158090
etnaviv-gc2000 manual
created gc2000_piglit #16158091
etnaviv-gc2000 manual
 
  Software Renderer
created lavapipe-nir-stress #16158106
created lavapipe-vk #16158105
created lavapipe-vk-asan #16158107
created llvmpipe-deqp 1/2 #16158097
created llvmpipe-deqp 2/2 #16158098
created llvmpipe-deqp-asan #16158099
created llvmpipe-egl #16158100
created llvmpipe-piglit-cl #16158092
created llvmpipe-piglit-glslparser #16158094
created llvmpipe-piglit-quick_gl #16158093
created llvmpipe-piglit-quick_shader #16158095
created llvmpipe-traces #16158096
created softpipe-asan-gles31 #16158103
created softpipe-deqp 1/2 #16158101
created softpipe-deqp 2/2 #16158102
created softpipe-piglit-quick #16158104
 
  Layered Backends
created test-d3d12-windows #16158121
windows docker 1809 mesa
created test-spirv2dxil-windows #16158122
windows docker 1809 mesa
created virgl-on-gl 1/3 #16158108
kvm
created virgl-on-gl 2/3 #16158109
kvm
created virgl-on-gl 3/3 #16158110
kvm
created virgl-on-gles 1/3 #16158111
kvm
created virgl-on-gles 2/3 #16158112
kvm
created virgl-on-gles 3/3 #16158113
kvm
created virgl-traces #16158114
kvm
created zink-lvp-deqp 1/4 #16158117
created zink-lvp-deqp 2/4 #16158118
created zink-lvp-deqp 3/4 #16158119
created zink-lvp-deqp 4/4 #16158120
created zink-piglit-no_timelines #16158116
created zink-piglit-timelines #16158115
 
  Deploy
manual test-docs #16158123
manual