Manually generate HLSL skip files for vk-gl-cts e2e tests

It seems we haven't run our e2e tests with FXC validation in a long time
 - at least not since we've added the vk-gl-cts corpus.

Locally disabled exclusion of "/test/vk-gl-cts/" in test-runner/main.go,
and ran:
./test/test-all.sh out/build/x64-Debug/tint.exe --format hlsl --fxc --generate-skip

These will need to be manually removed once the skips aren't needed by
deleting them all, and re-running as above.

Bug: tint:940
Change-Id: I27e395e69f5e1bd7d234f3155f40396b751720d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71981
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
diff --git a/test/bug/tint/749.spvasm.expected.hlsl b/test/bug/tint/749.spvasm.expected.hlsl
index 0b5ecf8..48ad9ae 100644
--- a/test/bug/tint/749.spvasm.expected.hlsl
+++ b/test/bug/tint/749.spvasm.expected.hlsl
@@ -1,3 +1,5 @@
+SKIP: FAILED
+
 struct QuicksortObject {
   int numbers[10];
 };
@@ -1560,3 +1562,5 @@
   wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
   return wrapper_result;
 }
+C:\src\tint\test\Shader@0x000001EB41548320(156,10-21): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/bug/tint/804.spv.expected.hlsl b/test/bug/tint/804.spv.expected.hlsl
index 2bc83db..c515711 100644
--- a/test/bug/tint/804.spv.expected.hlsl
+++ b/test/bug/tint/804.spv.expected.hlsl
@@ -1,3 +1,20 @@
 SKIP: FAILED
 
+
+[[block]]
+struct buf0 {
+  resolution : vec2<f32>;
+};
+
+struct S {
+  field0 : u32;
+  field1 : u32;
+};
+
+[[group(0), binding(0)]] var<uniform> x_75 : buf0;
+
+var<private> gl_FragCoord : vec4<f32>;
+
+var<private> x_GLF_color : vec4<f32>;
+
 error: extended arithmetic is not finalized for WGSL: https://github.com/gpuweb/gpuweb/issues/1565: %712 = OpISubBorrow %710 %107 %470
diff --git a/test/bug/tint/807.spv.expected.hlsl b/test/bug/tint/807.spv.expected.hlsl
index f624e54..e736bf8 100644
--- a/test/bug/tint/807.spv.expected.hlsl
+++ b/test/bug/tint/807.spv.expected.hlsl
@@ -1,3 +1,9 @@
 SKIP: FAILED
 
+
+[[block]]
+struct buf0 {
+  resolution : vec2<f32>;
+};
+
 error: undef pointer is not valid: %845 = OpUndef %434
diff --git a/test/loops/continue_in_switch.wgsl.expected.hlsl b/test/loops/continue_in_switch.wgsl.expected.hlsl
index b077826..9c3feb7 100644
--- a/test/loops/continue_in_switch.wgsl.expected.hlsl
+++ b/test/loops/continue_in_switch.wgsl.expected.hlsl
@@ -1,3 +1,5 @@
+SKIP: FAILED
+
 [numthreads(1, 1, 1)]
 void f() {
   {
@@ -15,3 +17,5 @@
   }
   return;
 }
+C:\src\tint\test\Shader@0x000001A817AB3700(7,11-19): error X3708: continue cannot be used in a switch
+
diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..ff5204b
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,165 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_30 : register(b0, space0) {
+  uint4 x_30[1];
+};
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_92 = i;
+  const int x_94 = obj.numbers[x_92];
+  temp = x_94;
+  const int x_95 = i;
+  const int x_96 = j;
+  const int x_98 = obj.numbers[x_96];
+  obj.numbers[x_95] = x_98;
+  const int x_100 = j;
+  obj.numbers[x_100] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_104 = h;
+  const int x_106 = obj.numbers[x_104];
+  pivot = x_106;
+  const int x_107 = l;
+  i_1 = (x_107 - 1);
+  const int x_109 = l;
+  j_1 = x_109;
+  [loop] while (true) {
+    const int x_114 = j_1;
+    const int x_115 = h;
+    if ((x_114 <= (x_115 - 1))) {
+    } else {
+      break;
+    }
+    const int x_121 = obj.numbers[j_1];
+    if ((x_121 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_135 = h;
+  param_3 = x_135;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_141 = (top + 1);
+  top = x_141;
+  stack[x_141] = l_1;
+  const int x_145 = (top + 1);
+  top = x_145;
+  stack[x_145] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_155 = top;
+    top = (x_155 - 1);
+    const int x_158 = stack[x_155];
+    h_1 = x_158;
+    const int x_159 = top;
+    top = (x_159 - 1);
+    const int x_162 = stack[x_159];
+    l_1 = x_162;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_165 = performPartition_i1_i1_(param_4, param_5);
+    p = x_165;
+    if (((p - 1) > l_1)) {
+      const int x_173 = (top + 1);
+      top = x_173;
+      stack[x_173] = l_1;
+      const int x_177 = (top + 1);
+      top = x_177;
+      stack[x_177] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_188 = (top + 1);
+      top = x_188;
+      stack[x_188] = (p + 1);
+      const int x_193 = (top + 1);
+      top = x_193;
+      stack[x_193] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_71 = i_2;
+      const int x_74 = obj.numbers[i_2];
+      const int x_77 = obj.numbers[i_2];
+      obj.numbers[x_71] = (x_74 * x_77);
+    }
+  }
+  quicksort_();
+  const int x_84 = obj.numbers[0];
+  const int x_86 = obj.numbers[4];
+  if ((x_84 < x_86)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000246B5D89100(124,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x00000246B5D89100(123,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..e0e6c28
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/arr-value-set-to-arr-value-squared/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,165 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_30 : register(b0, space0) {
+  uint4 x_30[1];
+};
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_92 = i;
+  const int x_94 = obj.numbers[x_92];
+  temp = x_94;
+  const int x_95 = i;
+  const int x_96 = j;
+  const int x_98 = obj.numbers[x_96];
+  obj.numbers[x_95] = x_98;
+  const int x_100 = j;
+  obj.numbers[x_100] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_104 = h;
+  const int x_106 = obj.numbers[x_104];
+  pivot = x_106;
+  const int x_107 = l;
+  i_1 = (x_107 - 1);
+  const int x_109 = l;
+  j_1 = x_109;
+  [loop] while (true) {
+    const int x_114 = j_1;
+    const int x_115 = h;
+    if ((x_114 <= (x_115 - 1))) {
+    } else {
+      break;
+    }
+    const int x_121 = obj.numbers[j_1];
+    if ((x_121 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_135 = h;
+  param_3 = x_135;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_141 = (top + 1);
+  top = x_141;
+  stack[x_141] = l_1;
+  const int x_145 = (top + 1);
+  top = x_145;
+  stack[x_145] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_155 = top;
+    top = (x_155 - 1);
+    const int x_158 = stack[x_155];
+    h_1 = x_158;
+    const int x_159 = top;
+    top = (x_159 - 1);
+    const int x_162 = stack[x_159];
+    l_1 = x_162;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_165 = performPartition_i1_i1_(param_4, param_5);
+    p = x_165;
+    if (((p - 1) > l_1)) {
+      const int x_173 = (top + 1);
+      top = x_173;
+      stack[x_173] = l_1;
+      const int x_177 = (top + 1);
+      top = x_177;
+      stack[x_177] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_188 = (top + 1);
+      top = x_188;
+      stack[x_188] = (p + 1);
+      const int x_193 = (top + 1);
+      top = x_193;
+      stack[x_193] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_71 = i_2;
+      const int x_74 = obj.numbers[i_2];
+      const int x_77 = obj.numbers[i_2];
+      obj.numbers[x_71] = (x_74 * x_77);
+    }
+  }
+  quicksort_();
+  const int x_84 = obj.numbers[0];
+  const int x_86 = obj.numbers[4];
+  if ((x_84 < x_86)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001BEDA24CD50(124,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001BEDA24CD50(123,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..1db4c8c
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,50 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void func_() {
+  const float x_28 = asfloat(x_6[0].x);
+  if ((1.0f > x_28)) {
+    discard;
+  }
+  return;
+}
+
+void main_1() {
+  x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  [loop] while (true) {
+    func_();
+    if (false) {
+    } else {
+      break;
+    }
+  }
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000016102DC2B30(16,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000016102DC2B30(8,15-18): internal error: invalid access of unbound variable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..a528cf5
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/call-function-with-discard/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,50 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void func_() {
+  const float x_28 = asfloat(x_6[0].x);
+  if ((1.0f > x_28)) {
+    discard;
+  }
+  return;
+}
+
+void main_1() {
+  x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  [loop] while (true) {
+    func_();
+    if (false) {
+    } else {
+      break;
+    }
+  }
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000026A3937ED10(16,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000026A3937ED10(8,15-18): internal error: invalid access of unbound variable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..8be27ab
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,122 @@
+SKIP: FAILED
+
+warning: code is unreachable
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int data[10] = (int[10])0;
+  int x_40 = 0;
+  int x_40_phi = 0;
+  int x_11_phi = 0;
+  const int x_7 = data[1];
+  const int x_10 = ((1 < x_7) ? 2 : 1);
+  x_40_phi = 1;
+  x_11_phi = x_10;
+  [loop] while (true) {
+    int x_54 = 0;
+    int x_41 = 0;
+    int x_41_phi = 0;
+    x_40 = x_40_phi;
+    const int x_11 = x_11_phi;
+    if ((x_11 < 3)) {
+    } else {
+      break;
+    }
+    int x_54_phi = 0;
+    const int x_8 = (x_11 + 1);
+    const float x_47 = asfloat(x_6[0].x);
+    x_54_phi = x_40;
+    switch(int(x_47)) {
+      case 78: {
+        x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f);
+        /* fallthrough */
+        {
+          x_54_phi = asint((x_40 + asint(1)));
+          /* fallthrough */
+        }
+        {
+          x_54 = x_54_phi;
+          x_41_phi = x_54;
+          {
+            x_41 = x_41_phi;
+            x_40_phi = x_41;
+            x_11_phi = x_8;
+          }
+          continue;
+        }
+        break;
+      }
+      case 19: {
+        x_54_phi = asint((x_40 + asint(1)));
+        /* fallthrough */
+        {
+          x_54 = x_54_phi;
+          x_41_phi = x_54;
+          {
+            x_41 = x_41_phi;
+            x_40_phi = x_41;
+            x_11_phi = x_8;
+          }
+          continue;
+        }
+        break;
+      }
+      case 23:
+      case 38: {
+        x_54 = x_54_phi;
+        x_41_phi = x_54;
+        {
+          x_41 = x_41_phi;
+          x_40_phi = x_41;
+          x_11_phi = x_8;
+        }
+        continue;
+        break;
+      }
+      default: {
+        x_41_phi = x_40;
+        {
+          x_41 = x_41_phi;
+          x_40_phi = x_41;
+          x_11_phi = x_8;
+        }
+        continue;
+        break;
+      }
+    }
+    x_41_phi = 0;
+    {
+      x_41 = x_41_phi;
+      x_40_phi = x_41;
+      x_11_phi = x_8;
+    }
+  }
+  data[x_40] = 1;
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000022C8EAC8720(45,11-19): error X3708: continue cannot be used in a switch
+
diff --git a/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..58fea7f
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,125 @@
+SKIP: FAILED
+
+vk-gl-cts/graphicsfuzz/call-if-while-switch/0-opt.wgsl:52:5 warning: code is unreachable
+    x_41_phi = 0;
+    ^^^^^^^^
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int data[10] = (int[10])0;
+  int x_40 = 0;
+  int x_40_phi = 0;
+  int x_11_phi = 0;
+  const int x_7 = data[1];
+  const int x_10 = ((1 < x_7) ? 2 : 1);
+  x_40_phi = 1;
+  x_11_phi = x_10;
+  [loop] while (true) {
+    int x_54 = 0;
+    int x_41 = 0;
+    int x_41_phi = 0;
+    x_40 = x_40_phi;
+    const int x_11 = x_11_phi;
+    if ((x_11 < 3)) {
+    } else {
+      break;
+    }
+    int x_54_phi = 0;
+    const int x_8 = (x_11 + 1);
+    const float x_47 = asfloat(x_6[0].x);
+    x_54_phi = x_40;
+    switch(int(x_47)) {
+      case 78: {
+        x_GLF_color = float4(1.0f, 1.0f, 1.0f, 1.0f);
+        /* fallthrough */
+        {
+          x_54_phi = asint((x_40 + asint(1)));
+          /* fallthrough */
+        }
+        {
+          x_54 = x_54_phi;
+          x_41_phi = x_54;
+          {
+            x_41 = x_41_phi;
+            x_40_phi = x_41;
+            x_11_phi = x_8;
+          }
+          continue;
+        }
+        break;
+      }
+      case 19: {
+        x_54_phi = asint((x_40 + asint(1)));
+        /* fallthrough */
+        {
+          x_54 = x_54_phi;
+          x_41_phi = x_54;
+          {
+            x_41 = x_41_phi;
+            x_40_phi = x_41;
+            x_11_phi = x_8;
+          }
+          continue;
+        }
+        break;
+      }
+      case 23:
+      case 38: {
+        x_54 = x_54_phi;
+        x_41_phi = x_54;
+        {
+          x_41 = x_41_phi;
+          x_40_phi = x_41;
+          x_11_phi = x_8;
+        }
+        continue;
+        break;
+      }
+      default: {
+        x_41_phi = x_40;
+        {
+          x_41 = x_41_phi;
+          x_40_phi = x_41;
+          x_11_phi = x_8;
+        }
+        continue;
+        break;
+      }
+    }
+    x_41_phi = 0;
+    {
+      x_41 = x_41_phi;
+      x_40_phi = x_41;
+      x_11_phi = x_8;
+    }
+  }
+  data[x_40] = 1;
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000025D82F36130(45,11-19): error X3708: continue cannot be used in a switch
+
diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.hlsl
index 4d3c036..206ce4b 100755
--- a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.spvasm.expected.hlsl
@@ -1,5 +1,6 @@
 SKIP: FAILED
 
+warning: code is unreachable
 cbuffer cbuffer_x_5 : register(b0, space0) {
   uint4 x_5[1];
 };
@@ -8,7 +9,7 @@
 void main_1() {
   const float x_26 = asfloat(x_5[0].x);
   if ((x_26 > 1.0f)) {
-    while (true) {
+    [loop] while (true) {
       x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
     }
     return;
@@ -24,11 +25,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
-C:\src\tint\test\Shader@0x000002959F099FD0(9,12-15): error X3696: infinite loop detected - loop never exits
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001F6BB717E80(9,19-22): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.hlsl
index 31f66df..cc278fa 100755
--- a/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl.expected.hlsl
@@ -1,5 +1,9 @@
 SKIP: FAILED
 
+vk-gl-cts/graphicsfuzz/color-set-in-for-loop/0-opt.wgsl:16:5 warning: code is unreachable
+    return;
+    ^^^^^^
+
 cbuffer cbuffer_x_5 : register(b0, space0) {
   uint4 x_5[1];
 };
@@ -8,7 +12,7 @@
 void main_1() {
   const float x_26 = asfloat(x_5[0].x);
   if ((x_26 > 1.0f)) {
-    while (true) {
+    [loop] while (true) {
       x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
     }
     return;
@@ -24,11 +28,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
-C:\src\tint\test\Shader@0x0000018E509AFB50(9,12-15): error X3696: infinite loop detected - loop never exits
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000141CAFC4AB0(9,19-22): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..f78f210
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,218 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+void set_float2(inout float2 vec, int idx, float val) {
+  vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
+}
+
+cbuffer cbuffer_x_25 : register(b0, space0) {
+  uint4 x_25[1];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+float3 drawShape_vf2_(inout float2 pos) {
+  bool c2 = false;
+  bool c3 = false;
+  bool c4 = false;
+  bool c5 = false;
+  bool c6 = false;
+  int GLF_live4i = 0;
+  int GLF_live4_looplimiter5 = 0;
+  float4x2 GLF_live7m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float3x3 GLF_live7m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int GLF_live7cols = 0;
+  int GLF_live7_looplimiter3 = 0;
+  int GLF_live7rows = 0;
+  int GLF_live7_looplimiter2 = 0;
+  int GLF_live7_looplimiter1 = 0;
+  int GLF_live7c = 0;
+  int GLF_live7r = 0;
+  int GLF_live7_looplimiter0 = 0;
+  int GLF_live7sum_index = 0;
+  int GLF_live7_looplimiter7 = 0;
+  int GLF_live7cols_1 = 0;
+  int GLF_live7rows_1 = 0;
+  float GLF_live7sums[9] = (float[9])0;
+  int GLF_live7c_1 = 0;
+  int GLF_live7r_1 = 0;
+  int x_180 = 0;
+  float3x3 indexable = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  const float x_182 = pos.x;
+  c2 = (x_182 > 1.0f);
+  if (c2) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  const float x_188 = pos.y;
+  c3 = (x_188 < 1.0f);
+  if (c3) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  const float x_194 = pos.y;
+  c4 = (x_194 > 1.0f);
+  if (c4) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  const float x_200 = pos.x;
+  c5 = (x_200 < 1.0f);
+  if (c5) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  const float x_206 = pos.x;
+  c6 = ((x_206 + 1.0f) > 1.0f);
+  if (c6) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  GLF_live4i = 0;
+  {
+    [loop] for(; (GLF_live4i < 4); GLF_live4i = (GLF_live4i + 1)) {
+      if ((GLF_live4_looplimiter5 >= 7)) {
+        break;
+      }
+      GLF_live4_looplimiter5 = (GLF_live4_looplimiter5 + 1);
+      GLF_live7m42 = float4x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f), float2(0.0f, 0.0f), float2(1.0f, 0.0f));
+      GLF_live7m33 = float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f));
+      GLF_live7cols = 2;
+      {
+        [loop] for(; (GLF_live7cols < 4); GLF_live7cols = (GLF_live7cols + 1)) {
+          if ((GLF_live7_looplimiter3 >= 7)) {
+            break;
+          }
+          GLF_live7_looplimiter3 = (GLF_live7_looplimiter3 + 1);
+          GLF_live7rows = 2;
+          {
+            [loop] for(; (GLF_live7rows < 4); GLF_live7rows = (GLF_live7rows + 1)) {
+              if ((GLF_live7_looplimiter2 >= 7)) {
+                break;
+              }
+              GLF_live7_looplimiter2 = (GLF_live7_looplimiter2 + 1);
+              GLF_live7_looplimiter1 = 0;
+              GLF_live7c = 0;
+              {
+                [loop] for(; (GLF_live7c < 3); GLF_live7c = (GLF_live7c + 1)) {
+                  if ((GLF_live7_looplimiter1 >= 7)) {
+                    break;
+                  }
+                  GLF_live7_looplimiter1 = (GLF_live7_looplimiter1 + 1);
+                  GLF_live7r = 0;
+                  {
+                    [loop] for(; (GLF_live7r < 2); GLF_live7r = (GLF_live7r + 1)) {
+                      if ((GLF_live7_looplimiter0 >= 7)) {
+                        break;
+                      }
+                      GLF_live7_looplimiter0 = (GLF_live7_looplimiter0 + 1);
+                      set_float3(GLF_live7m33[(((GLF_live7c >= 0) & (GLF_live7c < 3)) ? GLF_live7c : 0)], (((GLF_live7r >= 0) & (GLF_live7r < 3)) ? GLF_live7r : 0), 1.0f);
+                      const float x_267 = asfloat(x_25[0].y);
+                      if ((0.0f > x_267)) {
+                      } else {
+                        set_float2(GLF_live7m42[(((GLF_live7c >= 0) & (GLF_live7c < 4)) ? GLF_live7c : 0)], (((GLF_live7r >= 0) & (GLF_live7r < 2)) ? GLF_live7r : 0), 1.0f);
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      GLF_live7sum_index = 0;
+      GLF_live7_looplimiter7 = 0;
+      GLF_live7cols_1 = 2;
+      {
+        [loop] for(; (GLF_live7cols_1 < 4); GLF_live7cols_1 = (GLF_live7cols_1 + 1)) {
+          if ((GLF_live7_looplimiter7 >= 7)) {
+            break;
+          }
+          GLF_live7_looplimiter7 = (GLF_live7_looplimiter7 + 1);
+          GLF_live7rows_1 = 2;
+          GLF_live7sums[(((GLF_live7sum_index >= 0) & (GLF_live7sum_index < 9)) ? GLF_live7sum_index : 0)] = 0.0f;
+          GLF_live7c_1 = 0;
+          {
+            [loop] for(; (GLF_live7c_1 < 1); GLF_live7c_1 = (GLF_live7c_1 + 1)) {
+              GLF_live7r_1 = 0;
+              {
+                [loop] for(; (GLF_live7r_1 < GLF_live7rows_1); GLF_live7r_1 = (GLF_live7r_1 + 1)) {
+                  const int x_310 = (((GLF_live7sum_index >= 0) & (GLF_live7sum_index < 9)) ? GLF_live7sum_index : 0);
+                  const float3x3 x_312 = transpose(GLF_live7m33);
+                  if ((GLF_live7c_1 < 3)) {
+                    x_180 = 1;
+                  } else {
+                    const float x_318 = asfloat(x_25[0].x);
+                    x_180 = int(x_318);
+                  }
+                  const int x_320 = x_180;
+                  const int x_93 = GLF_live7r_1;
+                  indexable = x_312;
+                  const float x_324 = indexable[x_320][((x_93 < 3) ? 1 : 0)];
+                  const float x_326 = GLF_live7sums[x_310];
+                  GLF_live7sums[x_310] = (x_326 + x_324);
+                  const int x_332 = (((GLF_live7sum_index >= 0) & (GLF_live7sum_index < 9)) ? GLF_live7sum_index : 0);
+                  const float x_334 = GLF_live7m42[1][GLF_live7r_1];
+                  const float x_336 = GLF_live7sums[x_332];
+                  GLF_live7sums[x_332] = (x_336 + x_334);
+                }
+              }
+            }
+          }
+          GLF_live7sum_index = (GLF_live7sum_index + 1);
+        }
+      }
+    }
+  }
+  return float3(1.0f, 1.0f, 1.0f);
+}
+
+void main_1() {
+  float2 position = float2(0.0f, 0.0f);
+  float2 param = float2(0.0f, 0.0f);
+  float2 param_1 = float2(0.0f, 0.0f);
+  int i = 0;
+  float2 param_2 = float2(0.0f, 0.0f);
+  const float x_161 = asfloat(x_25[0].x);
+  if ((x_161 >= 2.0f)) {
+    const float4 x_165 = gl_FragCoord;
+    position = float2(x_165.x, x_165.y);
+    param = position;
+    const float3 x_168 = drawShape_vf2_(param);
+    param_1 = position;
+    const float3 x_170 = drawShape_vf2_(param_1);
+    i = 25;
+    {
+      [loop] for(; (i > 0); i = (i - 1)) {
+        param_2 = position;
+        const float3 x_178 = drawShape_vf2_(param_2);
+      }
+    }
+  }
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002DBA887C060(100,28-81): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..6b45ab8
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/control-flow-in-function/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,246 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+void set_float2(inout float2 vec, int idx, float val) {
+  vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
+}
+
+cbuffer cbuffer_x_25 : register(b0, space0) {
+  uint4 x_25[1];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+float3 drawShape_vf2_(inout float2 pos) {
+  bool c2 = false;
+  bool c3 = false;
+  bool c4 = false;
+  bool c5 = false;
+  bool c6 = false;
+  int GLF_live4i = 0;
+  int GLF_live4_looplimiter5 = 0;
+  float4x2 GLF_live7m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float3x3 GLF_live7m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int GLF_live7cols = 0;
+  int GLF_live7_looplimiter3 = 0;
+  int GLF_live7rows = 0;
+  int GLF_live7_looplimiter2 = 0;
+  int GLF_live7_looplimiter1 = 0;
+  int GLF_live7c = 0;
+  int GLF_live7r = 0;
+  int GLF_live7_looplimiter0 = 0;
+  int GLF_live7sum_index = 0;
+  int GLF_live7_looplimiter7 = 0;
+  int GLF_live7cols_1 = 0;
+  int GLF_live7rows_1 = 0;
+  float GLF_live7sums[9] = (float[9])0;
+  int GLF_live7c_1 = 0;
+  int GLF_live7r_1 = 0;
+  int x_180 = 0;
+  float3x3 indexable = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  const float x_182 = pos.x;
+  c2 = (x_182 > 1.0f);
+  if (c2) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  const float x_188 = pos.y;
+  c3 = (x_188 < 1.0f);
+  if (c3) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  const float x_194 = pos.y;
+  c4 = (x_194 > 1.0f);
+  if (c4) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  const float x_200 = pos.x;
+  c5 = (x_200 < 1.0f);
+  if (c5) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  const float x_206 = pos.x;
+  c6 = ((x_206 + 1.0f) > 1.0f);
+  if (c6) {
+    return float3(1.0f, 1.0f, 1.0f);
+  }
+  GLF_live4i = 0;
+  {
+    [loop] for(; (GLF_live4i < 4); GLF_live4i = (GLF_live4i + 1)) {
+      if ((GLF_live4_looplimiter5 >= 7)) {
+        break;
+      }
+      GLF_live4_looplimiter5 = (GLF_live4_looplimiter5 + 1);
+      GLF_live7m42 = float4x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f), float2(0.0f, 0.0f), float2(1.0f, 0.0f));
+      GLF_live7m33 = float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f));
+      GLF_live7cols = 2;
+      {
+        [loop] for(; (GLF_live7cols < 4); GLF_live7cols = (GLF_live7cols + 1)) {
+          if ((GLF_live7_looplimiter3 >= 7)) {
+            break;
+          }
+          GLF_live7_looplimiter3 = (GLF_live7_looplimiter3 + 1);
+          GLF_live7rows = 2;
+          {
+            [loop] for(; (GLF_live7rows < 4); GLF_live7rows = (GLF_live7rows + 1)) {
+              if ((GLF_live7_looplimiter2 >= 7)) {
+                break;
+              }
+              GLF_live7_looplimiter2 = (GLF_live7_looplimiter2 + 1);
+              GLF_live7_looplimiter1 = 0;
+              GLF_live7c = 0;
+              {
+                [loop] for(; (GLF_live7c < 3); GLF_live7c = (GLF_live7c + 1)) {
+                  if ((GLF_live7_looplimiter1 >= 7)) {
+                    break;
+                  }
+                  GLF_live7_looplimiter1 = (GLF_live7_looplimiter1 + 1);
+                  GLF_live7r = 0;
+                  {
+                    [loop] for(; (GLF_live7r < 2); GLF_live7r = (GLF_live7r + 1)) {
+                      if ((GLF_live7_looplimiter0 >= 7)) {
+                        break;
+                      }
+                      GLF_live7_looplimiter0 = (GLF_live7_looplimiter0 + 1);
+                      bool tint_tmp = (GLF_live7c >= 0);
+                      if (tint_tmp) {
+                        tint_tmp = (GLF_live7c < 3);
+                      }
+                      bool tint_tmp_1 = (GLF_live7r >= 0);
+                      if (tint_tmp_1) {
+                        tint_tmp_1 = (GLF_live7r < 3);
+                      }
+                      set_float3(GLF_live7m33[((tint_tmp) ? GLF_live7c : 0)], ((tint_tmp_1) ? GLF_live7r : 0), 1.0f);
+                      const float x_267 = asfloat(x_25[0].y);
+                      if ((0.0f > x_267)) {
+                      } else {
+                        bool tint_tmp_2 = (GLF_live7c >= 0);
+                        if (tint_tmp_2) {
+                          tint_tmp_2 = (GLF_live7c < 4);
+                        }
+                        bool tint_tmp_3 = (GLF_live7r >= 0);
+                        if (tint_tmp_3) {
+                          tint_tmp_3 = (GLF_live7r < 2);
+                        }
+                        set_float2(GLF_live7m42[((tint_tmp_2) ? GLF_live7c : 0)], ((tint_tmp_3) ? GLF_live7r : 0), 1.0f);
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+      GLF_live7sum_index = 0;
+      GLF_live7_looplimiter7 = 0;
+      GLF_live7cols_1 = 2;
+      {
+        [loop] for(; (GLF_live7cols_1 < 4); GLF_live7cols_1 = (GLF_live7cols_1 + 1)) {
+          if ((GLF_live7_looplimiter7 >= 7)) {
+            break;
+          }
+          GLF_live7_looplimiter7 = (GLF_live7_looplimiter7 + 1);
+          GLF_live7rows_1 = 2;
+          bool tint_tmp_4 = (GLF_live7sum_index >= 0);
+          if (tint_tmp_4) {
+            tint_tmp_4 = (GLF_live7sum_index < 9);
+          }
+          GLF_live7sums[((tint_tmp_4) ? GLF_live7sum_index : 0)] = 0.0f;
+          GLF_live7c_1 = 0;
+          {
+            [loop] for(; (GLF_live7c_1 < 1); GLF_live7c_1 = (GLF_live7c_1 + 1)) {
+              GLF_live7r_1 = 0;
+              {
+                [loop] for(; (GLF_live7r_1 < GLF_live7rows_1); GLF_live7r_1 = (GLF_live7r_1 + 1)) {
+                  bool tint_tmp_5 = (GLF_live7sum_index >= 0);
+                  if (tint_tmp_5) {
+                    tint_tmp_5 = (GLF_live7sum_index < 9);
+                  }
+                  const int x_310 = ((tint_tmp_5) ? GLF_live7sum_index : 0);
+                  const float3x3 x_312 = transpose(GLF_live7m33);
+                  if ((GLF_live7c_1 < 3)) {
+                    x_180 = 1;
+                  } else {
+                    const float x_318 = asfloat(x_25[0].x);
+                    x_180 = int(x_318);
+                  }
+                  const int x_320 = x_180;
+                  const int x_93 = GLF_live7r_1;
+                  indexable = x_312;
+                  const float x_324 = indexable[x_320][((x_93 < 3) ? 1 : 0)];
+                  const float x_326 = GLF_live7sums[x_310];
+                  GLF_live7sums[x_310] = (x_326 + x_324);
+                  bool tint_tmp_6 = (GLF_live7sum_index >= 0);
+                  if (tint_tmp_6) {
+                    tint_tmp_6 = (GLF_live7sum_index < 9);
+                  }
+                  const int x_332 = ((tint_tmp_6) ? GLF_live7sum_index : 0);
+                  const float x_334 = GLF_live7m42[1][GLF_live7r_1];
+                  const float x_336 = GLF_live7sums[x_332];
+                  GLF_live7sums[x_332] = (x_336 + x_334);
+                }
+              }
+            }
+          }
+          GLF_live7sum_index = (GLF_live7sum_index + 1);
+        }
+      }
+    }
+  }
+  return float3(1.0f, 1.0f, 1.0f);
+}
+
+void main_1() {
+  float2 position = float2(0.0f, 0.0f);
+  float2 param = float2(0.0f, 0.0f);
+  float2 param_1 = float2(0.0f, 0.0f);
+  int i = 0;
+  float2 param_2 = float2(0.0f, 0.0f);
+  const float x_161 = asfloat(x_25[0].x);
+  if ((x_161 >= 2.0f)) {
+    const float4 x_165 = gl_FragCoord;
+    position = float2(x_165.x, x_165.y);
+    param = position;
+    const float3 x_168 = drawShape_vf2_(param);
+    param_1 = position;
+    const float3 x_170 = drawShape_vf2_(param_1);
+    i = 25;
+    {
+      [loop] for(; (i > 0); i = (i - 1)) {
+        param_2 = position;
+        const float3 x_178 = drawShape_vf2_(param_2);
+      }
+    }
+  }
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000018D92558420(100,28-81): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..be9d33f
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,49 @@
+SKIP: FAILED
+
+struct Array {
+  int values[2];
+};
+
+cbuffer cbuffer_x_7 : register(b0, space0) {
+  uint4 x_7[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  Array a = (Array)0;
+  Array b = (Array)0;
+  float one = 0.0f;
+  const int x_10 = asint(x_7[0].x);
+  a.values[x_10] = 1;
+  b = a;
+  one = 0.0f;
+  const int x_11 = asint(x_7[0].x);
+  const int x_12 = b.values[x_11];
+  if ((x_12 == 1)) {
+    one = 1.0f;
+  }
+  x_GLF_color = float4(one, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000026DA3D26220(15,3-16): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..db056c7
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-copy-prop-arrays-no-stores/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,49 @@
+SKIP: FAILED
+
+struct Array {
+  int values[2];
+};
+
+cbuffer cbuffer_x_7 : register(b0, space0) {
+  uint4 x_7[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  Array a = (Array)0;
+  Array b = (Array)0;
+  float one = 0.0f;
+  const int x_10 = asint(x_7[0].x);
+  a.values[x_10] = 1;
+  b = a;
+  one = 0.0f;
+  const int x_11 = asint(x_7[0].x);
+  const int x_12 = b.values[x_11];
+  if ((x_12 == 1)) {
+    one = 1.0f;
+  }
+  x_GLF_color = float4(one, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000024C52B7BDB0(15,3-16): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl
index 336b952..281f92d 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl
@@ -1,4 +1,4 @@
-SKIP: https://github.com/microsoft/DirectXShaderCompiler/issues/3894
+SKIP: FAILED
 
 static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
 static float array0[3] = (float[3])0;
@@ -17,13 +17,13 @@
   i = (int(x_55) % 3);
   c = 0;
   {
-    for(; (c < 3); c = (c + 1)) {
+    [loop] for(; (c < 3); c = (c + 1)) {
       array0[c] = 0.0f;
       array1[c] = 0.0f;
       const float x_65 = asfloat(x_11[0].x);
       switch((int(x_65) + q)) {
         case 51: {
-          while (true) {
+          [loop] while (true) {
             if (true) {
             } else {
               break;
@@ -69,11 +69,31 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol_2 main(tint_symbol_1 tint_symbol) {
-  const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
+main_out main_inner(float4 gl_FragCoord_param) {
   gl_FragCoord = gl_FragCoord_param;
   main_1();
-  const main_out tint_symbol_3 = {x_GLF_color};
-  const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
-  return tint_symbol_5;
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
 }
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(15,8-20): warning X3556: integer modulus may be much slower, try using uints if possible.
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x000001BF7F9DDFF0(24,25-28): error X3696: infinite loop detected - loop never exits
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl
index 336b952..a4a3eae 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl
@@ -1,4 +1,4 @@
-SKIP: https://github.com/microsoft/DirectXShaderCompiler/issues/3894
+SKIP: FAILED
 
 static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
 static float array0[3] = (float[3])0;
@@ -17,13 +17,13 @@
   i = (int(x_55) % 3);
   c = 0;
   {
-    for(; (c < 3); c = (c + 1)) {
+    [loop] for(; (c < 3); c = (c + 1)) {
       array0[c] = 0.0f;
       array1[c] = 0.0f;
       const float x_65 = asfloat(x_11[0].x);
       switch((int(x_65) + q)) {
         case 51: {
-          while (true) {
+          [loop] while (true) {
             if (true) {
             } else {
               break;
@@ -69,11 +69,31 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol_2 main(tint_symbol_1 tint_symbol) {
-  const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
+main_out main_inner(float4 gl_FragCoord_param) {
   gl_FragCoord = gl_FragCoord_param;
   main_1();
-  const main_out tint_symbol_3 = {x_GLF_color};
-  const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
-  return tint_symbol_5;
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
 }
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000012C749BFE70(15,8-20): warning X3556: integer modulus may be much slower, try using uints if possible.
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000012C749BFE70(24,25-28): error X3696: infinite loop detected - loop never exits
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..582837a
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,3 @@
+SKIP: FAILED
+
+exit status 0xc00000fd
\ No newline at end of file
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..582837a
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-fragcoord-clamp-array-access/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,3 @@
+SKIP: FAILED
+
+exit status 0xc00000fd
\ No newline at end of file
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..909cf6f
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,80 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[4];
+};
+cbuffer cbuffer_x_9 : register(b1, space0) {
+  uint4 x_9[2];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int a = 0;
+  float3 arr[2] = (float3[2])0;
+  float3 v = float3(0.0f, 0.0f, 0.0f);
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
+  const float x_46 = float(x_45);
+  m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46));
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const int x_52 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  a = x_52;
+  const int x_53 = a;
+  const int x_54 = a;
+  const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+  const float x_56 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+  set_float3(m[x_53], x_54, x_56);
+  const float3 x_59 = m[1];
+  const float3 x_61 = m[1];
+  const float3 tint_symbol_3[2] = {x_59, x_61};
+  arr = tint_symbol_3;
+  const float x_64 = asfloat(x_9[1].x);
+  v = float3(x_64, x_64, x_64);
+  const float3 x_68 = arr[a];
+  v = (v + x_68);
+  const float3 x_71 = v;
+  const int x_73 = asint(x_6[1].x);
+  const int x_76 = asint(x_6[2].x);
+  const int x_79 = asint(x_6[1].x);
+  if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) {
+    const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+    const int x_88 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+    const int x_91 = asint(x_6[3].x);
+    const int x_94 = asint(x_6[3].x);
+    const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+    const int x_97 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+    x_GLF_color = float4(float(x_88), float(x_91), float(x_94), float(x_97));
+  } else {
+    const int x_101 = asint(x_6[3].x);
+    const float x_102 = float(x_101);
+    x_GLF_color = float4(x_102, x_102, x_102, x_102);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000167B1373790(29,14-20): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..83a7b7d
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-array-matrix-element/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,80 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[4];
+};
+cbuffer cbuffer_x_9 : register(b1, space0) {
+  uint4 x_9[2];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int a = 0;
+  float3 arr[2] = (float3[2])0;
+  float3 v = float3(0.0f, 0.0f, 0.0f);
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
+  const float x_46 = float(x_45);
+  m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46));
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const int x_52 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  a = x_52;
+  const int x_53 = a;
+  const int x_54 = a;
+  const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+  const float x_56 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+  set_float3(m[x_53], x_54, x_56);
+  const float3 x_59 = m[1];
+  const float3 x_61 = m[1];
+  const float3 tint_symbol_3[2] = {x_59, x_61};
+  arr = tint_symbol_3;
+  const float x_64 = asfloat(x_9[1].x);
+  v = float3(x_64, x_64, x_64);
+  const float3 x_68 = arr[a];
+  v = (v + x_68);
+  const float3 x_71 = v;
+  const int x_73 = asint(x_6[1].x);
+  const int x_76 = asint(x_6[2].x);
+  const int x_79 = asint(x_6[1].x);
+  if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) {
+    const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+    const int x_88 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+    const int x_91 = asint(x_6[3].x);
+    const int x_94 = asint(x_6[3].x);
+    const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+    const int x_97 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+    x_GLF_color = float4(float(x_88), float(x_91), float(x_94), float(x_97));
+  } else {
+    const int x_101 = asint(x_6[3].x);
+    const float x_102 = float(x_101);
+    x_GLF_color = float4(x_102, x_102, x_102, x_102);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001E84DF5F800(29,14-20): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..e2a6cb3
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+void set_float4(inout float4 vec, int idx, float val) {
+  vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[2];
+};
+cbuffer cbuffer_x_9 : register(b1, space0) {
+  uint4 x_9[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int a = 0;
+  float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  float3x4 m = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float4x4 indexable = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_44 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
+  a = x_44;
+  const float x_46 = asfloat(x_9[2].x);
+  v = float4(x_46, x_46, x_46, x_46);
+  const float x_49 = asfloat(x_9[3].x);
+  m = float3x4(float4(x_49, 0.0f, 0.0f, 0.0f), float4(0.0f, x_49, 0.0f, 0.0f), float4(0.0f, 0.0f, x_49, 0.0f));
+  const int x_54 = a;
+  const int x_55 = a;
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const float x_57 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  set_float4(m[x_54], x_55, x_57);
+  const int x_59 = a;
+  const float3x4 x_60 = m;
+  const int x_78 = a;
+  const int x_79 = a;
+  indexable = float4x4(float4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), float4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), float4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), float4(0.0f, 0.0f, 0.0f, 1.0f));
+  const float x_81 = indexable[x_78][x_79];
+  const float x_83 = v[x_59];
+  set_float4(v, x_59, (x_83 + x_81));
+  const float x_87 = v.y;
+  const float x_89 = asfloat(x_9[1].x);
+  if ((x_87 == x_89)) {
+    const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+    const int x_95 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+    const int x_98 = asint(x_6[1].x);
+    const int x_101 = asint(x_6[1].x);
+    const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+    const int x_104 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+    x_GLF_color = float4(float(x_95), float(x_98), float(x_101), float(x_104));
+  } else {
+    const int x_108 = asint(x_6[1].x);
+    const float x_109 = float(x_108);
+    x_GLF_color = float4(x_109, x_109, x_109, x_109);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  return tint_symbol_3;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000015D0949C000(29,14-20): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..884c3d6
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-increment-vector-component-with-matrix-copy/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+void set_float4(inout float4 vec, int idx, float val) {
+  vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[2];
+};
+cbuffer cbuffer_x_9 : register(b1, space0) {
+  uint4 x_9[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int a = 0;
+  float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  float3x4 m = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float4x4 indexable = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_44 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
+  a = x_44;
+  const float x_46 = asfloat(x_9[2].x);
+  v = float4(x_46, x_46, x_46, x_46);
+  const float x_49 = asfloat(x_9[3].x);
+  m = float3x4(float4(x_49, 0.0f, 0.0f, 0.0f), float4(0.0f, x_49, 0.0f, 0.0f), float4(0.0f, 0.0f, x_49, 0.0f));
+  const int x_54 = a;
+  const int x_55 = a;
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const float x_57 = asfloat(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  set_float4(m[x_54], x_55, x_57);
+  const int x_59 = a;
+  const float3x4 x_60 = m;
+  const int x_78 = a;
+  const int x_79 = a;
+  indexable = float4x4(float4(x_60[0u].x, x_60[0u].y, x_60[0u].z, x_60[0u].w), float4(x_60[1u].x, x_60[1u].y, x_60[1u].z, x_60[1u].w), float4(x_60[2u].x, x_60[2u].y, x_60[2u].z, x_60[2u].w), float4(0.0f, 0.0f, 0.0f, 1.0f));
+  const float x_81 = indexable[x_78][x_79];
+  const float x_83 = v[x_59];
+  set_float4(v, x_59, (x_83 + x_81));
+  const float x_87 = v.y;
+  const float x_89 = asfloat(x_9[1].x);
+  if ((x_87 == x_89)) {
+    const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+    const int x_95 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+    const int x_98 = asint(x_6[1].x);
+    const int x_101 = asint(x_6[1].x);
+    const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+    const int x_104 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+    x_GLF_color = float4(float(x_95), float(x_98), float(x_101), float(x_104));
+  } else {
+    const int x_108 = asint(x_6[1].x);
+    const float x_109 = float(x_108);
+    x_GLF_color = float4(x_109, x_109, x_109, x_109);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  return tint_symbol_3;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002C75C7A2100(29,14-20): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..097dd84
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,105 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+cbuffer cbuffer_x_7 : register(b1, space0) {
+  uint4 x_7[2];
+};
+cbuffer cbuffer_x_10 : register(b0, space0) {
+  uint4 x_10[4];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int i = 0;
+  const float x_46 = asfloat(x_7[1].x);
+  m23 = float2x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f));
+  i = 1;
+  [loop] while (true) {
+    bool x_80 = false;
+    bool x_81_phi = false;
+    const int x_54 = i;
+    const int x_56 = asint(x_10[3].x);
+    if ((x_54 < x_56)) {
+    } else {
+      break;
+    }
+    const uint scalar_offset = ((16u * uint(0))) / 4;
+    const int x_60 = asint(x_10[scalar_offset / 4][scalar_offset % 4]);
+    const int x_62 = asint(x_10[2].x);
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const float x_64 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+    const float x_66 = m23[x_60][x_62];
+    set_float3(m23[x_60], x_62, (x_66 + x_64));
+    const float x_70 = gl_FragCoord.y;
+    const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+    const float x_72 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+    if ((x_70 < x_72)) {
+    }
+    x_81_phi = true;
+    if (true) {
+      const float x_79 = gl_FragCoord.x;
+      x_80 = (x_79 < 0.0f);
+      x_81_phi = x_80;
+    }
+    if (!(x_81_phi)) {
+      break;
+    }
+    {
+      i = (i + 1);
+    }
+  }
+  const float2x3 x_87 = m23;
+  const int x_89 = asint(x_10[1].x);
+  const int x_92 = asint(x_10[1].x);
+  const int x_95 = asint(x_10[1].x);
+  const int x_98 = asint(x_10[1].x);
+  const int x_101 = asint(x_10[1].x);
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const int x_104 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const float2x3 x_108 = float2x3(float3(float(x_89), float(x_92), float(x_95)), float3(float(x_98), float(x_101), float(x_104)));
+  if ((all((x_87[0u] == x_108[0u])) & all((x_87[1u] == x_108[1u])))) {
+    const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+    const int x_122 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+    const int x_125 = asint(x_10[1].x);
+    const int x_128 = asint(x_10[1].x);
+    const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+    const int x_131 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]);
+    x_GLF_color = float4(float(x_122), float(x_125), float(x_128), float(x_131));
+  } else {
+    const int x_135 = asint(x_10[1].x);
+    const float x_136 = float(x_135);
+    x_GLF_color = float4(x_136, x_136, x_136, x_136);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_5 = {x_GLF_color};
+  return tint_symbol_5;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001FC5E0CC510(20,10-21): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..eb7806c
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-matrix-element-break-after-first-iteration/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,109 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+cbuffer cbuffer_x_7 : register(b1, space0) {
+  uint4 x_7[2];
+};
+cbuffer cbuffer_x_10 : register(b0, space0) {
+  uint4 x_10[4];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int i = 0;
+  const float x_46 = asfloat(x_7[1].x);
+  m23 = float2x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f));
+  i = 1;
+  [loop] while (true) {
+    bool x_80 = false;
+    bool x_81_phi = false;
+    const int x_54 = i;
+    const int x_56 = asint(x_10[3].x);
+    if ((x_54 < x_56)) {
+    } else {
+      break;
+    }
+    const uint scalar_offset = ((16u * uint(0))) / 4;
+    const int x_60 = asint(x_10[scalar_offset / 4][scalar_offset % 4]);
+    const int x_62 = asint(x_10[2].x);
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const float x_64 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+    const float x_66 = m23[x_60][x_62];
+    set_float3(m23[x_60], x_62, (x_66 + x_64));
+    const float x_70 = gl_FragCoord.y;
+    const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+    const float x_72 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+    if ((x_70 < x_72)) {
+    }
+    x_81_phi = true;
+    if (true) {
+      const float x_79 = gl_FragCoord.x;
+      x_80 = (x_79 < 0.0f);
+      x_81_phi = x_80;
+    }
+    if (!(x_81_phi)) {
+      break;
+    }
+    {
+      i = (i + 1);
+    }
+  }
+  const float2x3 x_87 = m23;
+  const int x_89 = asint(x_10[1].x);
+  const int x_92 = asint(x_10[1].x);
+  const int x_95 = asint(x_10[1].x);
+  const int x_98 = asint(x_10[1].x);
+  const int x_101 = asint(x_10[1].x);
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const int x_104 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const float2x3 x_108 = float2x3(float3(float(x_89), float(x_92), float(x_95)), float3(float(x_98), float(x_101), float(x_104)));
+  bool tint_tmp = all((x_87[0u] == x_108[0u]));
+  if (tint_tmp) {
+    tint_tmp = all((x_87[1u] == x_108[1u]));
+  }
+  if ((tint_tmp)) {
+    const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+    const int x_122 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+    const int x_125 = asint(x_10[1].x);
+    const int x_128 = asint(x_10[1].x);
+    const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+    const int x_131 = asint(x_10[scalar_offset_5 / 4][scalar_offset_5 % 4]);
+    x_GLF_color = float4(float(x_122), float(x_125), float(x_128), float(x_131));
+  } else {
+    const int x_135 = asint(x_10[1].x);
+    const float x_136 = float(x_135);
+    x_GLF_color = float4(x_136, x_136, x_136, x_136);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_5 = {x_GLF_color};
+  return tint_symbol_5;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000017C45B3F9B0(20,10-21): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..535c006
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,64 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int a = 0;
+  int i = 0;
+  const int x_27 = asint(x_6[3].x);
+  a = x_27;
+  i = 0;
+  {
+    [loop] for(; (i < 3); i = (i + 1)) {
+      const int x_35 = i;
+      const int x_37 = asint(x_6[1].x);
+      if ((x_35 == x_37)) {
+        a = (a + 1);
+      } else {
+        a = (a / i);
+      }
+    }
+  }
+  const int x_49 = a;
+  const int x_51 = asint(x_6[2].x);
+  if ((x_49 == x_51)) {
+    const uint scalar_offset = ((16u * uint(0))) / 4;
+    const int x_57 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
+    const int x_60 = asint(x_6[1].x);
+    const int x_63 = asint(x_6[1].x);
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const int x_66 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+    x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_66));
+  } else {
+    const int x_70 = asint(x_6[1].x);
+    const float x_71 = float(x_70);
+    x_GLF_color = float4(x_71, x_71, x_71, x_71);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000150DB0FB4A0(19,14-18): error X4010: Unsigned integer divide by zero
+C:\src\tint\test\Shader@0x00000150DB0FB4A0(19,14-18): warning X3556: integer divides may be much slower, try using uints if possible.
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..c8f9a07
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-increment-or-divide-by-loop-index/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,64 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int a = 0;
+  int i = 0;
+  const int x_27 = asint(x_6[3].x);
+  a = x_27;
+  i = 0;
+  {
+    [loop] for(; (i < 3); i = (i + 1)) {
+      const int x_35 = i;
+      const int x_37 = asint(x_6[1].x);
+      if ((x_35 == x_37)) {
+        a = (a + 1);
+      } else {
+        a = (a / i);
+      }
+    }
+  }
+  const int x_49 = a;
+  const int x_51 = asint(x_6[2].x);
+  if ((x_49 == x_51)) {
+    const uint scalar_offset = ((16u * uint(0))) / 4;
+    const int x_57 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
+    const int x_60 = asint(x_6[1].x);
+    const int x_63 = asint(x_6[1].x);
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const int x_66 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+    x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_66));
+  } else {
+    const int x_70 = asint(x_6[1].x);
+    const float x_71 = float(x_70);
+    x_GLF_color = float4(x_71, x_71, x_71, x_71);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001A53C9E4360(19,14-18): error X4010: Unsigned integer divide by zero
+C:\src\tint\test\Shader@0x000001A53C9E4360(19,14-18): warning X3556: integer divides may be much slower, try using uints if possible.
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..1589466
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,72 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_8 : register(b2, space0) {
+  uint4 x_8[2];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_10 : register(b0, space0) {
+  uint4 x_10[1];
+};
+cbuffer cbuffer_x_12 : register(b1, space0) {
+  uint4 x_12[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  uint a = 0u;
+  int b = 0;
+  a = 0u;
+  const int x_41 = asint(x_8[1].x);
+  b = x_41;
+  const float x_43 = gl_FragCoord.x;
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const float x_45 = asfloat(x_10[scalar_offset / 4][scalar_offset % 4]);
+  if ((x_43 < x_45)) {
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const uint x_50 = x_12[scalar_offset_1 / 4][scalar_offset_1 % 4];
+    b = asint((x_50 % a));
+  }
+  const int x_54 = b;
+  const int x_56 = asint(x_8[1].x);
+  if ((x_54 == x_56)) {
+    const int x_62 = asint(x_8[1].x);
+    const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+    const int x_65 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+    const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+    const int x_68 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+    const int x_71 = asint(x_8[1].x);
+    x_GLF_color = float4(float(x_62), float(x_65), float(x_68), float(x_71));
+  } else {
+    const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+    const int x_75 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+    const float x_76 = float(x_75);
+    x_GLF_color = float4(x_76, x_76, x_76, x_76);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_6 = {x_GLF_color};
+  return tint_symbol_6;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002533EADD8C0(25,16-23): error X4010: Unsigned integer divide by zero
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..4cecdf3
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-modulo-zero-never-executed/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,72 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_8 : register(b2, space0) {
+  uint4 x_8[2];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_10 : register(b0, space0) {
+  uint4 x_10[1];
+};
+cbuffer cbuffer_x_12 : register(b1, space0) {
+  uint4 x_12[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  uint a = 0u;
+  int b = 0;
+  a = 0u;
+  const int x_41 = asint(x_8[1].x);
+  b = x_41;
+  const float x_43 = gl_FragCoord.x;
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const float x_45 = asfloat(x_10[scalar_offset / 4][scalar_offset % 4]);
+  if ((x_43 < x_45)) {
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const uint x_50 = x_12[scalar_offset_1 / 4][scalar_offset_1 % 4];
+    b = asint((x_50 % a));
+  }
+  const int x_54 = b;
+  const int x_56 = asint(x_8[1].x);
+  if ((x_54 == x_56)) {
+    const int x_62 = asint(x_8[1].x);
+    const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+    const int x_65 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+    const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+    const int x_68 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+    const int x_71 = asint(x_8[1].x);
+    x_GLF_color = float4(float(x_62), float(x_65), float(x_68), float(x_71));
+  } else {
+    const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+    const int x_75 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+    const float x_76 = float(x_75);
+    x_GLF_color = float4(x_76, x_76, x_76, x_76);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_6 = {x_GLF_color};
+  return tint_symbol_6;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000026AFDC08170(25,16-23): error X4010: Unsigned integer divide by zero
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..cfed15c
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,334 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+void set_float4(inout float4 vec, int idx, float val) {
+  vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+void set_float2(inout float2 vec, int idx, float val) {
+  vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
+}
+
+static int x_GLF_global_loop_count = 0;
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float2x4 m24 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float3x3 m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float3x4 m34 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float4x2 m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int i = 0;
+  int i_1 = 0;
+  int i_2 = 0;
+  int i_3 = 0;
+  int i_4 = 0;
+  int i_5 = 0;
+  int i_6 = 0;
+  int i_7 = 0;
+  int i_8 = 0;
+  int i_9 = 0;
+  int i_10 = 0;
+  int i_11 = 0;
+  int i_12 = 0;
+  int i_13 = 0;
+  int i_14 = 0;
+  int i_15 = 0;
+  int i_16 = 0;
+  int i_17 = 0;
+  int i_18 = 0;
+  int i_19 = 0;
+  int i_20 = 0;
+  int i_21 = 0;
+  int i_22 = 0;
+  int i_23 = 0;
+  int i_24 = 0;
+  int i_25 = 0;
+  int i_26 = 0;
+  int i_27 = 0;
+  int i_28 = 0;
+  int i_29 = 0;
+  int i_30 = 0;
+  int i_31 = 0;
+  int i_32 = 0;
+  int i_33 = 0;
+  int i_34 = 0;
+  int i_35 = 0;
+  int i_36 = 0;
+  int i_37 = 0;
+  float sum = 0.0f;
+  int r = 0;
+  x_GLF_global_loop_count = 0;
+  m23 = float2x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
+  m24 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
+  m32 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
+  m33 = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
+  m34 = float3x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
+  m42 = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
+  m43 = float4x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
+  m44 = float4x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
+  i = 0;
+  {
+    [loop] for(; (i < 1); i = (i + 1)) {
+      i_1 = 0;
+      {
+        [loop] for(; (i_1 < 1); i_1 = (i_1 + 1)) {
+          i_2 = 0;
+          {
+            [loop] for(; (i_2 < 1); i_2 = (i_2 + 1)) {
+              i_3 = 0;
+              {
+                [loop] for(; (i_3 < 1); i_3 = (i_3 + 1)) {
+                  i_4 = 0;
+                  {
+                    [loop] for(; (i_4 < 1); i_4 = (i_4 + 1)) {
+                      i_5 = 0;
+                      {
+                        [loop] for(; (i_5 < 1); i_5 = (i_5 + 1)) {
+                          i_6 = 0;
+                          {
+                            [loop] for(; (i_6 < 1); i_6 = (i_6 + 1)) {
+                              i_7 = 0;
+                              {
+                                [loop] for(; (i_7 < 1); i_7 = (i_7 + 1)) {
+                                  i_8 = 0;
+                                  {
+                                    [loop] for(; (i_8 < 1); i_8 = (i_8 + 1)) {
+                                      i_9 = 0;
+                                      {
+                                        [loop] for(; (i_9 < 1); i_9 = (i_9 + 1)) {
+                                          i_10 = 0;
+                                          {
+                                            [loop] for(; (i_10 < 1); i_10 = (i_10 + 1)) {
+                                              i_11 = 0;
+                                              {
+                                                [loop] for(; (i_11 < 1); i_11 = (i_11 + 1)) {
+                                                  i_12 = 0;
+                                                  {
+                                                    [loop] for(; (i_12 < 1); i_12 = (i_12 + 1)) {
+                                                      i_13 = 0;
+                                                      {
+                                                        [loop] for(; (i_13 < 1); i_13 = (i_13 + 1)) {
+                                                          i_14 = 0;
+                                                          {
+                                                            [loop] for(; (i_14 < 1); i_14 = (i_14 + 1)) {
+                                                              i_15 = 0;
+                                                              {
+                                                                [loop] for(; (i_15 < 1); i_15 = (i_15 + 1)) {
+                                                                  i_16 = 0;
+                                                                  {
+                                                                    [loop] for(; (i_16 < 1); i_16 = (i_16 + 1)) {
+                                                                      i_17 = 0;
+                                                                      {
+                                                                        [loop] for(; (i_17 < 1); i_17 = (i_17 + 1)) {
+                                                                          i_18 = 0;
+                                                                          {
+                                                                            [loop] for(; (i_18 < 1); i_18 = (i_18 + 1)) {
+                                                                              i_19 = 0;
+                                                                              {
+                                                                                [loop] for(; (i_19 < 1); i_19 = (i_19 + 1)) {
+                                                                                  i_20 = 0;
+                                                                                  {
+                                                                                    [loop] for(; (i_20 < 1); i_20 = (i_20 + 1)) {
+                                                                                      i_21 = 0;
+                                                                                      {
+                                                                                        [loop] for(; (i_21 < 1); i_21 = (i_21 + 1)) {
+                                                                                          i_22 = 0;
+                                                                                          {
+                                                                                            [loop] for(; (i_22 < 1); i_22 = (i_22 + 1)) {
+                                                                                              i_23 = 0;
+                                                                                              {
+                                                                                                [loop] for(; (i_23 < 1); i_23 = (i_23 + 1)) {
+                                                                                                  i_24 = 0;
+                                                                                                  {
+                                                                                                    [loop] for(; (i_24 < 1); i_24 = (i_24 + 1)) {
+                                                                                                      i_25 = 0;
+                                                                                                      {
+                                                                                                        [loop] for(; (i_25 < 1); i_25 = (i_25 + 1)) {
+                                                                                                          i_26 = 0;
+                                                                                                          {
+                                                                                                            [loop] for(; (i_26 < 1); i_26 = (i_26 + 1)) {
+                                                                                                              i_27 = 0;
+                                                                                                              {
+                                                                                                                [loop] for(; (i_27 < 1); i_27 = (i_27 + 1)) {
+                                                                                                                  i_28 = 0;
+                                                                                                                  {
+                                                                                                                    [loop] for(; (i_28 < 1); i_28 = (i_28 + 1)) {
+                                                                                                                      i_29 = 0;
+                                                                                                                      {
+                                                                                                                        [loop] for(; (i_29 < 1); i_29 = (i_29 + 1)) {
+                                                                                                                          i_30 = 0;
+                                                                                                                          {
+                                                                                                                            [loop] for(; (i_30 < 1); i_30 = (i_30 + 1)) {
+                                                                                                                              i_31 = 0;
+                                                                                                                              {
+                                                                                                                                [loop] for(; (i_31 < 1); i_31 = (i_31 + 1)) {
+                                                                                                                                  i_32 = 0;
+                                                                                                                                  {
+                                                                                                                                    [loop] for(; (i_32 < 1); i_32 = (i_32 + 1)) {
+                                                                                                                                      i_33 = 0;
+                                                                                                                                      {
+                                                                                                                                        [loop] for(; (i_33 < 1); i_33 = (i_33 + 1)) {
+                                                                                                                                          i_34 = 0;
+                                                                                                                                          {
+                                                                                                                                            [loop] for(; (i_34 < 1); i_34 = (i_34 + 1)) {
+                                                                                                                                              i_35 = 0;
+                                                                                                                                              {
+                                                                                                                                                [loop] for(; (i_35 < 1); i_35 = (i_35 + 1)) {
+                                                                                                                                                  i_36 = 0;
+                                                                                                                                                  {
+                                                                                                                                                    [loop] for(; (i_36 < 1); i_36 = (i_36 + 1)) {
+                                                                                                                                                      i_37 = 0;
+                                                                                                                                                      {
+                                                                                                                                                        [loop] for(; (i_37 < 1); i_37 = (i_37 + 1)) {
+                                                                                                                                                          [loop] while (true) {
+                                                                                                                                                            x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
+                                                                                                                                                            {
+                                                                                                                                                              if ((x_GLF_global_loop_count < 98)) {
+                                                                                                                                                              } else {
+                                                                                                                                                                break;
+                                                                                                                                                              }
+                                                                                                                                                            }
+                                                                                                                                                          }
+                                                                                                                                                          set_float3(m23[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float4(m24[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float2(m32[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float3(m33[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float4(m34[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float2(m42[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float3(m43[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float4(m44[i_37], i_37, 1.0f);
+                                                                                                                                                        }
+                                                                                                                                                      }
+                                                                                                                                                    }
+                                                                                                                                                  }
+                                                                                                                                                }
+                                                                                                                                              }
+                                                                                                                                            }
+                                                                                                                                          }
+                                                                                                                                        }
+                                                                                                                                      }
+                                                                                                                                    }
+                                                                                                                                  }
+                                                                                                                                }
+                                                                                                                              }
+                                                                                                                            }
+                                                                                                                          }
+                                                                                                                        }
+                                                                                                                      }
+                                                                                                                    }
+                                                                                                                  }
+                                                                                                                }
+                                                                                                              }
+                                                                                                            }
+                                                                                                          }
+                                                                                                        }
+                                                                                                      }
+                                                                                                    }
+                                                                                                  }
+                                                                                                }
+                                                                                              }
+                                                                                            }
+                                                                                          }
+                                                                                        }
+                                                                                      }
+                                                                                    }
+                                                                                  }
+                                                                                }
+                                                                              }
+                                                                            }
+                                                                          }
+                                                                        }
+                                                                      }
+                                                                    }
+                                                                  }
+                                                                }
+                                                              }
+                                                            }
+                                                          }
+                                                        }
+                                                      }
+                                                    }
+                                                  }
+                                                }
+                                              }
+                                            }
+                                          }
+                                        }
+                                      }
+                                    }
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  sum = 0.0f;
+  r = 0;
+  {
+    [loop] for(; (x_GLF_global_loop_count < 100); r = (r + 1)) {
+      x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
+      const float x_486 = m23[0][r];
+      sum = (sum + x_486);
+      const float x_491 = m24[0][r];
+      sum = (sum + x_491);
+      const float x_496 = m32[0][r];
+      sum = (sum + x_496);
+      const float x_501 = m33[0][r];
+      sum = (sum + x_501);
+      const float x_506 = m34[0][r];
+      sum = (sum + x_506);
+      const float x_511 = m42[0][r];
+      sum = (sum + x_511);
+      const float x_516 = m43[0][r];
+      sum = (sum + x_516);
+      const float x_521 = m44[0][r];
+      sum = (sum + x_521);
+    }
+  }
+  if ((sum == 8.0f)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001DD183F6C40(187,160-195): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..1b87903
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-multiple-one-iteration-loops-global-counter-write-matrices/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,334 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+void set_float4(inout float4 vec, int idx, float val) {
+  vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+void set_float2(inout float2 vec, int idx, float val) {
+  vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
+}
+
+static int x_GLF_global_loop_count = 0;
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float2x3 m23 = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float2x4 m24 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float3x2 m32 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float3x3 m33 = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float3x4 m34 = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float4x2 m42 = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int i = 0;
+  int i_1 = 0;
+  int i_2 = 0;
+  int i_3 = 0;
+  int i_4 = 0;
+  int i_5 = 0;
+  int i_6 = 0;
+  int i_7 = 0;
+  int i_8 = 0;
+  int i_9 = 0;
+  int i_10 = 0;
+  int i_11 = 0;
+  int i_12 = 0;
+  int i_13 = 0;
+  int i_14 = 0;
+  int i_15 = 0;
+  int i_16 = 0;
+  int i_17 = 0;
+  int i_18 = 0;
+  int i_19 = 0;
+  int i_20 = 0;
+  int i_21 = 0;
+  int i_22 = 0;
+  int i_23 = 0;
+  int i_24 = 0;
+  int i_25 = 0;
+  int i_26 = 0;
+  int i_27 = 0;
+  int i_28 = 0;
+  int i_29 = 0;
+  int i_30 = 0;
+  int i_31 = 0;
+  int i_32 = 0;
+  int i_33 = 0;
+  int i_34 = 0;
+  int i_35 = 0;
+  int i_36 = 0;
+  int i_37 = 0;
+  float sum = 0.0f;
+  int r = 0;
+  x_GLF_global_loop_count = 0;
+  m23 = float2x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
+  m24 = float2x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
+  m32 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
+  m33 = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
+  m34 = float3x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
+  m42 = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
+  m43 = float4x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
+  m44 = float4x4(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
+  i = 0;
+  {
+    [loop] for(; (i < 1); i = (i + 1)) {
+      i_1 = 0;
+      {
+        [loop] for(; (i_1 < 1); i_1 = (i_1 + 1)) {
+          i_2 = 0;
+          {
+            [loop] for(; (i_2 < 1); i_2 = (i_2 + 1)) {
+              i_3 = 0;
+              {
+                [loop] for(; (i_3 < 1); i_3 = (i_3 + 1)) {
+                  i_4 = 0;
+                  {
+                    [loop] for(; (i_4 < 1); i_4 = (i_4 + 1)) {
+                      i_5 = 0;
+                      {
+                        [loop] for(; (i_5 < 1); i_5 = (i_5 + 1)) {
+                          i_6 = 0;
+                          {
+                            [loop] for(; (i_6 < 1); i_6 = (i_6 + 1)) {
+                              i_7 = 0;
+                              {
+                                [loop] for(; (i_7 < 1); i_7 = (i_7 + 1)) {
+                                  i_8 = 0;
+                                  {
+                                    [loop] for(; (i_8 < 1); i_8 = (i_8 + 1)) {
+                                      i_9 = 0;
+                                      {
+                                        [loop] for(; (i_9 < 1); i_9 = (i_9 + 1)) {
+                                          i_10 = 0;
+                                          {
+                                            [loop] for(; (i_10 < 1); i_10 = (i_10 + 1)) {
+                                              i_11 = 0;
+                                              {
+                                                [loop] for(; (i_11 < 1); i_11 = (i_11 + 1)) {
+                                                  i_12 = 0;
+                                                  {
+                                                    [loop] for(; (i_12 < 1); i_12 = (i_12 + 1)) {
+                                                      i_13 = 0;
+                                                      {
+                                                        [loop] for(; (i_13 < 1); i_13 = (i_13 + 1)) {
+                                                          i_14 = 0;
+                                                          {
+                                                            [loop] for(; (i_14 < 1); i_14 = (i_14 + 1)) {
+                                                              i_15 = 0;
+                                                              {
+                                                                [loop] for(; (i_15 < 1); i_15 = (i_15 + 1)) {
+                                                                  i_16 = 0;
+                                                                  {
+                                                                    [loop] for(; (i_16 < 1); i_16 = (i_16 + 1)) {
+                                                                      i_17 = 0;
+                                                                      {
+                                                                        [loop] for(; (i_17 < 1); i_17 = (i_17 + 1)) {
+                                                                          i_18 = 0;
+                                                                          {
+                                                                            [loop] for(; (i_18 < 1); i_18 = (i_18 + 1)) {
+                                                                              i_19 = 0;
+                                                                              {
+                                                                                [loop] for(; (i_19 < 1); i_19 = (i_19 + 1)) {
+                                                                                  i_20 = 0;
+                                                                                  {
+                                                                                    [loop] for(; (i_20 < 1); i_20 = (i_20 + 1)) {
+                                                                                      i_21 = 0;
+                                                                                      {
+                                                                                        [loop] for(; (i_21 < 1); i_21 = (i_21 + 1)) {
+                                                                                          i_22 = 0;
+                                                                                          {
+                                                                                            [loop] for(; (i_22 < 1); i_22 = (i_22 + 1)) {
+                                                                                              i_23 = 0;
+                                                                                              {
+                                                                                                [loop] for(; (i_23 < 1); i_23 = (i_23 + 1)) {
+                                                                                                  i_24 = 0;
+                                                                                                  {
+                                                                                                    [loop] for(; (i_24 < 1); i_24 = (i_24 + 1)) {
+                                                                                                      i_25 = 0;
+                                                                                                      {
+                                                                                                        [loop] for(; (i_25 < 1); i_25 = (i_25 + 1)) {
+                                                                                                          i_26 = 0;
+                                                                                                          {
+                                                                                                            [loop] for(; (i_26 < 1); i_26 = (i_26 + 1)) {
+                                                                                                              i_27 = 0;
+                                                                                                              {
+                                                                                                                [loop] for(; (i_27 < 1); i_27 = (i_27 + 1)) {
+                                                                                                                  i_28 = 0;
+                                                                                                                  {
+                                                                                                                    [loop] for(; (i_28 < 1); i_28 = (i_28 + 1)) {
+                                                                                                                      i_29 = 0;
+                                                                                                                      {
+                                                                                                                        [loop] for(; (i_29 < 1); i_29 = (i_29 + 1)) {
+                                                                                                                          i_30 = 0;
+                                                                                                                          {
+                                                                                                                            [loop] for(; (i_30 < 1); i_30 = (i_30 + 1)) {
+                                                                                                                              i_31 = 0;
+                                                                                                                              {
+                                                                                                                                [loop] for(; (i_31 < 1); i_31 = (i_31 + 1)) {
+                                                                                                                                  i_32 = 0;
+                                                                                                                                  {
+                                                                                                                                    [loop] for(; (i_32 < 1); i_32 = (i_32 + 1)) {
+                                                                                                                                      i_33 = 0;
+                                                                                                                                      {
+                                                                                                                                        [loop] for(; (i_33 < 1); i_33 = (i_33 + 1)) {
+                                                                                                                                          i_34 = 0;
+                                                                                                                                          {
+                                                                                                                                            [loop] for(; (i_34 < 1); i_34 = (i_34 + 1)) {
+                                                                                                                                              i_35 = 0;
+                                                                                                                                              {
+                                                                                                                                                [loop] for(; (i_35 < 1); i_35 = (i_35 + 1)) {
+                                                                                                                                                  i_36 = 0;
+                                                                                                                                                  {
+                                                                                                                                                    [loop] for(; (i_36 < 1); i_36 = (i_36 + 1)) {
+                                                                                                                                                      i_37 = 0;
+                                                                                                                                                      {
+                                                                                                                                                        [loop] for(; (i_37 < 1); i_37 = (i_37 + 1)) {
+                                                                                                                                                          [loop] while (true) {
+                                                                                                                                                            x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
+                                                                                                                                                            {
+                                                                                                                                                              if ((x_GLF_global_loop_count < 98)) {
+                                                                                                                                                              } else {
+                                                                                                                                                                break;
+                                                                                                                                                              }
+                                                                                                                                                            }
+                                                                                                                                                          }
+                                                                                                                                                          set_float3(m23[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float4(m24[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float2(m32[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float3(m33[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float4(m34[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float2(m42[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float3(m43[i_37], i_37, 1.0f);
+                                                                                                                                                          set_float4(m44[i_37], i_37, 1.0f);
+                                                                                                                                                        }
+                                                                                                                                                      }
+                                                                                                                                                    }
+                                                                                                                                                  }
+                                                                                                                                                }
+                                                                                                                                              }
+                                                                                                                                            }
+                                                                                                                                          }
+                                                                                                                                        }
+                                                                                                                                      }
+                                                                                                                                    }
+                                                                                                                                  }
+                                                                                                                                }
+                                                                                                                              }
+                                                                                                                            }
+                                                                                                                          }
+                                                                                                                        }
+                                                                                                                      }
+                                                                                                                    }
+                                                                                                                  }
+                                                                                                                }
+                                                                                                              }
+                                                                                                            }
+                                                                                                          }
+                                                                                                        }
+                                                                                                      }
+                                                                                                    }
+                                                                                                  }
+                                                                                                }
+                                                                                              }
+                                                                                            }
+                                                                                          }
+                                                                                        }
+                                                                                      }
+                                                                                    }
+                                                                                  }
+                                                                                }
+                                                                              }
+                                                                            }
+                                                                          }
+                                                                        }
+                                                                      }
+                                                                    }
+                                                                  }
+                                                                }
+                                                              }
+                                                            }
+                                                          }
+                                                        }
+                                                      }
+                                                    }
+                                                  }
+                                                }
+                                              }
+                                            }
+                                          }
+                                        }
+                                      }
+                                    }
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  sum = 0.0f;
+  r = 0;
+  {
+    [loop] for(; (x_GLF_global_loop_count < 100); r = (r + 1)) {
+      x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
+      const float x_486 = m23[0][r];
+      sum = (sum + x_486);
+      const float x_491 = m24[0][r];
+      sum = (sum + x_491);
+      const float x_496 = m32[0][r];
+      sum = (sum + x_496);
+      const float x_501 = m33[0][r];
+      sum = (sum + x_501);
+      const float x_506 = m34[0][r];
+      sum = (sum + x_506);
+      const float x_511 = m42[0][r];
+      sum = (sum + x_511);
+      const float x_516 = m43[0][r];
+      sum = (sum + x_516);
+      const float x_521 = m44[0][r];
+      sum = (sum + x_521);
+    }
+  }
+  if ((sum == 8.0f)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000295E0FBF060(187,160-195): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..20ec5cd
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,3 @@
+SKIP: FAILED
+
+test timed out after 30s
\ No newline at end of file
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..20ec5cd
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-nested-loops-global-loop-counter-do-while-accumulate-float/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,3 @@
+SKIP: FAILED
+
+test timed out after 30s
\ No newline at end of file
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..3b595c3
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,97 @@
+SKIP: FAILED
+
+void set_float2(inout float2 vec, int idx, float val) {
+  vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
+}
+
+cbuffer cbuffer_x_5 : register(b0, space0) {
+  uint4 x_5[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
+  float f = 0.0f;
+  int i = 0;
+  int j = 0;
+  const int x_36 = asint(x_5[1].x);
+  if ((x_36 == 1)) {
+    const float x_40 = f;
+    m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40));
+  }
+  const int x_45 = asint(x_5[1].x);
+  i = x_45;
+  [loop] while (true) {
+    const int x_50 = i;
+    const uint scalar_offset = ((16u * uint(0))) / 4;
+    const int x_52 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
+    if ((x_50 < x_52)) {
+    } else {
+      break;
+    }
+    const int x_56 = asint(x_5[1].x);
+    j = x_56;
+    [loop] while (true) {
+      const int x_61 = j;
+      const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+      const int x_63 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+      if ((x_61 < x_63)) {
+      } else {
+        break;
+      }
+      const int x_66 = i;
+      const int x_67 = j;
+      const int x_68 = i;
+      const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+      const int x_70 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+      set_float2(m[x_66], x_67, float(((x_68 * x_70) + j)));
+      {
+        j = (j + 1);
+      }
+    }
+    {
+      i = (i + 1);
+    }
+  }
+  const float2x2 x_80 = m;
+  const int x_82 = asint(x_5[1].x);
+  const int x_85 = asint(x_5[2].x);
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const int x_88 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const int x_91 = asint(x_5[3].x);
+  const float2x2 x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91)));
+  if ((all((x_80[0u] == x_95[0u])) & all((x_80[1u] == x_95[1u])))) {
+    const int x_109 = asint(x_5[2].x);
+    const int x_112 = asint(x_5[1].x);
+    const int x_115 = asint(x_5[1].x);
+    const int x_118 = asint(x_5[2].x);
+    x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118));
+  } else {
+    const int x_122 = asint(x_5[1].x);
+    const float x_123 = float(x_122);
+    x_GLF_color = float4(x_123, x_123, x_123, x_123);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000027B69224CC0(32,12-23): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..694f101
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-reinitialize-matrix-after-undefined-value/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,101 @@
+SKIP: FAILED
+
+void set_float2(inout float2 vec, int idx, float val) {
+  vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
+}
+
+cbuffer cbuffer_x_5 : register(b0, space0) {
+  uint4 x_5[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
+  float f = 0.0f;
+  int i = 0;
+  int j = 0;
+  const int x_36 = asint(x_5[1].x);
+  if ((x_36 == 1)) {
+    const float x_40 = f;
+    m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40));
+  }
+  const int x_45 = asint(x_5[1].x);
+  i = x_45;
+  [loop] while (true) {
+    const int x_50 = i;
+    const uint scalar_offset = ((16u * uint(0))) / 4;
+    const int x_52 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
+    if ((x_50 < x_52)) {
+    } else {
+      break;
+    }
+    const int x_56 = asint(x_5[1].x);
+    j = x_56;
+    [loop] while (true) {
+      const int x_61 = j;
+      const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+      const int x_63 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+      if ((x_61 < x_63)) {
+      } else {
+        break;
+      }
+      const int x_66 = i;
+      const int x_67 = j;
+      const int x_68 = i;
+      const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+      const int x_70 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+      set_float2(m[x_66], x_67, float(((x_68 * x_70) + j)));
+      {
+        j = (j + 1);
+      }
+    }
+    {
+      i = (i + 1);
+    }
+  }
+  const float2x2 x_80 = m;
+  const int x_82 = asint(x_5[1].x);
+  const int x_85 = asint(x_5[2].x);
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const int x_88 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const int x_91 = asint(x_5[3].x);
+  const float2x2 x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91)));
+  bool tint_tmp = all((x_80[0u] == x_95[0u]));
+  if (tint_tmp) {
+    tint_tmp = all((x_80[1u] == x_95[1u]));
+  }
+  if ((tint_tmp)) {
+    const int x_109 = asint(x_5[2].x);
+    const int x_112 = asint(x_5[1].x);
+    const int x_115 = asint(x_5[1].x);
+    const int x_118 = asint(x_5[2].x);
+    x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118));
+  } else {
+    const int x_122 = asint(x_5[1].x);
+    const float x_123 = float(x_122);
+    x_GLF_color = float4(x_123, x_123, x_123, x_123);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000019F4EA2D3B0(32,12-23): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..b0131b4
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,60 @@
+SKIP: FAILED
+
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_5 : register(b0, space0) {
+  uint4 x_5[2];
+};
+
+void main_1() {
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
+  const int x_25 = asint(x_5[1].x);
+  const int x_28 = asint(x_5[1].x);
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const int x_31 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  x_GLF_color = float4(float(x_22), float(x_25), float(x_28), float(x_31));
+  const int x_35 = asint(x_5[1].x);
+  const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+  const int x_37 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+  if ((x_35 > x_37)) {
+    [loop] while (true) {
+      const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+      const int x_46 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+      const float x_47 = float(x_46);
+      x_GLF_color = float4(x_47, x_47, x_47, x_47);
+      {
+        const int x_50 = asint(x_5[1].x);
+        const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+        const int x_52 = asint(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+        if ((x_50 > x_52)) {
+        } else {
+          break;
+        }
+      }
+    }
+    return;
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002307D6F3EA0(18,19-22): error X3696: infinite loop detected - loop never exits
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..721c4f2
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-return-after-do-while/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,60 @@
+SKIP: FAILED
+
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_5 : register(b0, space0) {
+  uint4 x_5[2];
+};
+
+void main_1() {
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_22 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
+  const int x_25 = asint(x_5[1].x);
+  const int x_28 = asint(x_5[1].x);
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const int x_31 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  x_GLF_color = float4(float(x_22), float(x_25), float(x_28), float(x_31));
+  const int x_35 = asint(x_5[1].x);
+  const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+  const int x_37 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+  if ((x_35 > x_37)) {
+    [loop] while (true) {
+      const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+      const int x_46 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+      const float x_47 = float(x_46);
+      x_GLF_color = float4(x_47, x_47, x_47, x_47);
+      {
+        const int x_50 = asint(x_5[1].x);
+        const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+        const int x_52 = asint(x_5[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+        if ((x_50 > x_52)) {
+        } else {
+          break;
+        }
+      }
+    }
+    return;
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001AB97856630(18,19-22): error X3696: infinite loop detected - loop never exits
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..f9ef66b
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,94 @@
+SKIP: FAILED
+
+struct S {
+  float numbers[3];
+};
+
+cbuffer cbuffer_x_7 : register(b1, space0) {
+  uint4 x_7[5];
+};
+cbuffer cbuffer_x_9 : register(b2, space0) {
+  uint4 x_9[1];
+};
+cbuffer cbuffer_x_12 : register(b3, space0) {
+  uint4 x_12[1];
+};
+cbuffer cbuffer_x_15 : register(b0, space0) {
+  uint4 x_15[2];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  S obj = (S)0;
+  float a = 0.0f;
+  float2 x_49 = float2(0.0f, 0.0f);
+  float b = 0.0f;
+  const float x_51 = asfloat(x_7[3].x);
+  const float x_53 = asfloat(x_7[2].x);
+  const float x_55 = asfloat(x_7[4].x);
+  const float tint_symbol_6[3] = {x_51, x_53, x_55};
+  const S tint_symbol_7 = {tint_symbol_6};
+  obj = tint_symbol_7;
+  const float x_59 = asfloat(x_9[0].x);
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const float x_62 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]);
+  obj.numbers[int(x_59)] = x_62;
+  const float x_65 = asfloat(x_9[0].x);
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const float x_67 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  if ((x_65 > x_67)) {
+    const float2 x_73 = asfloat(x_9[0].xy);
+    x_49 = x_73;
+  } else {
+    const float2 x_75 = asfloat(x_12[0].xy);
+    x_49 = x_75;
+  }
+  const float x_77 = x_49.y;
+  a = x_77;
+  const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+  const float x_79 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+  const float x_80 = a;
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const int x_82 = asint(x_15[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const float x_84 = obj.numbers[x_82];
+  b = lerp(x_79, x_80, x_84);
+  const float x_86 = b;
+  const float x_88 = asfloat(x_7[2].x);
+  const float x_91 = asfloat(x_7[1].x);
+  if ((distance(x_86, x_88) < x_91)) {
+    const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+    const int x_97 = asint(x_15[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+    const int x_100 = asint(x_15[1].x);
+    const int x_103 = asint(x_15[1].x);
+    const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+    const int x_106 = asint(x_15[scalar_offset_5 / 4][scalar_offset_5 % 4]);
+    x_GLF_color = float4(float(x_97), float(x_100), float(x_103), float(x_106));
+  } else {
+    const int x_110 = asint(x_15[1].x);
+    const float x_111 = float(x_110);
+    x_GLF_color = float4(x_111, x_111, x_111, x_111);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_8 = {x_GLF_color};
+  return tint_symbol_8;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000018BDF85D170(33,3-24): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..1457ead
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-struct-float-array-mix-uniform-vectors/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,94 @@
+SKIP: FAILED
+
+struct S {
+  float numbers[3];
+};
+
+cbuffer cbuffer_x_7 : register(b1, space0) {
+  uint4 x_7[5];
+};
+cbuffer cbuffer_x_9 : register(b2, space0) {
+  uint4 x_9[1];
+};
+cbuffer cbuffer_x_12 : register(b3, space0) {
+  uint4 x_12[1];
+};
+cbuffer cbuffer_x_15 : register(b0, space0) {
+  uint4 x_15[2];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  S obj = (S)0;
+  float a = 0.0f;
+  float2 x_49 = float2(0.0f, 0.0f);
+  float b = 0.0f;
+  const float x_51 = asfloat(x_7[3].x);
+  const float x_53 = asfloat(x_7[2].x);
+  const float x_55 = asfloat(x_7[4].x);
+  const float tint_symbol_6[3] = {x_51, x_53, x_55};
+  const S tint_symbol_7 = {tint_symbol_6};
+  obj = tint_symbol_7;
+  const float x_59 = asfloat(x_9[0].x);
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const float x_62 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]);
+  obj.numbers[int(x_59)] = x_62;
+  const float x_65 = asfloat(x_9[0].x);
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const float x_67 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  if ((x_65 > x_67)) {
+    const float2 x_73 = asfloat(x_9[0].xy);
+    x_49 = x_73;
+  } else {
+    const float2 x_75 = asfloat(x_12[0].xy);
+    x_49 = x_75;
+  }
+  const float x_77 = x_49.y;
+  a = x_77;
+  const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+  const float x_79 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+  const float x_80 = a;
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const int x_82 = asint(x_15[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const float x_84 = obj.numbers[x_82];
+  b = lerp(x_79, x_80, x_84);
+  const float x_86 = b;
+  const float x_88 = asfloat(x_7[2].x);
+  const float x_91 = asfloat(x_7[1].x);
+  if ((distance(x_86, x_88) < x_91)) {
+    const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+    const int x_97 = asint(x_15[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+    const int x_100 = asint(x_15[1].x);
+    const int x_103 = asint(x_15[1].x);
+    const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+    const int x_106 = asint(x_15[scalar_offset_5 / 4][scalar_offset_5 % 4]);
+    x_GLF_color = float4(float(x_97), float(x_100), float(x_103), float(x_106));
+  } else {
+    const int x_110 = asint(x_15[1].x);
+    const float x_111 = float(x_110);
+    x_GLF_color = float4(x_111, x_111, x_111, x_111);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_8 = {x_GLF_color};
+  return tint_symbol_8;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000172CC1515F0(33,3-24): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl
index ef48576..7d32166 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.spvasm.expected.hlsl
@@ -20,7 +20,7 @@
   const uint scalar_offset_1 = ((16u * uint(0))) / 4;
   const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
   if ((x_41 > x_43)) {
-    while (true) {
+    [loop] while (true) {
       const float x_53 = asfloat(x_5[1].x);
       x_GLF_color = float4(x_53, x_53, x_53, x_53);
       {
@@ -31,15 +31,15 @@
       }
     }
   } else {
-    while (true) {
-      while (true) {
+    [loop] while (true) {
+      [loop] while (true) {
         if (true) {
         } else {
           break;
         }
         const int x_13 = asint(x_10[1].x);
         i = x_13;
-        while (true) {
+        [loop] while (true) {
           const int x_14 = i;
           const uint scalar_offset_2 = ((16u * uint(0))) / 4;
           const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]);
@@ -81,11 +81,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_5;
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
 }
-C:\src\tint\test\Shader@0x0000020495BF5060(21,12-15): error X3696: infinite loop detected - loop never exits
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002502549E0E0(21,19-22): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl
index a9573d8..c6eed98 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-tail-duplicator-infinite-loops/0-opt.wgsl.expected.hlsl
@@ -20,7 +20,7 @@
   const uint scalar_offset_1 = ((16u * uint(0))) / 4;
   const float x_43 = asfloat(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
   if ((x_41 > x_43)) {
-    while (true) {
+    [loop] while (true) {
       const float x_53 = asfloat(x_5[1].x);
       x_GLF_color = float4(x_53, x_53, x_53, x_53);
       {
@@ -31,15 +31,15 @@
       }
     }
   } else {
-    while (true) {
-      while (true) {
+    [loop] while (true) {
+      [loop] while (true) {
         if (true) {
         } else {
           break;
         }
         const int x_13 = asint(x_10[1].x);
         i = x_13;
-        while (true) {
+        [loop] while (true) {
           const int x_14 = i;
           const uint scalar_offset_2 = ((16u * uint(0))) / 4;
           const int x_15 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]);
@@ -81,11 +81,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_5;
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
 }
-C:\src\tint\test\Shader@0x0000020110131FE0(21,12-15): error X3696: infinite loop detected - loop never exits
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002497A3112E0(21,19-22): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..46469b7
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,119 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+struct tint_padded_array_element {
+  float el;
+};
+
+cbuffer cbuffer_x_6 : register(b1, space0) {
+  uint4 x_6[3];
+};
+cbuffer cbuffer_x_8 : register(b0, space0) {
+  uint4 x_8[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  tint_padded_array_element sums[3] = (tint_padded_array_element[3])0;
+  int i = 0;
+  int a = 0;
+  int x_67_phi = 0;
+  const float x_44 = asfloat(x_6[1].x);
+  const float3 x_48 = float3(0.0f, 0.0f, 0.0f);
+  m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), float3(0.0f, 0.0f, 0.0f));
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_51 = asint(x_8[scalar_offset / 4][scalar_offset % 4]);
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const int x_53 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+  const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+  set_float3(m43[x_51], x_53, x_55);
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+  const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+  const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+  const float x_62 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]);
+  const tint_padded_array_element tint_symbol_3[3] = {{x_58}, {x_60}, {x_62}};
+  sums = tint_symbol_3;
+  const uint scalar_offset_6 = ((16u * uint(0))) / 4;
+  const int x_65 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]);
+  i = x_65;
+  x_67_phi = x_65;
+  [loop] while (true) {
+    const int x_67 = x_67_phi;
+    const int x_73 = asint(x_8[3].x);
+    if ((x_67 < x_73)) {
+    } else {
+      break;
+    }
+    const uint scalar_offset_7 = ((16u * uint(0))) / 4;
+    const int x_77 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]);
+    const uint scalar_offset_8 = ((16u * uint(0))) / 4;
+    const int x_79 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]);
+    const float x_81 = m43[x_67][x_79];
+    const float x_83 = sums[x_77].el;
+    sums[x_77].el = (x_83 + x_81);
+    {
+      const int x_68 = (x_67 + 1);
+      i = x_68;
+      x_67_phi = x_68;
+    }
+  }
+  const int x_87 = asint(x_8[1].x);
+  if ((x_87 == 1)) {
+    a = 4;
+    const int x_92 = asint(x_8[2].x);
+    const uint scalar_offset_9 = ((16u * uint(0))) / 4;
+    const int x_94 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]);
+    const float x_96 = m43[4][x_94];
+    const float x_98 = sums[x_92].el;
+    sums[x_92].el = (x_98 + x_96);
+  }
+  const int x_102 = asint(x_8[1].x);
+  const float x_104 = sums[x_102].el;
+  const uint scalar_offset_10 = ((16u * uint(0))) / 4;
+  const int x_106 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]);
+  const float x_108 = sums[x_106].el;
+  const float x_111 = asfloat(x_6[2].x);
+  if (((x_104 + x_108) == x_111)) {
+    const uint scalar_offset_11 = ((16u * uint(0))) / 4;
+    const int x_117 = asint(x_8[scalar_offset_11 / 4][scalar_offset_11 % 4]);
+    const int x_120 = asint(x_8[1].x);
+    const int x_123 = asint(x_8[1].x);
+    const uint scalar_offset_12 = ((16u * uint(0))) / 4;
+    const int x_126 = asint(x_8[scalar_offset_12 / 4][scalar_offset_12 % 4]);
+    x_GLF_color = float4(float(x_117), float(x_120), float(x_123), float(x_126));
+  } else {
+    const int x_130 = asint(x_8[1].x);
+    const float x_131 = float(x_130);
+    x_GLF_color = float4(x_131, x_131, x_131, x_131);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001DF1D9D5EE0(32,14-22): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..903d521
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-access-past-matrix-elements/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,119 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+struct tint_padded_array_element {
+  float el;
+};
+
+cbuffer cbuffer_x_6 : register(b1, space0) {
+  uint4 x_6[3];
+};
+cbuffer cbuffer_x_8 : register(b0, space0) {
+  uint4 x_8[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  tint_padded_array_element sums[3] = (tint_padded_array_element[3])0;
+  int i = 0;
+  int a = 0;
+  int x_67_phi = 0;
+  const float x_44 = asfloat(x_6[1].x);
+  const float3 x_48 = float3(0.0f, 0.0f, 0.0f);
+  m43 = float4x3(float3(x_44, 0.0f, 0.0f), float3(0.0f, x_44, 0.0f), float3(0.0f, 0.0f, x_44), float3(0.0f, 0.0f, 0.0f));
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_51 = asint(x_8[scalar_offset / 4][scalar_offset % 4]);
+  const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+  const int x_53 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+  const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+  const float x_55 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+  set_float3(m43[x_51], x_53, x_55);
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const float x_58 = asfloat(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+  const float x_60 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+  const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+  const float x_62 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]);
+  const tint_padded_array_element tint_symbol_3[3] = {{x_58}, {x_60}, {x_62}};
+  sums = tint_symbol_3;
+  const uint scalar_offset_6 = ((16u * uint(0))) / 4;
+  const int x_65 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]);
+  i = x_65;
+  x_67_phi = x_65;
+  [loop] while (true) {
+    const int x_67 = x_67_phi;
+    const int x_73 = asint(x_8[3].x);
+    if ((x_67 < x_73)) {
+    } else {
+      break;
+    }
+    const uint scalar_offset_7 = ((16u * uint(0))) / 4;
+    const int x_77 = asint(x_8[scalar_offset_7 / 4][scalar_offset_7 % 4]);
+    const uint scalar_offset_8 = ((16u * uint(0))) / 4;
+    const int x_79 = asint(x_8[scalar_offset_8 / 4][scalar_offset_8 % 4]);
+    const float x_81 = m43[x_67][x_79];
+    const float x_83 = sums[x_77].el;
+    sums[x_77].el = (x_83 + x_81);
+    {
+      const int x_68 = (x_67 + 1);
+      i = x_68;
+      x_67_phi = x_68;
+    }
+  }
+  const int x_87 = asint(x_8[1].x);
+  if ((x_87 == 1)) {
+    a = 4;
+    const int x_92 = asint(x_8[2].x);
+    const uint scalar_offset_9 = ((16u * uint(0))) / 4;
+    const int x_94 = asint(x_8[scalar_offset_9 / 4][scalar_offset_9 % 4]);
+    const float x_96 = m43[4][x_94];
+    const float x_98 = sums[x_92].el;
+    sums[x_92].el = (x_98 + x_96);
+  }
+  const int x_102 = asint(x_8[1].x);
+  const float x_104 = sums[x_102].el;
+  const uint scalar_offset_10 = ((16u * uint(0))) / 4;
+  const int x_106 = asint(x_8[scalar_offset_10 / 4][scalar_offset_10 % 4]);
+  const float x_108 = sums[x_106].el;
+  const float x_111 = asfloat(x_6[2].x);
+  if (((x_104 + x_108) == x_111)) {
+    const uint scalar_offset_11 = ((16u * uint(0))) / 4;
+    const int x_117 = asint(x_8[scalar_offset_11 / 4][scalar_offset_11 % 4]);
+    const int x_120 = asint(x_8[1].x);
+    const int x_123 = asint(x_8[1].x);
+    const uint scalar_offset_12 = ((16u * uint(0))) / 4;
+    const int x_126 = asint(x_8[scalar_offset_12 / 4][scalar_offset_12 % 4]);
+    x_GLF_color = float4(float(x_117), float(x_120), float(x_123), float(x_126));
+  } else {
+    const int x_130 = asint(x_8[1].x);
+    const float x_131 = float(x_130);
+    x_GLF_color = float4(x_131, x_131, x_131, x_131);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000020E5111BFA0(32,14-22): error X3500: array reference cannot be used as an l-value; not natively addressable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..9f84295
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,102 @@
+SKIP: FAILED
+
+void set_float4(inout float4 vec, int idx, float val) {
+  vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+cbuffer cbuffer_x_6 : register(b1, space0) {
+  uint4 x_6[4];
+};
+cbuffer cbuffer_x_10 : register(b0, space0) {
+  uint4 x_10[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float4x4 m0 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int c = 0;
+  float4x4 m1 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  const int x_40 = asint(x_6[1].x);
+  const float x_41 = float(x_40);
+  m0 = float4x4(float4(x_41, 0.0f, 0.0f, 0.0f), float4(0.0f, x_41, 0.0f, 0.0f), float4(0.0f, 0.0f, x_41, 0.0f), float4(0.0f, 0.0f, 0.0f, x_41));
+  const int x_48 = asint(x_6[2].x);
+  c = x_48;
+  [loop] while (true) {
+    const int x_53 = c;
+    const uint scalar_offset = ((16u * uint(0))) / 4;
+    const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
+    if ((x_53 < x_55)) {
+    } else {
+      break;
+    }
+    m1 = m0;
+    const int x_59 = c;
+    const int x_61 = asint(x_6[3].x);
+    const int x_64 = asint(x_6[2].x);
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const float x_66 = asfloat(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+    set_float4(m1[(x_59 % x_61)], x_64, x_66);
+    const int x_68 = c;
+    const int x_70 = asint(x_6[3].x);
+    const int x_73 = asint(x_6[2].x);
+    const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+    const float x_75 = asfloat(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+    set_float4(m0[(x_68 % x_70)], x_73, x_75);
+    {
+      c = (c + 1);
+    }
+  }
+  const float4x4 x_79 = m0;
+  const int x_81 = asint(x_6[1].x);
+  const int x_84 = asint(x_6[2].x);
+  const int x_87 = asint(x_6[1].x);
+  const int x_90 = asint(x_6[1].x);
+  const int x_93 = asint(x_6[1].x);
+  const int x_96 = asint(x_6[2].x);
+  const int x_99 = asint(x_6[1].x);
+  const int x_102 = asint(x_6[1].x);
+  const int x_105 = asint(x_6[1].x);
+  const int x_108 = asint(x_6[2].x);
+  const int x_111 = asint(x_6[1].x);
+  const int x_114 = asint(x_6[1].x);
+  const int x_117 = asint(x_6[1].x);
+  const int x_120 = asint(x_6[2].x);
+  const int x_123 = asint(x_6[1].x);
+  const int x_126 = asint(x_6[1].x);
+  const float4x4 x_132 = float4x4(float4(float(x_81), float(x_84), float(x_87), float(x_90)), float4(float(x_93), float(x_96), float(x_99), float(x_102)), float4(float(x_105), float(x_108), float(x_111), float(x_114)), float4(float(x_117), float(x_120), float(x_123), float(x_126)));
+  if ((((all((x_79[0u] == x_132[0u])) & all((x_79[1u] == x_132[1u]))) & all((x_79[2u] == x_132[2u]))) & all((x_79[3u] == x_132[3u])))) {
+    const int x_156 = asint(x_6[2].x);
+    const int x_159 = asint(x_6[1].x);
+    const int x_162 = asint(x_6[1].x);
+    const int x_165 = asint(x_6[2].x);
+    x_GLF_color = float4(float(x_156), float(x_159), float(x_162), float(x_165));
+  } else {
+    const int x_169 = asint(x_6[1].x);
+    const float x_170 = float(x_169);
+    x_GLF_color = float4(x_170, x_170, x_170, x_170);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  return tint_symbol_3;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000013C243CAFF0(36,20-30): warning X3556: integer modulus may be much slower, try using uints if possible.
+C:\src\tint\test\Shader@0x0000013C243CAFF0(22,10-21): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..042c5ab
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-unused-matrix-copy-inside-loop/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,114 @@
+SKIP: FAILED
+
+void set_float4(inout float4 vec, int idx, float val) {
+  vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+cbuffer cbuffer_x_6 : register(b1, space0) {
+  uint4 x_6[4];
+};
+cbuffer cbuffer_x_10 : register(b0, space0) {
+  uint4 x_10[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float4x4 m0 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int c = 0;
+  float4x4 m1 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  const int x_40 = asint(x_6[1].x);
+  const float x_41 = float(x_40);
+  m0 = float4x4(float4(x_41, 0.0f, 0.0f, 0.0f), float4(0.0f, x_41, 0.0f, 0.0f), float4(0.0f, 0.0f, x_41, 0.0f), float4(0.0f, 0.0f, 0.0f, x_41));
+  const int x_48 = asint(x_6[2].x);
+  c = x_48;
+  [loop] while (true) {
+    const int x_53 = c;
+    const uint scalar_offset = ((16u * uint(0))) / 4;
+    const int x_55 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
+    if ((x_53 < x_55)) {
+    } else {
+      break;
+    }
+    m1 = m0;
+    const int x_59 = c;
+    const int x_61 = asint(x_6[3].x);
+    const int x_64 = asint(x_6[2].x);
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const float x_66 = asfloat(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+    set_float4(m1[(x_59 % x_61)], x_64, x_66);
+    const int x_68 = c;
+    const int x_70 = asint(x_6[3].x);
+    const int x_73 = asint(x_6[2].x);
+    const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+    const float x_75 = asfloat(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+    set_float4(m0[(x_68 % x_70)], x_73, x_75);
+    {
+      c = (c + 1);
+    }
+  }
+  const float4x4 x_79 = m0;
+  const int x_81 = asint(x_6[1].x);
+  const int x_84 = asint(x_6[2].x);
+  const int x_87 = asint(x_6[1].x);
+  const int x_90 = asint(x_6[1].x);
+  const int x_93 = asint(x_6[1].x);
+  const int x_96 = asint(x_6[2].x);
+  const int x_99 = asint(x_6[1].x);
+  const int x_102 = asint(x_6[1].x);
+  const int x_105 = asint(x_6[1].x);
+  const int x_108 = asint(x_6[2].x);
+  const int x_111 = asint(x_6[1].x);
+  const int x_114 = asint(x_6[1].x);
+  const int x_117 = asint(x_6[1].x);
+  const int x_120 = asint(x_6[2].x);
+  const int x_123 = asint(x_6[1].x);
+  const int x_126 = asint(x_6[1].x);
+  const float4x4 x_132 = float4x4(float4(float(x_81), float(x_84), float(x_87), float(x_90)), float4(float(x_93), float(x_96), float(x_99), float(x_102)), float4(float(x_105), float(x_108), float(x_111), float(x_114)), float4(float(x_117), float(x_120), float(x_123), float(x_126)));
+  bool tint_tmp_2 = all((x_79[0u] == x_132[0u]));
+  if (tint_tmp_2) {
+    tint_tmp_2 = all((x_79[1u] == x_132[1u]));
+  }
+  bool tint_tmp_1 = (tint_tmp_2);
+  if (tint_tmp_1) {
+    tint_tmp_1 = all((x_79[2u] == x_132[2u]));
+  }
+  bool tint_tmp = (tint_tmp_1);
+  if (tint_tmp) {
+    tint_tmp = all((x_79[3u] == x_132[3u]));
+  }
+  if ((tint_tmp)) {
+    const int x_156 = asint(x_6[2].x);
+    const int x_159 = asint(x_6[1].x);
+    const int x_162 = asint(x_6[1].x);
+    const int x_165 = asint(x_6[2].x);
+    x_GLF_color = float4(float(x_156), float(x_159), float(x_162), float(x_165));
+  } else {
+    const int x_169 = asint(x_6[1].x);
+    const float x_170 = float(x_169);
+    x_GLF_color = float4(x_170, x_170, x_170, x_170);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  return tint_symbol_3;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001ABB4809E40(36,20-30): warning X3556: integer modulus may be much slower, try using uints if possible.
+C:\src\tint\test\Shader@0x000001ABB4809E40(22,10-21): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.hlsl
index d8ac54b..6760777 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.spvasm.expected.hlsl
@@ -24,10 +24,10 @@
   if ((x_45 == 1)) {
     set_float2(m32[3], x_45, x_40);
   }
-  const float tint_symbol_4[3] = {x_40, x_40, x_40};
-  sums = tint_symbol_4;
+  const float tint_symbol_3[3] = {x_40, x_40, x_40};
+  sums = tint_symbol_3;
   x_52_phi = x_45;
-  while (true) {
+  [loop] while (true) {
     int x_53 = 0;
     const int x_52 = x_52_phi;
     const int x_56 = asint(x_8[2].x);
@@ -59,11 +59,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_5;
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
 }
-C:\src\tint\test\Shader@0x0000029DDF1A00E0(23,16-21): error X3504: array index out of bounds
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000018CEDCE0230(23,16-21): error X3504: array index out of bounds
 
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.hlsl
index 89c14b0..c4c7d32 100755
--- a/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-write-past-matrix-elements-unused/0.wgsl.expected.hlsl
@@ -24,10 +24,10 @@
   if ((x_45 == 1)) {
     set_float2(m32[3], x_45, x_40);
   }
-  const float tint_symbol_4[3] = {x_40, x_40, x_40};
-  sums = tint_symbol_4;
+  const float tint_symbol_3[3] = {x_40, x_40, x_40};
+  sums = tint_symbol_3;
   x_52_phi = x_45;
-  while (true) {
+  [loop] while (true) {
     int x_53 = 0;
     const int x_52 = x_52_phi;
     const int x_56 = asint(x_8[2].x);
@@ -59,11 +59,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_5;
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
 }
-C:\src\tint\test\Shader@0x0000020469C7EEA0(23,16-21): error X3504: array index out of bounds
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000229BC652210(23,16-21): error X3504: array index out of bounds
 
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..dafcc86
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,124 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_6 : register(b1, space0) {
+  uint4 x_6[3];
+};
+cbuffer cbuffer_x_9 : register(b0, space0) {
+  uint4 x_9[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float A[2] = (float[2])0;
+  int i = 0;
+  int j = 0;
+  bool x_101 = false;
+  bool x_102_phi = false;
+  const float x_39 = asfloat(x_6[1].x);
+  A[0] = x_39;
+  const float x_42 = asfloat(x_6[1].x);
+  A[1] = x_42;
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_45 = asint(x_9[scalar_offset / 4][scalar_offset % 4]);
+  i = x_45;
+  [loop] while (true) {
+    const int x_50 = i;
+    const int x_52 = asint(x_9[3].x);
+    if ((x_50 < x_52)) {
+    } else {
+      break;
+    }
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const int x_56 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+    j = x_56;
+    [loop] while (true) {
+      const int x_61 = j;
+      const int x_63 = asint(x_9[2].x);
+      if ((x_61 < x_63)) {
+      } else {
+        break;
+      }
+      switch(j) {
+        case 1: {
+          const int x_78 = i;
+          const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+          const float x_80 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+          A[x_78] = x_80;
+          break;
+        }
+        case 0: {
+          if ((-2147483648 < i)) {
+            {
+              j = (j + 1);
+            }
+            continue;
+          }
+          const int x_74 = i;
+          const float x_76 = asfloat(x_6[2].x);
+          A[x_74] = x_76;
+          break;
+        }
+        default: {
+          break;
+        }
+      }
+      {
+        j = (j + 1);
+      }
+    }
+    {
+      i = (i + 1);
+    }
+  }
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const int x_87 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const float x_89 = A[x_87];
+  const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+  const float x_91 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+  const bool x_92 = (x_89 == x_91);
+  x_102_phi = x_92;
+  if (x_92) {
+    const int x_96 = asint(x_9[1].x);
+    const float x_98 = A[x_96];
+    const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+    const float x_100 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]);
+    x_101 = (x_98 == x_100);
+    x_102_phi = x_101;
+  }
+  if (x_102_phi) {
+    const int x_107 = asint(x_9[1].x);
+    const uint scalar_offset_6 = ((16u * uint(0))) / 4;
+    const int x_110 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]);
+    const uint scalar_offset_7 = ((16u * uint(0))) / 4;
+    const int x_113 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]);
+    const int x_116 = asint(x_9[1].x);
+    x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116));
+  } else {
+    const int x_120 = asint(x_9[1].x);
+    const float x_121 = float(x_120);
+    x_GLF_color = float4(x_121, x_121, x_121, x_121);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  return tint_symbol_3;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001CAF72F14F0(52,13-21): error X3708: continue cannot be used in a switch
+
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..4843bc4
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/cov-x86-isel-lowering-negative-left-shift/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,124 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_6 : register(b1, space0) {
+  uint4 x_6[3];
+};
+cbuffer cbuffer_x_9 : register(b0, space0) {
+  uint4 x_9[4];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float A[2] = (float[2])0;
+  int i = 0;
+  int j = 0;
+  bool x_101 = false;
+  bool x_102_phi = false;
+  const float x_39 = asfloat(x_6[1].x);
+  A[0] = x_39;
+  const float x_42 = asfloat(x_6[1].x);
+  A[1] = x_42;
+  const uint scalar_offset = ((16u * uint(0))) / 4;
+  const int x_45 = asint(x_9[scalar_offset / 4][scalar_offset % 4]);
+  i = x_45;
+  [loop] while (true) {
+    const int x_50 = i;
+    const int x_52 = asint(x_9[3].x);
+    if ((x_50 < x_52)) {
+    } else {
+      break;
+    }
+    const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+    const int x_56 = asint(x_9[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+    j = x_56;
+    [loop] while (true) {
+      const int x_61 = j;
+      const int x_63 = asint(x_9[2].x);
+      if ((x_61 < x_63)) {
+      } else {
+        break;
+      }
+      switch(j) {
+        case 1: {
+          const int x_78 = i;
+          const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+          const float x_80 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+          A[x_78] = x_80;
+          break;
+        }
+        case 0: {
+          if ((-2147483648 < i)) {
+            {
+              j = (j + 1);
+            }
+            continue;
+          }
+          const int x_74 = i;
+          const float x_76 = asfloat(x_6[2].x);
+          A[x_74] = x_76;
+          break;
+        }
+        default: {
+          break;
+        }
+      }
+      {
+        j = (j + 1);
+      }
+    }
+    {
+      i = (i + 1);
+    }
+  }
+  const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+  const int x_87 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+  const float x_89 = A[x_87];
+  const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+  const float x_91 = asfloat(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
+  const bool x_92 = (x_89 == x_91);
+  x_102_phi = x_92;
+  if (x_92) {
+    const int x_96 = asint(x_9[1].x);
+    const float x_98 = A[x_96];
+    const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+    const float x_100 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]);
+    x_101 = (x_98 == x_100);
+    x_102_phi = x_101;
+  }
+  if (x_102_phi) {
+    const int x_107 = asint(x_9[1].x);
+    const uint scalar_offset_6 = ((16u * uint(0))) / 4;
+    const int x_110 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]);
+    const uint scalar_offset_7 = ((16u * uint(0))) / 4;
+    const int x_113 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]);
+    const int x_116 = asint(x_9[1].x);
+    x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116));
+  } else {
+    const int x_120 = asint(x_9[1].x);
+    const float x_121 = float(x_120);
+    x_GLF_color = float4(x_121, x_121, x_121, x_121);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  return tint_symbol_3;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000027536C22E40(52,13-21): error X3708: continue cannot be used in a switch
+
diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl
index b6eade1..d1579f5 100755
--- a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.spvasm.expected.hlsl
@@ -12,7 +12,7 @@
     const float x_55 = asfloat(x_7[0].y);
     return x_55;
   }
-  while (true) {
+  [loop] while (true) {
     if (true) {
     } else {
       break;
@@ -30,7 +30,7 @@
   B = 1.0f;
   const float x_34 = fx_();
   x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f);
-  while (true) {
+  [loop] while (true) {
     if ((x2 > 2.0f)) {
     } else {
       break;
@@ -54,13 +54,18 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol_2 main(tint_symbol_1 tint_symbol) {
-  const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
+main_out main_inner(float4 gl_FragCoord_param) {
   gl_FragCoord = gl_FragCoord_param;
   main_1();
-  const main_out tint_symbol_3 = {x_GLF_color};
-  const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
-  return tint_symbol_5;
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
 }
-C:\src\tint\test\Shader@0x0000015B7FF57370(13,10-13): error X3696: infinite loop detected - loop never exits
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001DE747F22A0(13,17-20): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl
index 1db853d..e99e9c1 100755
--- a/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/function-with-uniform-return/0-opt.wgsl.expected.hlsl
@@ -12,7 +12,7 @@
     const float x_55 = asfloat(x_7[0].y);
     return x_55;
   }
-  while (true) {
+  [loop] while (true) {
     if (true) {
     } else {
       break;
@@ -30,7 +30,7 @@
   B = 1.0f;
   const float x_34 = fx_();
   x_GLF_color = float4(x_34, 0.0f, 0.0f, 1.0f);
-  while (true) {
+  [loop] while (true) {
     if ((x2 > 2.0f)) {
     } else {
       break;
@@ -54,13 +54,18 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol_2 main(tint_symbol_1 tint_symbol) {
-  const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
+main_out main_inner(float4 gl_FragCoord_param) {
   gl_FragCoord = gl_FragCoord_param;
   main_1();
-  const main_out tint_symbol_3 = {x_GLF_color};
-  const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
-  return tint_symbol_5;
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
 }
-C:\src\tint\test\Shader@0x0000022DDADAA730(13,10-13): error X3696: infinite loop detected - loop never exits
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000024AE2EDC600(13,17-20): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl
new file mode 100644
index 0000000..66cf344
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.spvasm.expected.hlsl
@@ -0,0 +1,288 @@
+SKIP: FAILED
+
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  [loop] while (true) {
+    bool x_45 = false;
+    int x_48 = 0;
+    int x_49 = 0;
+    bool x_46 = false;
+    int x_115 = 0;
+    int x_116 = 0;
+    bool x_45_phi = false;
+    int x_48_phi = 0;
+    int x_50_phi = 0;
+    int x_52_phi = 0;
+    int x_111_phi = 0;
+    bool x_112_phi = false;
+    int x_115_phi = 0;
+    int x_118_phi = 0;
+    int x_120_phi = 0;
+    int x_161_phi = 0;
+    const float x_40 = asfloat(x_6[0].x);
+    const bool x_41 = (x_40 < -1.0f);
+    x_45_phi = false;
+    x_48_phi = 0;
+    x_50_phi = 0;
+    x_52_phi = 0;
+    [loop] while (true) {
+      int x_62 = 0;
+      int x_65 = 0;
+      int x_66 = 0;
+      int x_63 = 0;
+      int x_53 = 0;
+      int x_62_phi = 0;
+      int x_65_phi = 0;
+      int x_67_phi = 0;
+      int x_51_phi = 0;
+      int x_49_phi = 0;
+      bool x_46_phi = false;
+      x_45 = x_45_phi;
+      x_48 = x_48_phi;
+      const int x_50 = x_50_phi;
+      const int x_52 = x_52_phi;
+      const float x_55 = gl_FragCoord.y;
+      x_111_phi = x_48;
+      x_112_phi = x_45;
+      if ((x_52 < ((x_55 > -1.0f) ? 10 : 100))) {
+      } else {
+        break;
+      }
+      x_62_phi = x_48;
+      x_65_phi = x_50;
+      x_67_phi = 0;
+      [loop] while (true) {
+        int x_97 = 0;
+        int x_68 = 0;
+        int x_66_phi = 0;
+        x_62 = x_62_phi;
+        x_65 = x_65_phi;
+        const int x_67 = x_67_phi;
+        x_51_phi = x_65;
+        x_49_phi = x_62;
+        x_46_phi = x_45;
+        if ((x_67 < 2)) {
+        } else {
+          break;
+        }
+        [loop] while (true) {
+          bool x_78 = false;
+          int x_86_phi = 0;
+          int x_97_phi = 0;
+          bool x_98_phi = false;
+          const float x_77 = gl_FragCoord.x;
+          x_78 = (x_77 < -1.0f);
+          if (!((x_40 < 0.0f))) {
+            if (x_78) {
+              x_66_phi = 0;
+              break;
+            }
+            x_86_phi = 1;
+            [loop] while (true) {
+              int x_87 = 0;
+              const int x_86 = x_86_phi;
+              x_97_phi = x_65;
+              x_98_phi = false;
+              if ((x_86 < 3)) {
+              } else {
+                break;
+              }
+              if (x_78) {
+                {
+                  x_87 = (x_86 + 1);
+                  x_86_phi = x_87;
+                }
+                continue;
+              }
+              if ((x_86 > 0)) {
+                x_97_phi = 1;
+                x_98_phi = true;
+                break;
+              }
+              {
+                x_87 = (x_86 + 1);
+                x_86_phi = x_87;
+              }
+            }
+            x_97 = x_97_phi;
+            const bool x_98 = x_98_phi;
+            x_66_phi = x_97;
+            if (x_98) {
+              break;
+            }
+          }
+          x_66_phi = 0;
+          break;
+        }
+        x_66 = x_66_phi;
+        x_63 = asint((x_62 + x_66));
+        if (x_41) {
+          [loop] while (true) {
+            if (x_41) {
+            } else {
+              break;
+            }
+            {
+              const float x_105 = float(x_52);
+              x_GLF_color = float4(x_105, x_105, x_105, x_105);
+            }
+          }
+          x_51_phi = x_66;
+          x_49_phi = x_63;
+          x_46_phi = true;
+          break;
+        }
+        {
+          x_68 = (x_67 + 1);
+          x_62_phi = x_63;
+          x_65_phi = x_66;
+          x_67_phi = x_68;
+        }
+      }
+      const int x_51 = x_51_phi;
+      x_49 = x_49_phi;
+      x_46 = x_46_phi;
+      x_111_phi = x_49;
+      x_112_phi = x_46;
+      if (x_46) {
+        break;
+      }
+      if (!(x_41)) {
+        x_111_phi = x_49;
+        x_112_phi = x_46;
+        break;
+      }
+      {
+        x_53 = (x_52 + 1);
+        x_45_phi = x_46;
+        x_48_phi = x_49;
+        x_50_phi = x_51;
+        x_52_phi = x_53;
+      }
+    }
+    const int x_111 = x_111_phi;
+    if (x_112_phi) {
+      break;
+    }
+    x_115_phi = x_111;
+    x_118_phi = 0;
+    x_120_phi = 0;
+    [loop] while (true) {
+      int x_154 = 0;
+      int x_121 = 0;
+      int x_119_phi = 0;
+      x_115 = x_115_phi;
+      const int x_118 = x_118_phi;
+      const int x_120 = x_120_phi;
+      const float x_123 = asfloat(x_6[0].y);
+      x_161_phi = x_115;
+      if ((x_120 < int((x_123 + 1.0f)))) {
+      } else {
+        break;
+      }
+      [loop] while (true) {
+        bool x_135 = false;
+        int x_143_phi = 0;
+        int x_154_phi = 0;
+        bool x_155_phi = false;
+        const float x_134 = gl_FragCoord.x;
+        x_135 = (x_134 < -1.0f);
+        if (!((x_40 < 0.0f))) {
+          if (x_135) {
+            x_119_phi = 0;
+            break;
+          }
+          x_143_phi = 1;
+          [loop] while (true) {
+            int x_144 = 0;
+            const int x_143 = x_143_phi;
+            x_154_phi = x_118;
+            x_155_phi = false;
+            if ((x_143 < 3)) {
+            } else {
+              break;
+            }
+            if (x_135) {
+              {
+                x_144 = (x_143 + 1);
+                x_143_phi = x_144;
+              }
+              continue;
+            }
+            if ((x_143 > 0)) {
+              x_154_phi = 1;
+              x_155_phi = true;
+              break;
+            }
+            {
+              x_144 = (x_143 + 1);
+              x_143_phi = x_144;
+            }
+          }
+          x_154 = x_154_phi;
+          const bool x_155 = x_155_phi;
+          x_119_phi = x_154;
+          if (x_155) {
+            break;
+          }
+        }
+        x_119_phi = 0;
+        break;
+      }
+      int x_119 = 0;
+      x_119 = x_119_phi;
+      x_116 = asint((x_115 + x_119));
+      if ((!(x_41) ? false : x_41)) {
+        x_161_phi = x_116;
+        break;
+      }
+      {
+        x_121 = (x_120 + 1);
+        x_115_phi = x_116;
+        x_118_phi = x_119;
+        x_120_phi = x_121;
+      }
+    }
+    if ((x_161_phi == 4)) {
+      x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+    } else {
+      x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+    }
+    break;
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002215620C140(8,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x000002215620C140(71,16-27): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x000002215620C140(186,14-25): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x000002215620C140(123,18-29): error X4029: infinite loop detected - loop never exits
+
diff --git a/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl
new file mode 100644
index 0000000..01f2ccd
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/increment-value-in-nested-for-loop/0.wgsl.expected.hlsl
@@ -0,0 +1,288 @@
+SKIP: FAILED
+
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  [loop] while (true) {
+    bool x_45 = false;
+    int x_48 = 0;
+    int x_49 = 0;
+    bool x_46 = false;
+    int x_115 = 0;
+    int x_116 = 0;
+    bool x_45_phi = false;
+    int x_48_phi = 0;
+    int x_50_phi = 0;
+    int x_52_phi = 0;
+    int x_111_phi = 0;
+    bool x_112_phi = false;
+    int x_115_phi = 0;
+    int x_118_phi = 0;
+    int x_120_phi = 0;
+    int x_161_phi = 0;
+    const float x_40 = asfloat(x_6[0].x);
+    const bool x_41 = (x_40 < -1.0f);
+    x_45_phi = false;
+    x_48_phi = 0;
+    x_50_phi = 0;
+    x_52_phi = 0;
+    [loop] while (true) {
+      int x_62 = 0;
+      int x_65 = 0;
+      int x_66 = 0;
+      int x_63 = 0;
+      int x_53 = 0;
+      int x_62_phi = 0;
+      int x_65_phi = 0;
+      int x_67_phi = 0;
+      int x_51_phi = 0;
+      int x_49_phi = 0;
+      bool x_46_phi = false;
+      x_45 = x_45_phi;
+      x_48 = x_48_phi;
+      const int x_50 = x_50_phi;
+      const int x_52 = x_52_phi;
+      const float x_55 = gl_FragCoord.y;
+      x_111_phi = x_48;
+      x_112_phi = x_45;
+      if ((x_52 < ((x_55 > -1.0f) ? 10 : 100))) {
+      } else {
+        break;
+      }
+      x_62_phi = x_48;
+      x_65_phi = x_50;
+      x_67_phi = 0;
+      [loop] while (true) {
+        int x_97 = 0;
+        int x_68 = 0;
+        int x_66_phi = 0;
+        x_62 = x_62_phi;
+        x_65 = x_65_phi;
+        const int x_67 = x_67_phi;
+        x_51_phi = x_65;
+        x_49_phi = x_62;
+        x_46_phi = x_45;
+        if ((x_67 < 2)) {
+        } else {
+          break;
+        }
+        [loop] while (true) {
+          bool x_78 = false;
+          int x_86_phi = 0;
+          int x_97_phi = 0;
+          bool x_98_phi = false;
+          const float x_77 = gl_FragCoord.x;
+          x_78 = (x_77 < -1.0f);
+          if (!((x_40 < 0.0f))) {
+            if (x_78) {
+              x_66_phi = 0;
+              break;
+            }
+            x_86_phi = 1;
+            [loop] while (true) {
+              int x_87 = 0;
+              const int x_86 = x_86_phi;
+              x_97_phi = x_65;
+              x_98_phi = false;
+              if ((x_86 < 3)) {
+              } else {
+                break;
+              }
+              if (x_78) {
+                {
+                  x_87 = (x_86 + 1);
+                  x_86_phi = x_87;
+                }
+                continue;
+              }
+              if ((x_86 > 0)) {
+                x_97_phi = 1;
+                x_98_phi = true;
+                break;
+              }
+              {
+                x_87 = (x_86 + 1);
+                x_86_phi = x_87;
+              }
+            }
+            x_97 = x_97_phi;
+            const bool x_98 = x_98_phi;
+            x_66_phi = x_97;
+            if (x_98) {
+              break;
+            }
+          }
+          x_66_phi = 0;
+          break;
+        }
+        x_66 = x_66_phi;
+        x_63 = asint((x_62 + x_66));
+        if (x_41) {
+          [loop] while (true) {
+            if (x_41) {
+            } else {
+              break;
+            }
+            {
+              const float x_105 = float(x_52);
+              x_GLF_color = float4(x_105, x_105, x_105, x_105);
+            }
+          }
+          x_51_phi = x_66;
+          x_49_phi = x_63;
+          x_46_phi = true;
+          break;
+        }
+        {
+          x_68 = (x_67 + 1);
+          x_62_phi = x_63;
+          x_65_phi = x_66;
+          x_67_phi = x_68;
+        }
+      }
+      const int x_51 = x_51_phi;
+      x_49 = x_49_phi;
+      x_46 = x_46_phi;
+      x_111_phi = x_49;
+      x_112_phi = x_46;
+      if (x_46) {
+        break;
+      }
+      if (!(x_41)) {
+        x_111_phi = x_49;
+        x_112_phi = x_46;
+        break;
+      }
+      {
+        x_53 = (x_52 + 1);
+        x_45_phi = x_46;
+        x_48_phi = x_49;
+        x_50_phi = x_51;
+        x_52_phi = x_53;
+      }
+    }
+    const int x_111 = x_111_phi;
+    if (x_112_phi) {
+      break;
+    }
+    x_115_phi = x_111;
+    x_118_phi = 0;
+    x_120_phi = 0;
+    [loop] while (true) {
+      int x_154 = 0;
+      int x_121 = 0;
+      int x_119_phi = 0;
+      x_115 = x_115_phi;
+      const int x_118 = x_118_phi;
+      const int x_120 = x_120_phi;
+      const float x_123 = asfloat(x_6[0].y);
+      x_161_phi = x_115;
+      if ((x_120 < int((x_123 + 1.0f)))) {
+      } else {
+        break;
+      }
+      [loop] while (true) {
+        bool x_135 = false;
+        int x_143_phi = 0;
+        int x_154_phi = 0;
+        bool x_155_phi = false;
+        const float x_134 = gl_FragCoord.x;
+        x_135 = (x_134 < -1.0f);
+        if (!((x_40 < 0.0f))) {
+          if (x_135) {
+            x_119_phi = 0;
+            break;
+          }
+          x_143_phi = 1;
+          [loop] while (true) {
+            int x_144 = 0;
+            const int x_143 = x_143_phi;
+            x_154_phi = x_118;
+            x_155_phi = false;
+            if ((x_143 < 3)) {
+            } else {
+              break;
+            }
+            if (x_135) {
+              {
+                x_144 = (x_143 + 1);
+                x_143_phi = x_144;
+              }
+              continue;
+            }
+            if ((x_143 > 0)) {
+              x_154_phi = 1;
+              x_155_phi = true;
+              break;
+            }
+            {
+              x_144 = (x_143 + 1);
+              x_143_phi = x_144;
+            }
+          }
+          x_154 = x_154_phi;
+          const bool x_155 = x_155_phi;
+          x_119_phi = x_154;
+          if (x_155) {
+            break;
+          }
+        }
+        x_119_phi = 0;
+        break;
+      }
+      int x_119 = 0;
+      x_119 = x_119_phi;
+      x_116 = asint((x_115 + x_119));
+      if ((!(x_41) ? false : x_41)) {
+        x_161_phi = x_116;
+        break;
+      }
+      {
+        x_121 = (x_120 + 1);
+        x_115_phi = x_116;
+        x_118_phi = x_119;
+        x_120_phi = x_121;
+      }
+    }
+    if ((x_161_phi == 4)) {
+      x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+    } else {
+      x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+    }
+    break;
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000020EFE36E240(8,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000020EFE36E240(71,16-27): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000020EFE36E240(186,14-25): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000020EFE36E240(123,18-29): error X4029: infinite loop detected - loop never exits
+
diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.hlsl
new file mode 100644
index 0000000..3b9109c
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.spvasm.expected.hlsl
@@ -0,0 +1,93 @@
+SKIP: FAILED
+
+struct BinarySearchObject {
+  int prime_numbers[10];
+};
+
+cbuffer cbuffer_x_8 : register(b0, space0) {
+  uint4 x_8[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+int binarySearch_struct_BinarySearchObject_i1_10_1_(inout BinarySearchObject obj) {
+  int m = 0;
+  [loop] while (true) {
+    const float x_91 = asfloat(x_8[0].x);
+    if ((x_91 > 1.0f)) {
+    } else {
+      break;
+    }
+    const float x_95 = asfloat(x_8[0].x);
+    m = int(x_95);
+    const int x_15 = obj.prime_numbers[m];
+    if ((x_15 == 1)) {
+      return 1;
+    }
+  }
+  return 1;
+}
+
+void main_1() {
+  int i = 0;
+  BinarySearchObject obj_1 = (BinarySearchObject)0;
+  BinarySearchObject param = (BinarySearchObject)0;
+  i = 0;
+  {
+    [loop] for(; (i < 10); i = (i + 1)) {
+      if ((i != 3)) {
+        const int x_18 = i;
+        const float x_67 = asfloat(x_8[0].x);
+        if (((x_18 - int(x_67)) == 4)) {
+          obj_1.prime_numbers[i] = 11;
+        } else {
+          if ((i == 6)) {
+            obj_1.prime_numbers[i] = 17;
+          }
+          continue;
+        }
+      }
+      [loop] while (true) {
+        {
+          const float x_82 = asfloat(x_8[0].y);
+          if ((0.0f > x_82)) {
+          } else {
+            break;
+          }
+        }
+      }
+    }
+  }
+  param = obj_1;
+  const int x_26 = binarySearch_struct_BinarySearchObject_i1_10_1_(param);
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000016C5E617FA0(47,14-25): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000016C5E617FA0(39,11-32): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x0000016C5E617FA0(34,12-39): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.hlsl
new file mode 100644
index 0000000..3c9719c
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/loops-ifs-continues-call/0.wgsl.expected.hlsl
@@ -0,0 +1,93 @@
+SKIP: FAILED
+
+struct BinarySearchObject {
+  int prime_numbers[10];
+};
+
+cbuffer cbuffer_x_8 : register(b0, space0) {
+  uint4 x_8[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+int binarySearch_struct_BinarySearchObject_i1_10_1_(inout BinarySearchObject obj) {
+  int m = 0;
+  [loop] while (true) {
+    const float x_91 = asfloat(x_8[0].x);
+    if ((x_91 > 1.0f)) {
+    } else {
+      break;
+    }
+    const float x_95 = asfloat(x_8[0].x);
+    m = int(x_95);
+    const int x_15 = obj.prime_numbers[m];
+    if ((x_15 == 1)) {
+      return 1;
+    }
+  }
+  return 1;
+}
+
+void main_1() {
+  int i = 0;
+  BinarySearchObject obj_1 = (BinarySearchObject)0;
+  BinarySearchObject param = (BinarySearchObject)0;
+  i = 0;
+  {
+    [loop] for(; (i < 10); i = (i + 1)) {
+      if ((i != 3)) {
+        const int x_18 = i;
+        const float x_67 = asfloat(x_8[0].x);
+        if (((x_18 - int(x_67)) == 4)) {
+          obj_1.prime_numbers[i] = 11;
+        } else {
+          if ((i == 6)) {
+            obj_1.prime_numbers[i] = 17;
+          }
+          continue;
+        }
+      }
+      [loop] while (true) {
+        {
+          const float x_82 = asfloat(x_8[0].y);
+          if ((0.0f > x_82)) {
+          } else {
+            break;
+          }
+        }
+      }
+    }
+  }
+  param = obj_1;
+  const int x_26 = binarySearch_struct_BinarySearchObject_i1_10_1_(param);
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000022E4AE186A0(47,14-25): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000022E4AE186A0(39,11-32): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022E4AE186A0(34,12-39): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.hlsl
new file mode 100644
index 0000000..dea6d2c
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.spvasm.expected.hlsl
@@ -0,0 +1,86 @@
+SKIP: FAILED
+
+void set_float4(inout float4 vec, int idx, float val) {
+  vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_7 : register(b0, space0) {
+  uint4 x_7[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int x_10_phi = 0;
+  m44 = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f));
+  x_10_phi = 0;
+  [loop] while (true) {
+    int x_9 = 0;
+    int x_11_phi = 0;
+    const int x_10 = x_10_phi;
+    if ((x_10 < 4)) {
+    } else {
+      break;
+    }
+    const float x_63 = gl_FragCoord.y;
+    if ((x_63 < 0.0f)) {
+      break;
+    }
+    x_11_phi = 0;
+    [loop] while (true) {
+      int x_8 = 0;
+      const int x_11 = x_11_phi;
+      if ((x_11 < 4)) {
+      } else {
+        break;
+      }
+      {
+        const float x_72 = asfloat(x_7[0].x);
+        const float x_74 = m44[x_10][x_11];
+        set_float4(m44[x_10], x_11, (x_74 + x_72));
+        x_8 = (x_11 + 1);
+        x_11_phi = x_8;
+      }
+    }
+    {
+      x_9 = (x_10 + 1);
+      x_10_phi = x_9;
+    }
+  }
+  const float x_77 = m44[1].y;
+  float4 x_79_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  x_79_1.x = (x_77 - 6.0f);
+  const float4 x_79 = x_79_1;
+  const float x_81 = m44[2].z;
+  float4 x_83_1 = x_79;
+  x_83_1.w = (x_81 - 11.0f);
+  x_GLF_color = x_83_1;
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001CE5E694FB0(29,12-23): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.hlsl
new file mode 100644
index 0000000..59429ad
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/nested-for-break-mat-color/0.wgsl.expected.hlsl
@@ -0,0 +1,86 @@
+SKIP: FAILED
+
+void set_float4(inout float4 vec, int idx, float val) {
+  vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_7 : register(b0, space0) {
+  uint4 x_7[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float4x4 m44 = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int x_10_phi = 0;
+  m44 = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f));
+  x_10_phi = 0;
+  [loop] while (true) {
+    int x_9 = 0;
+    int x_11_phi = 0;
+    const int x_10 = x_10_phi;
+    if ((x_10 < 4)) {
+    } else {
+      break;
+    }
+    const float x_63 = gl_FragCoord.y;
+    if ((x_63 < 0.0f)) {
+      break;
+    }
+    x_11_phi = 0;
+    [loop] while (true) {
+      int x_8 = 0;
+      const int x_11 = x_11_phi;
+      if ((x_11 < 4)) {
+      } else {
+        break;
+      }
+      {
+        const float x_72 = asfloat(x_7[0].x);
+        const float x_74 = m44[x_10][x_11];
+        set_float4(m44[x_10], x_11, (x_74 + x_72));
+        x_8 = (x_11 + 1);
+        x_11_phi = x_8;
+      }
+    }
+    {
+      x_9 = (x_10 + 1);
+      x_10_phi = x_9;
+    }
+  }
+  const float x_77 = m44[1].y;
+  float4 x_79_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+  x_79_1.x = (x_77 - 6.0f);
+  const float4 x_79 = x_79_1;
+  const float x_81 = m44[2].z;
+  float4 x_83_1 = x_79;
+  x_83_1.w = (x_81 - 11.0f);
+  x_GLF_color = x_83_1;
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001A0A52BEBB0(29,12-23): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl
index 4a4c1b8..9c26cbb 100755
--- a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.spvasm.expected.hlsl
@@ -19,7 +19,7 @@
   bool x_58_phi = false;
   x_40_phi = false;
   x_42_phi = float3(0.0f, 0.0f, 0.0f);
-  while (true) {
+  [loop] while (true) {
     float3 x_43_phi = float3(0.0f, 0.0f, 0.0f);
     x_40 = x_40_phi;
     const float3 x_42 = x_42_phi;
@@ -42,7 +42,7 @@
   x_36 = false;
   x_56_phi = x_40;
   x_58_phi = false;
-  while (true) {
+  [loop] while (true) {
     bool x_62 = false;
     bool x_62_phi = false;
     bool x_64_phi = false;
@@ -55,7 +55,7 @@
     x_62_phi = x_56;
     x_64_phi = false;
     x_65_phi = 0;
-    while (true) {
+    [loop] while (true) {
       x_62 = x_62_phi;
       const bool x_64 = x_64_phi;
       const int x_65 = x_65_phi;
@@ -103,10 +103,15 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
 
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
diff --git a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl
index 4a4c1b8..9c26cbb 100755
--- a/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/returned-boolean-in-vector/0-opt.wgsl.expected.hlsl
@@ -19,7 +19,7 @@
   bool x_58_phi = false;
   x_40_phi = false;
   x_42_phi = float3(0.0f, 0.0f, 0.0f);
-  while (true) {
+  [loop] while (true) {
     float3 x_43_phi = float3(0.0f, 0.0f, 0.0f);
     x_40 = x_40_phi;
     const float3 x_42 = x_42_phi;
@@ -42,7 +42,7 @@
   x_36 = false;
   x_56_phi = x_40;
   x_58_phi = false;
-  while (true) {
+  [loop] while (true) {
     bool x_62 = false;
     bool x_62_phi = false;
     bool x_64_phi = false;
@@ -55,7 +55,7 @@
     x_62_phi = x_56;
     x_64_phi = false;
     x_65_phi = 0;
-    while (true) {
+    [loop] while (true) {
       x_62 = x_62_phi;
       const bool x_64 = x_64_phi;
       const int x_65 = x_65_phi;
@@ -103,10 +103,15 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
 
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..ba95157
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,82 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_7 : register(b0, space0) {
+  uint4 x_7[1];
+};
+static float gv = 0.0f;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float lv = 0.0f;
+  float x_43 = 0.0f;
+  int GLF_live5r = 0;
+  int GLF_live5_looplimiter6 = 0;
+  const float x_45 = asfloat(x_7[0].y);
+  if ((1.0f > x_45)) {
+    x_43 = abs(gv);
+  } else {
+    x_43 = 260.0f;
+  }
+  lv = x_43;
+  if ((int(lv) < 250)) {
+    if ((int(lv) < 180)) {
+      const float x_65 = clamp(lv, 1.0f, 1.0f);
+    } else {
+      const float x_67 = gl_FragCoord.y;
+      if ((x_67 < 0.0f)) {
+        if ((int(lv) < 210)) {
+          [loop] while (true) {
+            {
+              if (true) {
+              } else {
+                break;
+              }
+            }
+          }
+        }
+        GLF_live5r = 0;
+        [loop] while (true) {
+          if (true) {
+          } else {
+            break;
+          }
+          if ((GLF_live5_looplimiter6 >= 6)) {
+            break;
+          }
+          GLF_live5_looplimiter6 = (GLF_live5_looplimiter6 + 1);
+        }
+      }
+    }
+  }
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001DCBE0206C0(27,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x000001DCBE0206C0(27,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x000001DCBE0206C0(27,25-28): error X3696: infinite loop detected - loop never exits
+
diff --git a/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..2d86c5a
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,82 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_7 : register(b0, space0) {
+  uint4 x_7[1];
+};
+static float gv = 0.0f;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float lv = 0.0f;
+  float x_43 = 0.0f;
+  int GLF_live5r = 0;
+  int GLF_live5_looplimiter6 = 0;
+  const float x_45 = asfloat(x_7[0].y);
+  if ((1.0f > x_45)) {
+    x_43 = abs(gv);
+  } else {
+    x_43 = 260.0f;
+  }
+  lv = x_43;
+  if ((int(lv) < 250)) {
+    if ((int(lv) < 180)) {
+      const float x_65 = clamp(lv, 1.0f, 1.0f);
+    } else {
+      const float x_67 = gl_FragCoord.y;
+      if ((x_67 < 0.0f)) {
+        if ((int(lv) < 210)) {
+          [loop] while (true) {
+            {
+              if (true) {
+              } else {
+                break;
+              }
+            }
+          }
+        }
+        GLF_live5r = 0;
+        [loop] while (true) {
+          if (true) {
+          } else {
+            break;
+          }
+          if ((GLF_live5_looplimiter6 >= 6)) {
+            break;
+          }
+          GLF_live5_looplimiter6 = (GLF_live5_looplimiter6 + 1);
+        }
+      }
+    }
+  }
+  x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000023F9486F180(27,18-29): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x0000023F9486F180(27,18-29): warning X3551: infinite loop detected - loop writes no values
+C:\src\tint\test\Shader@0x0000023F9486F180(27,25-28): error X3696: infinite loop detected - loop never exits
+
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl
new file mode 100644
index 0000000..332a339
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.hlsl
@@ -0,0 +1,778 @@
+SKIP: FAILED
+
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  BST tree[10] = (BST[10])0;
+  int x_360 = 0;
+  int x_62_phi = 0;
+  bool x_90_phi = false;
+  int x_357_phi = 0;
+  int x_360_phi = 0;
+  int x_362_phi = 0;
+  const BST tint_symbol_1 = {9, -1, -1};
+  tree[0] = tint_symbol_1;
+  0u;
+  do {
+    x_62_phi = 0;
+    [loop] while (true) {
+      int x_88 = 0;
+      int x_80 = 0;
+      int x_63 = 0;
+      int x_63_phi = 0;
+      const int x_62 = x_62_phi;
+      x_90_phi = false;
+      if ((x_62 <= 1)) {
+      } else {
+        break;
+      }
+      const int x_69 = tree[x_62].data;
+      if ((5 <= x_69)) {
+        const int x_82_save = x_62;
+        const int x_83 = tree[x_82_save].leftIndex;
+        if ((x_83 == -1)) {
+          tree[x_82_save].leftIndex = 1;
+          const BST tint_symbol_2 = {5, -1, -1};
+          tree[1] = tint_symbol_2;
+          x_90_phi = true;
+          break;
+        } else {
+          x_88 = tree[x_82_save].leftIndex;
+          x_63_phi = x_88;
+          {
+            x_63 = x_63_phi;
+            x_62_phi = x_63;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_74_save = x_62;
+        const int x_75 = tree[x_74_save].rightIndex;
+        if ((x_75 == -1)) {
+          tree[x_74_save].rightIndex = 1;
+          const BST tint_symbol_3 = {5, -1, -1};
+          tree[1] = tint_symbol_3;
+          x_90_phi = true;
+          break;
+        } else {
+          x_80 = tree[x_74_save].rightIndex;
+          x_63_phi = x_80;
+          {
+            x_63 = x_63_phi;
+            x_62_phi = x_63;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_63 = x_63_phi;
+        x_62_phi = x_63;
+      }
+    }
+    if (x_90_phi) {
+      break;
+    }
+  } while (false);
+  int x_95_phi = 0;
+  bool x_123_phi = false;
+  0u;
+  do {
+    x_95_phi = 0;
+    [loop] while (true) {
+      int x_121 = 0;
+      int x_113 = 0;
+      int x_96 = 0;
+      int x_96_phi = 0;
+      const int x_95 = x_95_phi;
+      x_123_phi = false;
+      if ((x_95 <= 2)) {
+      } else {
+        break;
+      }
+      const int x_102 = tree[x_95].data;
+      if ((12 <= x_102)) {
+        const int x_115_save = x_95;
+        const int x_116 = tree[x_115_save].leftIndex;
+        if ((x_116 == -1)) {
+          tree[x_115_save].leftIndex = 2;
+          const BST tint_symbol_4 = {12, -1, -1};
+          tree[2] = tint_symbol_4;
+          x_123_phi = true;
+          break;
+        } else {
+          x_121 = tree[x_115_save].leftIndex;
+          x_96_phi = x_121;
+          {
+            x_96 = x_96_phi;
+            x_95_phi = x_96;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_107_save = x_95;
+        const int x_108 = tree[x_107_save].rightIndex;
+        if ((x_108 == -1)) {
+          tree[x_107_save].rightIndex = 2;
+          const BST tint_symbol_5 = {12, -1, -1};
+          tree[2] = tint_symbol_5;
+          x_123_phi = true;
+          break;
+        } else {
+          x_113 = tree[x_107_save].rightIndex;
+          x_96_phi = x_113;
+          {
+            x_96 = x_96_phi;
+            x_95_phi = x_96;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_96 = x_96_phi;
+        x_95_phi = x_96;
+      }
+    }
+    if (x_123_phi) {
+      break;
+    }
+  } while (false);
+  int x_128_phi = 0;
+  bool x_156_phi = false;
+  0u;
+  do {
+    x_128_phi = 0;
+    [loop] while (true) {
+      int x_154 = 0;
+      int x_146 = 0;
+      int x_129 = 0;
+      int x_129_phi = 0;
+      const int x_128 = x_128_phi;
+      x_156_phi = false;
+      if ((x_128 <= 3)) {
+      } else {
+        break;
+      }
+      const int x_135 = tree[x_128].data;
+      if ((15 <= x_135)) {
+        const int x_148_save = x_128;
+        const int x_149 = tree[x_148_save].leftIndex;
+        if ((x_149 == -1)) {
+          tree[x_148_save].leftIndex = 3;
+          const BST tint_symbol_6 = {15, -1, -1};
+          tree[3] = tint_symbol_6;
+          x_156_phi = true;
+          break;
+        } else {
+          x_154 = tree[x_148_save].leftIndex;
+          x_129_phi = x_154;
+          {
+            x_129 = x_129_phi;
+            x_128_phi = x_129;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_140_save = x_128;
+        const int x_141 = tree[x_140_save].rightIndex;
+        if ((x_141 == -1)) {
+          tree[x_140_save].rightIndex = 3;
+          const BST tint_symbol_7 = {15, -1, -1};
+          tree[3] = tint_symbol_7;
+          x_156_phi = true;
+          break;
+        } else {
+          x_146 = tree[x_140_save].rightIndex;
+          x_129_phi = x_146;
+          {
+            x_129 = x_129_phi;
+            x_128_phi = x_129;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_129 = x_129_phi;
+        x_128_phi = x_129;
+      }
+    }
+    if (x_156_phi) {
+      break;
+    }
+  } while (false);
+  int x_161_phi = 0;
+  bool x_189_phi = false;
+  0u;
+  do {
+    x_161_phi = 0;
+    [loop] while (true) {
+      int x_187 = 0;
+      int x_179 = 0;
+      int x_162 = 0;
+      int x_162_phi = 0;
+      const int x_161 = x_161_phi;
+      x_189_phi = false;
+      if ((x_161 <= 4)) {
+      } else {
+        break;
+      }
+      const int x_168 = tree[x_161].data;
+      if ((7 <= x_168)) {
+        const int x_181_save = x_161;
+        const int x_182 = tree[x_181_save].leftIndex;
+        if ((x_182 == -1)) {
+          tree[x_181_save].leftIndex = 4;
+          const BST tint_symbol_8 = {7, -1, -1};
+          tree[4] = tint_symbol_8;
+          x_189_phi = true;
+          break;
+        } else {
+          x_187 = tree[x_181_save].leftIndex;
+          x_162_phi = x_187;
+          {
+            x_162 = x_162_phi;
+            x_161_phi = x_162;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_173_save = x_161;
+        const int x_174 = tree[x_173_save].rightIndex;
+        if ((x_174 == -1)) {
+          tree[x_173_save].rightIndex = 4;
+          const BST tint_symbol_9 = {7, -1, -1};
+          tree[4] = tint_symbol_9;
+          x_189_phi = true;
+          break;
+        } else {
+          x_179 = tree[x_173_save].rightIndex;
+          x_162_phi = x_179;
+          {
+            x_162 = x_162_phi;
+            x_161_phi = x_162;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_162 = x_162_phi;
+        x_161_phi = x_162;
+      }
+    }
+    if (x_189_phi) {
+      break;
+    }
+  } while (false);
+  int x_194_phi = 0;
+  bool x_222_phi = false;
+  0u;
+  do {
+    x_194_phi = 0;
+    [loop] while (true) {
+      int x_220 = 0;
+      int x_212 = 0;
+      int x_195 = 0;
+      int x_195_phi = 0;
+      const int x_194 = x_194_phi;
+      x_222_phi = false;
+      if ((x_194 <= 5)) {
+      } else {
+        break;
+      }
+      const int x_201 = tree[x_194].data;
+      if ((8 <= x_201)) {
+        const int x_214_save = x_194;
+        const int x_215 = tree[x_214_save].leftIndex;
+        if ((x_215 == -1)) {
+          tree[x_214_save].leftIndex = 5;
+          const BST tint_symbol_10 = {8, -1, -1};
+          tree[5] = tint_symbol_10;
+          x_222_phi = true;
+          break;
+        } else {
+          x_220 = tree[x_214_save].leftIndex;
+          x_195_phi = x_220;
+          {
+            x_195 = x_195_phi;
+            x_194_phi = x_195;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_206_save = x_194;
+        const int x_207 = tree[x_206_save].rightIndex;
+        if ((x_207 == -1)) {
+          tree[x_206_save].rightIndex = 5;
+          const BST tint_symbol_11 = {8, -1, -1};
+          tree[5] = tint_symbol_11;
+          x_222_phi = true;
+          break;
+        } else {
+          x_212 = tree[x_206_save].rightIndex;
+          x_195_phi = x_212;
+          {
+            x_195 = x_195_phi;
+            x_194_phi = x_195;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_195 = x_195_phi;
+        x_194_phi = x_195;
+      }
+    }
+    if (x_222_phi) {
+      break;
+    }
+  } while (false);
+  int x_227_phi = 0;
+  bool x_255_phi = false;
+  0u;
+  do {
+    x_227_phi = 0;
+    [loop] while (true) {
+      int x_253 = 0;
+      int x_245 = 0;
+      int x_228 = 0;
+      int x_228_phi = 0;
+      const int x_227 = x_227_phi;
+      x_255_phi = false;
+      if ((x_227 <= 6)) {
+      } else {
+        break;
+      }
+      const int x_234 = tree[x_227].data;
+      if ((2 <= x_234)) {
+        const int x_247_save = x_227;
+        const int x_248 = tree[x_247_save].leftIndex;
+        if ((x_248 == -1)) {
+          tree[x_247_save].leftIndex = 6;
+          const BST tint_symbol_12 = {2, -1, -1};
+          tree[6] = tint_symbol_12;
+          x_255_phi = true;
+          break;
+        } else {
+          x_253 = tree[x_247_save].leftIndex;
+          x_228_phi = x_253;
+          {
+            x_228 = x_228_phi;
+            x_227_phi = x_228;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_239_save = x_227;
+        const int x_240 = tree[x_239_save].rightIndex;
+        if ((x_240 == -1)) {
+          tree[x_239_save].rightIndex = 6;
+          const BST tint_symbol_13 = {2, -1, -1};
+          tree[6] = tint_symbol_13;
+          x_255_phi = true;
+          break;
+        } else {
+          x_245 = tree[x_239_save].rightIndex;
+          x_228_phi = x_245;
+          {
+            x_228 = x_228_phi;
+            x_227_phi = x_228;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_228 = x_228_phi;
+        x_227_phi = x_228;
+      }
+    }
+    if (x_255_phi) {
+      break;
+    }
+  } while (false);
+  int x_260_phi = 0;
+  bool x_288_phi = false;
+  0u;
+  do {
+    x_260_phi = 0;
+    [loop] while (true) {
+      int x_286 = 0;
+      int x_278 = 0;
+      int x_261 = 0;
+      int x_261_phi = 0;
+      const int x_260 = x_260_phi;
+      x_288_phi = false;
+      if ((x_260 <= 7)) {
+      } else {
+        break;
+      }
+      const int x_267 = tree[x_260].data;
+      if ((6 <= x_267)) {
+        const int x_280_save = x_260;
+        const int x_281 = tree[x_280_save].leftIndex;
+        if ((x_281 == -1)) {
+          tree[x_280_save].leftIndex = 7;
+          const BST tint_symbol_14 = {6, -1, -1};
+          tree[7] = tint_symbol_14;
+          x_288_phi = true;
+          break;
+        } else {
+          x_286 = tree[x_280_save].leftIndex;
+          x_261_phi = x_286;
+          {
+            x_261 = x_261_phi;
+            x_260_phi = x_261;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_272_save = x_260;
+        const int x_273 = tree[x_272_save].rightIndex;
+        if ((x_273 == -1)) {
+          tree[x_272_save].rightIndex = 7;
+          const BST tint_symbol_15 = {6, -1, -1};
+          tree[7] = tint_symbol_15;
+          x_288_phi = true;
+          break;
+        } else {
+          x_278 = tree[x_272_save].rightIndex;
+          x_261_phi = x_278;
+          {
+            x_261 = x_261_phi;
+            x_260_phi = x_261;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_261 = x_261_phi;
+        x_260_phi = x_261;
+      }
+    }
+    if (x_288_phi) {
+      break;
+    }
+  } while (false);
+  int x_293_phi = 0;
+  bool x_321_phi = false;
+  0u;
+  do {
+    x_293_phi = 0;
+    [loop] while (true) {
+      int x_319 = 0;
+      int x_311 = 0;
+      int x_294 = 0;
+      int x_294_phi = 0;
+      const int x_293 = x_293_phi;
+      x_321_phi = false;
+      if ((x_293 <= 8)) {
+      } else {
+        break;
+      }
+      const int x_300 = tree[x_293].data;
+      if ((17 <= x_300)) {
+        const int x_313_save = x_293;
+        const int x_314 = tree[x_313_save].leftIndex;
+        if ((x_314 == -1)) {
+          tree[x_313_save].leftIndex = 8;
+          const BST tint_symbol_16 = {17, -1, -1};
+          tree[8] = tint_symbol_16;
+          x_321_phi = true;
+          break;
+        } else {
+          x_319 = tree[x_313_save].leftIndex;
+          x_294_phi = x_319;
+          {
+            x_294 = x_294_phi;
+            x_293_phi = x_294;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_305_save = x_293;
+        const int x_306 = tree[x_305_save].rightIndex;
+        if ((x_306 == -1)) {
+          tree[x_305_save].rightIndex = 8;
+          const BST tint_symbol_17 = {17, -1, -1};
+          tree[8] = tint_symbol_17;
+          x_321_phi = true;
+          break;
+        } else {
+          x_311 = tree[x_305_save].rightIndex;
+          x_294_phi = x_311;
+          {
+            x_294 = x_294_phi;
+            x_293_phi = x_294;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_294 = x_294_phi;
+        x_293_phi = x_294;
+      }
+    }
+    if (x_321_phi) {
+      break;
+    }
+  } while (false);
+  int x_326_phi = 0;
+  bool x_354_phi = false;
+  0u;
+  do {
+    x_326_phi = 0;
+    [loop] while (true) {
+      int x_352 = 0;
+      int x_344 = 0;
+      int x_327 = 0;
+      int x_327_phi = 0;
+      const int x_326 = x_326_phi;
+      x_354_phi = false;
+      if ((x_326 <= 9)) {
+      } else {
+        break;
+      }
+      const int x_333 = tree[x_326].data;
+      if ((13 <= x_333)) {
+        const int x_346_save = x_326;
+        const int x_347 = tree[x_346_save].leftIndex;
+        if ((x_347 == -1)) {
+          tree[x_346_save].leftIndex = 9;
+          const BST tint_symbol_18 = {13, -1, -1};
+          tree[9] = tint_symbol_18;
+          x_354_phi = true;
+          break;
+        } else {
+          x_352 = tree[x_346_save].leftIndex;
+          x_327_phi = x_352;
+          {
+            x_327 = x_327_phi;
+            x_326_phi = x_327;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_338_save = x_326;
+        const int x_339 = tree[x_338_save].rightIndex;
+        if ((x_339 == -1)) {
+          tree[x_338_save].rightIndex = 9;
+          const BST tint_symbol_19 = {13, -1, -1};
+          tree[9] = tint_symbol_19;
+          x_354_phi = true;
+          break;
+        } else {
+          x_344 = tree[x_338_save].rightIndex;
+          x_327_phi = x_344;
+          {
+            x_327 = x_327_phi;
+            x_326_phi = x_327;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_327 = x_327_phi;
+        x_326_phi = x_327;
+      }
+    }
+    if (x_354_phi) {
+      break;
+    }
+  } while (false);
+  x_357_phi = 0;
+  x_360_phi = 0;
+  x_362_phi = 0;
+  [loop] while (true) {
+    int x_392 = 0;
+    int x_402 = 0;
+    int x_407 = 0;
+    int x_363 = 0;
+    int x_358_phi = 0;
+    int x_361_phi = 0;
+    const int x_357 = x_357_phi;
+    x_360 = x_360_phi;
+    const int x_362 = x_362_phi;
+    const int x_365 = (6 - 15);
+    if ((x_362 < 20)) {
+    } else {
+      break;
+    }
+    int x_374_phi = 0;
+    int x_392_phi = 0;
+    bool x_393_phi = false;
+    0u;
+    do {
+      x_374_phi = 0;
+      [loop] while (true) {
+        const int x_374 = x_374_phi;
+        x_392_phi = x_357;
+        x_393_phi = false;
+        if ((x_374 != -1)) {
+        } else {
+          break;
+        }
+        const BST x_381 = tree[x_374];
+        const int x_382 = x_381.data;
+        const int x_383 = x_381.leftIndex;
+        const int x_385 = x_381.rightIndex;
+        if ((x_382 == x_362)) {
+          x_392_phi = x_362;
+          x_393_phi = true;
+          break;
+        }
+        const float x_389 = x_GLF_color[((3u <= 3u) ? 3u : 3u)];
+        {
+          x_374_phi = (!((x_362 <= x_382)) ? x_385 : x_383);
+        }
+      }
+      x_392 = x_392_phi;
+      const bool x_393 = x_393_phi;
+      x_358_phi = x_392;
+      if (x_393) {
+        break;
+      }
+      x_358_phi = -1;
+    } while (false);
+    int x_358 = 0;
+    int x_401 = 0;
+    int x_406 = 0;
+    int x_402_phi = 0;
+    int x_407_phi = 0;
+    x_358 = x_358_phi;
+    switch(x_362) {
+      case 2:
+      case 5:
+      case 6:
+      case 7:
+      case 8:
+      case 9:
+      case 12:
+      case 13:
+      case 15:
+      case 17: {
+        x_402_phi = x_360;
+        if ((x_358 == asint(x_362))) {
+          x_401 = asint((x_360 + asint(1)));
+          x_402_phi = x_401;
+        }
+        x_402 = x_402_phi;
+        x_361_phi = x_402;
+        break;
+      }
+      default: {
+        x_407_phi = x_360;
+        if ((x_358 == asint(-1))) {
+          x_406 = asint((x_360 + asint(1)));
+          x_407_phi = x_406;
+        }
+        x_407 = x_407_phi;
+        x_361_phi = x_407;
+        break;
+      }
+    }
+    const int x_361 = x_361_phi;
+    {
+      x_363 = (x_362 + 1);
+      x_357_phi = x_358;
+      x_360_phi = x_361;
+      x_362_phi = x_363;
+    }
+  }
+  if ((x_360 == asint(20))) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_20 = {x_GLF_color};
+  return tint_symbol_20;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001F9FB4F5860(82,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(22,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x000001F9FB4F5860(148,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(214,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(280,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(346,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(412,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(478,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(544,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(610,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F9FB4F5860(664,7-19): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl
new file mode 100644
index 0000000..bbd743b
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.hlsl
@@ -0,0 +1,859 @@
+SKIP: FAILED
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:46:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:60:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:62:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:105:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:119:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:121:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:164:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:178:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:180:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:223:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:237:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:239:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:282:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:296:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:298:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:341:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:355:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:357:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:400:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:414:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:416:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:459:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:473:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:475:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:518:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:532:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl:534:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  BST tree[10] = (BST[10])0;
+  int x_360 = 0;
+  int x_62_phi = 0;
+  bool x_90_phi = false;
+  int x_357_phi = 0;
+  int x_360_phi = 0;
+  int x_362_phi = 0;
+  const BST tint_symbol_1 = {9, -1, -1};
+  tree[0] = tint_symbol_1;
+  0u;
+  do {
+    x_62_phi = 0;
+    [loop] while (true) {
+      int x_88 = 0;
+      int x_80 = 0;
+      int x_63 = 0;
+      int x_63_phi = 0;
+      const int x_62 = x_62_phi;
+      x_90_phi = false;
+      if ((x_62 <= 1)) {
+      } else {
+        break;
+      }
+      const int x_69 = tree[x_62].data;
+      if ((5 <= x_69)) {
+        const int x_82_save = x_62;
+        const int x_83 = tree[x_82_save].leftIndex;
+        if ((x_83 == -1)) {
+          tree[x_82_save].leftIndex = 1;
+          const BST tint_symbol_2 = {5, -1, -1};
+          tree[1] = tint_symbol_2;
+          x_90_phi = true;
+          break;
+        } else {
+          x_88 = tree[x_82_save].leftIndex;
+          x_63_phi = x_88;
+          {
+            x_63 = x_63_phi;
+            x_62_phi = x_63;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_74_save = x_62;
+        const int x_75 = tree[x_74_save].rightIndex;
+        if ((x_75 == -1)) {
+          tree[x_74_save].rightIndex = 1;
+          const BST tint_symbol_3 = {5, -1, -1};
+          tree[1] = tint_symbol_3;
+          x_90_phi = true;
+          break;
+        } else {
+          x_80 = tree[x_74_save].rightIndex;
+          x_63_phi = x_80;
+          {
+            x_63 = x_63_phi;
+            x_62_phi = x_63;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_63 = x_63_phi;
+        x_62_phi = x_63;
+      }
+    }
+    if (x_90_phi) {
+      break;
+    }
+  } while (false);
+  int x_95_phi = 0;
+  bool x_123_phi = false;
+  0u;
+  do {
+    x_95_phi = 0;
+    [loop] while (true) {
+      int x_121 = 0;
+      int x_113 = 0;
+      int x_96 = 0;
+      int x_96_phi = 0;
+      const int x_95 = x_95_phi;
+      x_123_phi = false;
+      if ((x_95 <= 2)) {
+      } else {
+        break;
+      }
+      const int x_102 = tree[x_95].data;
+      if ((12 <= x_102)) {
+        const int x_115_save = x_95;
+        const int x_116 = tree[x_115_save].leftIndex;
+        if ((x_116 == -1)) {
+          tree[x_115_save].leftIndex = 2;
+          const BST tint_symbol_4 = {12, -1, -1};
+          tree[2] = tint_symbol_4;
+          x_123_phi = true;
+          break;
+        } else {
+          x_121 = tree[x_115_save].leftIndex;
+          x_96_phi = x_121;
+          {
+            x_96 = x_96_phi;
+            x_95_phi = x_96;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_107_save = x_95;
+        const int x_108 = tree[x_107_save].rightIndex;
+        if ((x_108 == -1)) {
+          tree[x_107_save].rightIndex = 2;
+          const BST tint_symbol_5 = {12, -1, -1};
+          tree[2] = tint_symbol_5;
+          x_123_phi = true;
+          break;
+        } else {
+          x_113 = tree[x_107_save].rightIndex;
+          x_96_phi = x_113;
+          {
+            x_96 = x_96_phi;
+            x_95_phi = x_96;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_96 = x_96_phi;
+        x_95_phi = x_96;
+      }
+    }
+    if (x_123_phi) {
+      break;
+    }
+  } while (false);
+  int x_128_phi = 0;
+  bool x_156_phi = false;
+  0u;
+  do {
+    x_128_phi = 0;
+    [loop] while (true) {
+      int x_154 = 0;
+      int x_146 = 0;
+      int x_129 = 0;
+      int x_129_phi = 0;
+      const int x_128 = x_128_phi;
+      x_156_phi = false;
+      if ((x_128 <= 3)) {
+      } else {
+        break;
+      }
+      const int x_135 = tree[x_128].data;
+      if ((15 <= x_135)) {
+        const int x_148_save = x_128;
+        const int x_149 = tree[x_148_save].leftIndex;
+        if ((x_149 == -1)) {
+          tree[x_148_save].leftIndex = 3;
+          const BST tint_symbol_6 = {15, -1, -1};
+          tree[3] = tint_symbol_6;
+          x_156_phi = true;
+          break;
+        } else {
+          x_154 = tree[x_148_save].leftIndex;
+          x_129_phi = x_154;
+          {
+            x_129 = x_129_phi;
+            x_128_phi = x_129;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_140_save = x_128;
+        const int x_141 = tree[x_140_save].rightIndex;
+        if ((x_141 == -1)) {
+          tree[x_140_save].rightIndex = 3;
+          const BST tint_symbol_7 = {15, -1, -1};
+          tree[3] = tint_symbol_7;
+          x_156_phi = true;
+          break;
+        } else {
+          x_146 = tree[x_140_save].rightIndex;
+          x_129_phi = x_146;
+          {
+            x_129 = x_129_phi;
+            x_128_phi = x_129;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_129 = x_129_phi;
+        x_128_phi = x_129;
+      }
+    }
+    if (x_156_phi) {
+      break;
+    }
+  } while (false);
+  int x_161_phi = 0;
+  bool x_189_phi = false;
+  0u;
+  do {
+    x_161_phi = 0;
+    [loop] while (true) {
+      int x_187 = 0;
+      int x_179 = 0;
+      int x_162 = 0;
+      int x_162_phi = 0;
+      const int x_161 = x_161_phi;
+      x_189_phi = false;
+      if ((x_161 <= 4)) {
+      } else {
+        break;
+      }
+      const int x_168 = tree[x_161].data;
+      if ((7 <= x_168)) {
+        const int x_181_save = x_161;
+        const int x_182 = tree[x_181_save].leftIndex;
+        if ((x_182 == -1)) {
+          tree[x_181_save].leftIndex = 4;
+          const BST tint_symbol_8 = {7, -1, -1};
+          tree[4] = tint_symbol_8;
+          x_189_phi = true;
+          break;
+        } else {
+          x_187 = tree[x_181_save].leftIndex;
+          x_162_phi = x_187;
+          {
+            x_162 = x_162_phi;
+            x_161_phi = x_162;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_173_save = x_161;
+        const int x_174 = tree[x_173_save].rightIndex;
+        if ((x_174 == -1)) {
+          tree[x_173_save].rightIndex = 4;
+          const BST tint_symbol_9 = {7, -1, -1};
+          tree[4] = tint_symbol_9;
+          x_189_phi = true;
+          break;
+        } else {
+          x_179 = tree[x_173_save].rightIndex;
+          x_162_phi = x_179;
+          {
+            x_162 = x_162_phi;
+            x_161_phi = x_162;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_162 = x_162_phi;
+        x_161_phi = x_162;
+      }
+    }
+    if (x_189_phi) {
+      break;
+    }
+  } while (false);
+  int x_194_phi = 0;
+  bool x_222_phi = false;
+  0u;
+  do {
+    x_194_phi = 0;
+    [loop] while (true) {
+      int x_220 = 0;
+      int x_212 = 0;
+      int x_195 = 0;
+      int x_195_phi = 0;
+      const int x_194 = x_194_phi;
+      x_222_phi = false;
+      if ((x_194 <= 5)) {
+      } else {
+        break;
+      }
+      const int x_201 = tree[x_194].data;
+      if ((8 <= x_201)) {
+        const int x_214_save = x_194;
+        const int x_215 = tree[x_214_save].leftIndex;
+        if ((x_215 == -1)) {
+          tree[x_214_save].leftIndex = 5;
+          const BST tint_symbol_10 = {8, -1, -1};
+          tree[5] = tint_symbol_10;
+          x_222_phi = true;
+          break;
+        } else {
+          x_220 = tree[x_214_save].leftIndex;
+          x_195_phi = x_220;
+          {
+            x_195 = x_195_phi;
+            x_194_phi = x_195;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_206_save = x_194;
+        const int x_207 = tree[x_206_save].rightIndex;
+        if ((x_207 == -1)) {
+          tree[x_206_save].rightIndex = 5;
+          const BST tint_symbol_11 = {8, -1, -1};
+          tree[5] = tint_symbol_11;
+          x_222_phi = true;
+          break;
+        } else {
+          x_212 = tree[x_206_save].rightIndex;
+          x_195_phi = x_212;
+          {
+            x_195 = x_195_phi;
+            x_194_phi = x_195;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_195 = x_195_phi;
+        x_194_phi = x_195;
+      }
+    }
+    if (x_222_phi) {
+      break;
+    }
+  } while (false);
+  int x_227_phi = 0;
+  bool x_255_phi = false;
+  0u;
+  do {
+    x_227_phi = 0;
+    [loop] while (true) {
+      int x_253 = 0;
+      int x_245 = 0;
+      int x_228 = 0;
+      int x_228_phi = 0;
+      const int x_227 = x_227_phi;
+      x_255_phi = false;
+      if ((x_227 <= 6)) {
+      } else {
+        break;
+      }
+      const int x_234 = tree[x_227].data;
+      if ((2 <= x_234)) {
+        const int x_247_save = x_227;
+        const int x_248 = tree[x_247_save].leftIndex;
+        if ((x_248 == -1)) {
+          tree[x_247_save].leftIndex = 6;
+          const BST tint_symbol_12 = {2, -1, -1};
+          tree[6] = tint_symbol_12;
+          x_255_phi = true;
+          break;
+        } else {
+          x_253 = tree[x_247_save].leftIndex;
+          x_228_phi = x_253;
+          {
+            x_228 = x_228_phi;
+            x_227_phi = x_228;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_239_save = x_227;
+        const int x_240 = tree[x_239_save].rightIndex;
+        if ((x_240 == -1)) {
+          tree[x_239_save].rightIndex = 6;
+          const BST tint_symbol_13 = {2, -1, -1};
+          tree[6] = tint_symbol_13;
+          x_255_phi = true;
+          break;
+        } else {
+          x_245 = tree[x_239_save].rightIndex;
+          x_228_phi = x_245;
+          {
+            x_228 = x_228_phi;
+            x_227_phi = x_228;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_228 = x_228_phi;
+        x_227_phi = x_228;
+      }
+    }
+    if (x_255_phi) {
+      break;
+    }
+  } while (false);
+  int x_260_phi = 0;
+  bool x_288_phi = false;
+  0u;
+  do {
+    x_260_phi = 0;
+    [loop] while (true) {
+      int x_286 = 0;
+      int x_278 = 0;
+      int x_261 = 0;
+      int x_261_phi = 0;
+      const int x_260 = x_260_phi;
+      x_288_phi = false;
+      if ((x_260 <= 7)) {
+      } else {
+        break;
+      }
+      const int x_267 = tree[x_260].data;
+      if ((6 <= x_267)) {
+        const int x_280_save = x_260;
+        const int x_281 = tree[x_280_save].leftIndex;
+        if ((x_281 == -1)) {
+          tree[x_280_save].leftIndex = 7;
+          const BST tint_symbol_14 = {6, -1, -1};
+          tree[7] = tint_symbol_14;
+          x_288_phi = true;
+          break;
+        } else {
+          x_286 = tree[x_280_save].leftIndex;
+          x_261_phi = x_286;
+          {
+            x_261 = x_261_phi;
+            x_260_phi = x_261;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_272_save = x_260;
+        const int x_273 = tree[x_272_save].rightIndex;
+        if ((x_273 == -1)) {
+          tree[x_272_save].rightIndex = 7;
+          const BST tint_symbol_15 = {6, -1, -1};
+          tree[7] = tint_symbol_15;
+          x_288_phi = true;
+          break;
+        } else {
+          x_278 = tree[x_272_save].rightIndex;
+          x_261_phi = x_278;
+          {
+            x_261 = x_261_phi;
+            x_260_phi = x_261;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_261 = x_261_phi;
+        x_260_phi = x_261;
+      }
+    }
+    if (x_288_phi) {
+      break;
+    }
+  } while (false);
+  int x_293_phi = 0;
+  bool x_321_phi = false;
+  0u;
+  do {
+    x_293_phi = 0;
+    [loop] while (true) {
+      int x_319 = 0;
+      int x_311 = 0;
+      int x_294 = 0;
+      int x_294_phi = 0;
+      const int x_293 = x_293_phi;
+      x_321_phi = false;
+      if ((x_293 <= 8)) {
+      } else {
+        break;
+      }
+      const int x_300 = tree[x_293].data;
+      if ((17 <= x_300)) {
+        const int x_313_save = x_293;
+        const int x_314 = tree[x_313_save].leftIndex;
+        if ((x_314 == -1)) {
+          tree[x_313_save].leftIndex = 8;
+          const BST tint_symbol_16 = {17, -1, -1};
+          tree[8] = tint_symbol_16;
+          x_321_phi = true;
+          break;
+        } else {
+          x_319 = tree[x_313_save].leftIndex;
+          x_294_phi = x_319;
+          {
+            x_294 = x_294_phi;
+            x_293_phi = x_294;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_305_save = x_293;
+        const int x_306 = tree[x_305_save].rightIndex;
+        if ((x_306 == -1)) {
+          tree[x_305_save].rightIndex = 8;
+          const BST tint_symbol_17 = {17, -1, -1};
+          tree[8] = tint_symbol_17;
+          x_321_phi = true;
+          break;
+        } else {
+          x_311 = tree[x_305_save].rightIndex;
+          x_294_phi = x_311;
+          {
+            x_294 = x_294_phi;
+            x_293_phi = x_294;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_294 = x_294_phi;
+        x_293_phi = x_294;
+      }
+    }
+    if (x_321_phi) {
+      break;
+    }
+  } while (false);
+  int x_326_phi = 0;
+  bool x_354_phi = false;
+  0u;
+  do {
+    x_326_phi = 0;
+    [loop] while (true) {
+      int x_352 = 0;
+      int x_344 = 0;
+      int x_327 = 0;
+      int x_327_phi = 0;
+      const int x_326 = x_326_phi;
+      x_354_phi = false;
+      if ((x_326 <= 9)) {
+      } else {
+        break;
+      }
+      const int x_333 = tree[x_326].data;
+      if ((13 <= x_333)) {
+        const int x_346_save = x_326;
+        const int x_347 = tree[x_346_save].leftIndex;
+        if ((x_347 == -1)) {
+          tree[x_346_save].leftIndex = 9;
+          const BST tint_symbol_18 = {13, -1, -1};
+          tree[9] = tint_symbol_18;
+          x_354_phi = true;
+          break;
+        } else {
+          x_352 = tree[x_346_save].leftIndex;
+          x_327_phi = x_352;
+          {
+            x_327 = x_327_phi;
+            x_326_phi = x_327;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_338_save = x_326;
+        const int x_339 = tree[x_338_save].rightIndex;
+        if ((x_339 == -1)) {
+          tree[x_338_save].rightIndex = 9;
+          const BST tint_symbol_19 = {13, -1, -1};
+          tree[9] = tint_symbol_19;
+          x_354_phi = true;
+          break;
+        } else {
+          x_344 = tree[x_338_save].rightIndex;
+          x_327_phi = x_344;
+          {
+            x_327 = x_327_phi;
+            x_326_phi = x_327;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_327 = x_327_phi;
+        x_326_phi = x_327;
+      }
+    }
+    if (x_354_phi) {
+      break;
+    }
+  } while (false);
+  x_357_phi = 0;
+  x_360_phi = 0;
+  x_362_phi = 0;
+  [loop] while (true) {
+    int x_392 = 0;
+    int x_402 = 0;
+    int x_407 = 0;
+    int x_363 = 0;
+    int x_358_phi = 0;
+    int x_361_phi = 0;
+    const int x_357 = x_357_phi;
+    x_360 = x_360_phi;
+    const int x_362 = x_362_phi;
+    const int x_365 = (6 - 15);
+    if ((x_362 < 20)) {
+    } else {
+      break;
+    }
+    int x_374_phi = 0;
+    int x_392_phi = 0;
+    bool x_393_phi = false;
+    0u;
+    do {
+      x_374_phi = 0;
+      [loop] while (true) {
+        const int x_374 = x_374_phi;
+        x_392_phi = x_357;
+        x_393_phi = false;
+        if ((x_374 != -1)) {
+        } else {
+          break;
+        }
+        const BST x_381 = tree[x_374];
+        const int x_382 = x_381.data;
+        const int x_383 = x_381.leftIndex;
+        const int x_385 = x_381.rightIndex;
+        if ((x_382 == x_362)) {
+          x_392_phi = x_362;
+          x_393_phi = true;
+          break;
+        }
+        const float x_389 = x_GLF_color[((3u <= 3u) ? 3u : 3u)];
+        {
+          x_374_phi = (!((x_362 <= x_382)) ? x_385 : x_383);
+        }
+      }
+      x_392 = x_392_phi;
+      const bool x_393 = x_393_phi;
+      x_358_phi = x_392;
+      if (x_393) {
+        break;
+      }
+      x_358_phi = -1;
+    } while (false);
+    int x_358 = 0;
+    int x_401 = 0;
+    int x_406 = 0;
+    int x_402_phi = 0;
+    int x_407_phi = 0;
+    x_358 = x_358_phi;
+    switch(x_362) {
+      case 2:
+      case 5:
+      case 6:
+      case 7:
+      case 8:
+      case 9:
+      case 12:
+      case 13:
+      case 15:
+      case 17: {
+        x_402_phi = x_360;
+        if ((x_358 == asint(x_362))) {
+          x_401 = asint((x_360 + asint(1)));
+          x_402_phi = x_401;
+        }
+        x_402 = x_402_phi;
+        x_361_phi = x_402;
+        break;
+      }
+      default: {
+        x_407_phi = x_360;
+        if ((x_358 == asint(-1))) {
+          x_406 = asint((x_360 + asint(1)));
+          x_407_phi = x_406;
+        }
+        x_407 = x_407_phi;
+        x_361_phi = x_407;
+        break;
+      }
+    }
+    const int x_361 = x_361_phi;
+    {
+      x_363 = (x_362 + 1);
+      x_357_phi = x_358;
+      x_360_phi = x_361;
+      x_362_phi = x_363;
+    }
+  }
+  if ((x_360 == asint(20))) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_20 = {x_GLF_color};
+  return tint_symbol_20;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000018520DAA240(82,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(22,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000018520DAA240(148,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(214,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(280,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(346,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(412,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(478,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(544,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(610,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000018520DAA240(664,7-19): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl
new file mode 100644
index 0000000..07c0d40
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.spvasm.expected.hlsl
@@ -0,0 +1 @@
+SKIP: flaky test that takes ~25s and often times out with FXC.
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl
new file mode 100644
index 0000000..20ec5cd
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-maze-flatten-copy-composite/1.wgsl.expected.hlsl
@@ -0,0 +1,3 @@
+SKIP: FAILED
+
+test timed out after 30s
\ No newline at end of file
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..cd7206e
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,224 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_32 : register(b0, space0) {
+  uint4 x_32[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_225 = i;
+  const int x_227 = obj.numbers[x_225];
+  temp = x_227;
+  const int x_228 = i;
+  const int x_229 = j;
+  const int x_231 = obj.numbers[x_229];
+  obj.numbers[x_228] = x_231;
+  const int x_233 = j;
+  obj.numbers[x_233] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_237 = h;
+  const int x_239 = obj.numbers[x_237];
+  pivot = x_239;
+  const int x_240 = l;
+  i_1 = (x_240 - 1);
+  const int x_242 = l;
+  j_1 = x_242;
+  [loop] while (true) {
+    const int x_247 = j_1;
+    const int x_248 = h;
+    if ((x_247 <= (x_248 - 1))) {
+    } else {
+      break;
+    }
+    const int x_254 = obj.numbers[j_1];
+    if ((x_254 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  i_1 = (i_1 + 1);
+  param_2 = i_1;
+  const int x_269 = h;
+  param_3 = x_269;
+  swap_i1_i1_(param_2, param_3);
+  return i_1;
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_274 = (top + 1);
+  top = x_274;
+  stack[x_274] = l_1;
+  const int x_278 = (top + 1);
+  top = x_278;
+  stack[x_278] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_288 = top;
+    top = (x_288 - 1);
+    const int x_291 = stack[x_288];
+    h_1 = x_291;
+    const int x_292 = top;
+    top = (x_292 - 1);
+    const int x_295 = stack[x_292];
+    l_1 = x_295;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_298 = performPartition_i1_i1_(param_4, param_5);
+    p = x_298;
+    if (((p - 1) > l_1)) {
+      const int x_306 = (top + 1);
+      top = x_306;
+      stack[x_306] = l_1;
+      const int x_310 = (top + 1);
+      top = x_310;
+      stack[x_310] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_321 = (top + 1);
+      top = x_321;
+      stack[x_321] = (p + 1);
+      const int x_326 = (top + 1);
+      top = x_326;
+      stack[x_326] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_92 = i_2;
+      const int x_95 = obj.numbers[i_2];
+      const int x_98 = obj.numbers[i_2];
+      obj.numbers[x_92] = (x_95 * x_98);
+    }
+  }
+  quicksort_();
+  const float4 x_104 = gl_FragCoord;
+  const float2 x_107 = asfloat(x_32[0].xy);
+  uv = (float2(x_104.x, x_104.y) / x_107);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_110 = obj.numbers[0];
+  const float x_113 = color.x;
+  color.x = (x_113 + float(x_110));
+  const float x_117 = uv.x;
+  if ((x_117 > 0.25f)) {
+    const int x_122 = obj.numbers[1];
+    const float x_125 = color.x;
+    color.x = (x_125 + float(x_122));
+  }
+  const float x_129 = uv.x;
+  if ((x_129 > 0.5f)) {
+    const int x_134 = obj.numbers[2];
+    const float x_137 = color.y;
+    color.y = (x_137 + float(x_134));
+  }
+  const float x_141 = uv.x;
+  if ((x_141 > 0.75f)) {
+    const int x_146 = obj.numbers[3];
+    const float x_149 = color.z;
+    color.z = (x_149 + float(x_146));
+  }
+  const int x_153 = obj.numbers[4];
+  const float x_156 = color.y;
+  color.y = (x_156 + float(x_153));
+  const float x_160 = uv.y;
+  if ((x_160 > 0.25f)) {
+    const int x_165 = obj.numbers[5];
+    const float x_168 = color.x;
+    color.x = (x_168 + float(x_165));
+  }
+  const float x_172 = uv.y;
+  if ((x_172 > 0.5f)) {
+    const int x_177 = obj.numbers[6];
+    const float x_180 = color.y;
+    color.y = (x_180 + float(x_177));
+  }
+  const float x_184 = uv.y;
+  if ((x_184 > 0.75f)) {
+    const int x_189 = obj.numbers[7];
+    const float x_192 = color.z;
+    color.z = (x_192 + float(x_189));
+  }
+  const int x_196 = obj.numbers[8];
+  const float x_199 = color.z;
+  color.z = (x_199 + float(x_196));
+  const float x_203 = uv.x;
+  const float x_205 = uv.y;
+  if ((abs((x_203 - x_205)) < 0.25f)) {
+    const int x_212 = obj.numbers[9];
+    const float x_215 = color.x;
+    color.x = (x_215 + float(x_212));
+  }
+  const float3 x_219 = normalize(color);
+  x_GLF_color = float4(x_219.x, x_219.y, x_219.z, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001609F0E92A0(128,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001609F0E92A0(127,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..0f29d11
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-dontinline/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,224 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_32 : register(b0, space0) {
+  uint4 x_32[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_225 = i;
+  const int x_227 = obj.numbers[x_225];
+  temp = x_227;
+  const int x_228 = i;
+  const int x_229 = j;
+  const int x_231 = obj.numbers[x_229];
+  obj.numbers[x_228] = x_231;
+  const int x_233 = j;
+  obj.numbers[x_233] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_237 = h;
+  const int x_239 = obj.numbers[x_237];
+  pivot = x_239;
+  const int x_240 = l;
+  i_1 = (x_240 - 1);
+  const int x_242 = l;
+  j_1 = x_242;
+  [loop] while (true) {
+    const int x_247 = j_1;
+    const int x_248 = h;
+    if ((x_247 <= (x_248 - 1))) {
+    } else {
+      break;
+    }
+    const int x_254 = obj.numbers[j_1];
+    if ((x_254 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  i_1 = (i_1 + 1);
+  param_2 = i_1;
+  const int x_269 = h;
+  param_3 = x_269;
+  swap_i1_i1_(param_2, param_3);
+  return i_1;
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_274 = (top + 1);
+  top = x_274;
+  stack[x_274] = l_1;
+  const int x_278 = (top + 1);
+  top = x_278;
+  stack[x_278] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_288 = top;
+    top = (x_288 - 1);
+    const int x_291 = stack[x_288];
+    h_1 = x_291;
+    const int x_292 = top;
+    top = (x_292 - 1);
+    const int x_295 = stack[x_292];
+    l_1 = x_295;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_298 = performPartition_i1_i1_(param_4, param_5);
+    p = x_298;
+    if (((p - 1) > l_1)) {
+      const int x_306 = (top + 1);
+      top = x_306;
+      stack[x_306] = l_1;
+      const int x_310 = (top + 1);
+      top = x_310;
+      stack[x_310] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_321 = (top + 1);
+      top = x_321;
+      stack[x_321] = (p + 1);
+      const int x_326 = (top + 1);
+      top = x_326;
+      stack[x_326] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_92 = i_2;
+      const int x_95 = obj.numbers[i_2];
+      const int x_98 = obj.numbers[i_2];
+      obj.numbers[x_92] = (x_95 * x_98);
+    }
+  }
+  quicksort_();
+  const float4 x_104 = gl_FragCoord;
+  const float2 x_107 = asfloat(x_32[0].xy);
+  uv = (float2(x_104.x, x_104.y) / x_107);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_110 = obj.numbers[0];
+  const float x_113 = color.x;
+  color.x = (x_113 + float(x_110));
+  const float x_117 = uv.x;
+  if ((x_117 > 0.25f)) {
+    const int x_122 = obj.numbers[1];
+    const float x_125 = color.x;
+    color.x = (x_125 + float(x_122));
+  }
+  const float x_129 = uv.x;
+  if ((x_129 > 0.5f)) {
+    const int x_134 = obj.numbers[2];
+    const float x_137 = color.y;
+    color.y = (x_137 + float(x_134));
+  }
+  const float x_141 = uv.x;
+  if ((x_141 > 0.75f)) {
+    const int x_146 = obj.numbers[3];
+    const float x_149 = color.z;
+    color.z = (x_149 + float(x_146));
+  }
+  const int x_153 = obj.numbers[4];
+  const float x_156 = color.y;
+  color.y = (x_156 + float(x_153));
+  const float x_160 = uv.y;
+  if ((x_160 > 0.25f)) {
+    const int x_165 = obj.numbers[5];
+    const float x_168 = color.x;
+    color.x = (x_168 + float(x_165));
+  }
+  const float x_172 = uv.y;
+  if ((x_172 > 0.5f)) {
+    const int x_177 = obj.numbers[6];
+    const float x_180 = color.y;
+    color.y = (x_180 + float(x_177));
+  }
+  const float x_184 = uv.y;
+  if ((x_184 > 0.75f)) {
+    const int x_189 = obj.numbers[7];
+    const float x_192 = color.z;
+    color.z = (x_192 + float(x_189));
+  }
+  const int x_196 = obj.numbers[8];
+  const float x_199 = color.z;
+  color.z = (x_199 + float(x_196));
+  const float x_203 = uv.x;
+  const float x_205 = uv.y;
+  if ((abs((x_203 - x_205)) < 0.25f)) {
+    const int x_212 = obj.numbers[9];
+    const float x_215 = color.x;
+    color.x = (x_215 + float(x_212));
+  }
+  const float3 x_219 = normalize(color);
+  x_GLF_color = float4(x_219.x, x_219.y, x_219.z, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000219A1C1C120(128,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x00000219A1C1C120(127,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.hlsl
new file mode 100644
index 0000000..fb3266e
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.spvasm.expected.hlsl
@@ -0,0 +1,224 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_32 : register(b0, space0) {
+  uint4 x_32[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j, float3x3 x_228) {
+  int temp = 0;
+  const int x_230 = i;
+  const int x_232 = obj.numbers[x_230];
+  temp = x_232;
+  const int x_233 = i;
+  const int x_234 = j;
+  const int x_236 = obj.numbers[x_234];
+  obj.numbers[x_233] = x_236;
+  const int x_238 = j;
+  obj.numbers[x_238] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_242 = h;
+  const int x_244 = obj.numbers[x_242];
+  pivot = x_244;
+  const int x_245 = l;
+  i_1 = (x_245 - 1);
+  const int x_247 = l;
+  j_1 = x_247;
+  [loop] while (true) {
+    const int x_252 = j_1;
+    const int x_253 = h;
+    if ((x_252 <= (x_253 - 1))) {
+    } else {
+      break;
+    }
+    const int x_259 = obj.numbers[j_1];
+    if ((x_259 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)));
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  i_1 = (i_1 + 1);
+  param_2 = i_1;
+  const int x_274 = h;
+  param_3 = x_274;
+  swap_i1_i1_(param_2, param_3, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)));
+  return i_1;
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_279 = (top + 1);
+  top = x_279;
+  stack[x_279] = l_1;
+  const int x_283 = (top + 1);
+  top = x_283;
+  stack[x_283] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_293 = top;
+    top = (x_293 - 1);
+    const int x_296 = stack[x_293];
+    h_1 = x_296;
+    const int x_297 = top;
+    top = (x_297 - 1);
+    const int x_300 = stack[x_297];
+    l_1 = x_300;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_303 = performPartition_i1_i1_(param_4, param_5);
+    p = x_303;
+    if (((p - 1) > l_1)) {
+      const int x_311 = (top + 1);
+      top = x_311;
+      stack[x_311] = l_1;
+      const int x_315 = (top + 1);
+      top = x_315;
+      stack[x_315] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_326 = (top + 1);
+      top = x_326;
+      stack[x_326] = (p + 1);
+      const int x_331 = (top + 1);
+      top = x_331;
+      stack[x_331] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_96 = i_2;
+      const int x_99 = obj.numbers[i_2];
+      const int x_102 = obj.numbers[i_2];
+      obj.numbers[x_96] = (x_99 * x_102);
+    }
+  }
+  quicksort_();
+  const float4 x_108 = gl_FragCoord;
+  const float2 x_111 = asfloat(x_32[0].xy);
+  uv = (float2(x_108.x, x_108.y) / x_111);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_114 = obj.numbers[0];
+  const float x_117 = color.x;
+  color.x = (x_117 + float(x_114));
+  const float x_121 = uv.x;
+  if ((x_121 > 0.25f)) {
+    const int x_126 = obj.numbers[1];
+    const float x_129 = color.x;
+    color.x = (x_129 + float(x_126));
+  }
+  const float x_133 = uv.x;
+  if ((x_133 > 0.5f)) {
+    const int x_138 = obj.numbers[2];
+    const float x_141 = color.y;
+    color.y = (x_141 + float(x_138));
+  }
+  const float x_145 = uv.x;
+  if ((x_145 > 0.75f)) {
+    const int x_150 = obj.numbers[3];
+    const float x_153 = color.z;
+    color.z = (x_153 + float(x_150));
+  }
+  const int x_157 = obj.numbers[4];
+  const float x_160 = color.y;
+  color.y = (x_160 + float(x_157));
+  const float x_164 = uv.y;
+  if ((x_164 > 0.25f)) {
+    const int x_169 = obj.numbers[5];
+    const float x_172 = color.x;
+    color.x = (x_172 + float(x_169));
+  }
+  const float x_176 = uv.y;
+  if ((x_176 > 0.5f)) {
+    const int x_181 = obj.numbers[6];
+    const float x_184 = color.y;
+    color.y = (x_184 + float(x_181));
+  }
+  const float x_188 = uv.y;
+  if ((x_188 > 0.75f)) {
+    const int x_193 = obj.numbers[7];
+    const float x_196 = color.z;
+    color.z = (x_196 + float(x_193));
+  }
+  const int x_200 = obj.numbers[8];
+  const float x_203 = color.z;
+  color.z = (x_203 + float(x_200));
+  const float x_207 = uv.x;
+  const float x_209 = uv.y;
+  if ((abs((x_207 - x_209)) < 0.25f)) {
+    const int x_216 = obj.numbers[9];
+    const float x_219 = color.x;
+    color.x = (x_219 + float(x_216));
+  }
+  const float3 x_223 = normalize(color);
+  x_GLF_color = float4(x_223.x, x_223.y, x_223.z, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000029339D00EC0(128,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x0000029339D00EC0(127,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.hlsl
new file mode 100644
index 0000000..f785669
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/spv-stable-quicksort-mat-func-param/1.wgsl.expected.hlsl
@@ -0,0 +1,224 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_32 : register(b0, space0) {
+  uint4 x_32[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j, float3x3 x_228) {
+  int temp = 0;
+  const int x_230 = i;
+  const int x_232 = obj.numbers[x_230];
+  temp = x_232;
+  const int x_233 = i;
+  const int x_234 = j;
+  const int x_236 = obj.numbers[x_234];
+  obj.numbers[x_233] = x_236;
+  const int x_238 = j;
+  obj.numbers[x_238] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_242 = h;
+  const int x_244 = obj.numbers[x_242];
+  pivot = x_244;
+  const int x_245 = l;
+  i_1 = (x_245 - 1);
+  const int x_247 = l;
+  j_1 = x_247;
+  [loop] while (true) {
+    const int x_252 = j_1;
+    const int x_253 = h;
+    if ((x_252 <= (x_253 - 1))) {
+    } else {
+      break;
+    }
+    const int x_259 = obj.numbers[j_1];
+    if ((x_259 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)));
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  i_1 = (i_1 + 1);
+  param_2 = i_1;
+  const int x_274 = h;
+  param_3 = x_274;
+  swap_i1_i1_(param_2, param_3, float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)));
+  return i_1;
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_279 = (top + 1);
+  top = x_279;
+  stack[x_279] = l_1;
+  const int x_283 = (top + 1);
+  top = x_283;
+  stack[x_283] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_293 = top;
+    top = (x_293 - 1);
+    const int x_296 = stack[x_293];
+    h_1 = x_296;
+    const int x_297 = top;
+    top = (x_297 - 1);
+    const int x_300 = stack[x_297];
+    l_1 = x_300;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_303 = performPartition_i1_i1_(param_4, param_5);
+    p = x_303;
+    if (((p - 1) > l_1)) {
+      const int x_311 = (top + 1);
+      top = x_311;
+      stack[x_311] = l_1;
+      const int x_315 = (top + 1);
+      top = x_315;
+      stack[x_315] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_326 = (top + 1);
+      top = x_326;
+      stack[x_326] = (p + 1);
+      const int x_331 = (top + 1);
+      top = x_331;
+      stack[x_331] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_96 = i_2;
+      const int x_99 = obj.numbers[i_2];
+      const int x_102 = obj.numbers[i_2];
+      obj.numbers[x_96] = (x_99 * x_102);
+    }
+  }
+  quicksort_();
+  const float4 x_108 = gl_FragCoord;
+  const float2 x_111 = asfloat(x_32[0].xy);
+  uv = (float2(x_108.x, x_108.y) / x_111);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_114 = obj.numbers[0];
+  const float x_117 = color.x;
+  color.x = (x_117 + float(x_114));
+  const float x_121 = uv.x;
+  if ((x_121 > 0.25f)) {
+    const int x_126 = obj.numbers[1];
+    const float x_129 = color.x;
+    color.x = (x_129 + float(x_126));
+  }
+  const float x_133 = uv.x;
+  if ((x_133 > 0.5f)) {
+    const int x_138 = obj.numbers[2];
+    const float x_141 = color.y;
+    color.y = (x_141 + float(x_138));
+  }
+  const float x_145 = uv.x;
+  if ((x_145 > 0.75f)) {
+    const int x_150 = obj.numbers[3];
+    const float x_153 = color.z;
+    color.z = (x_153 + float(x_150));
+  }
+  const int x_157 = obj.numbers[4];
+  const float x_160 = color.y;
+  color.y = (x_160 + float(x_157));
+  const float x_164 = uv.y;
+  if ((x_164 > 0.25f)) {
+    const int x_169 = obj.numbers[5];
+    const float x_172 = color.x;
+    color.x = (x_172 + float(x_169));
+  }
+  const float x_176 = uv.y;
+  if ((x_176 > 0.5f)) {
+    const int x_181 = obj.numbers[6];
+    const float x_184 = color.y;
+    color.y = (x_184 + float(x_181));
+  }
+  const float x_188 = uv.y;
+  if ((x_188 > 0.75f)) {
+    const int x_193 = obj.numbers[7];
+    const float x_196 = color.z;
+    color.z = (x_196 + float(x_193));
+  }
+  const int x_200 = obj.numbers[8];
+  const float x_203 = color.z;
+  color.z = (x_203 + float(x_200));
+  const float x_207 = uv.x;
+  const float x_209 = uv.y;
+  if ((abs((x_207 - x_209)) < 0.25f)) {
+    const int x_216 = obj.numbers[9];
+    const float x_219 = color.x;
+    color.x = (x_219 + float(x_216));
+  }
+  const float3 x_223 = normalize(color);
+  x_GLF_color = float4(x_223.x, x_223.y, x_223.z, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001F0DC256BE0(128,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F0DC256BE0(127,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl
new file mode 100644
index 0000000..34470d1
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.hlsl
@@ -0,0 +1,776 @@
+SKIP: FAILED
+
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  BST tree[10] = (BST[10])0;
+  int x_356 = 0;
+  int x_58_phi = 0;
+  bool x_86_phi = false;
+  int x_353_phi = 0;
+  int x_356_phi = 0;
+  int x_358_phi = 0;
+  const BST tint_symbol_1 = {9, -1, -1};
+  tree[0] = tint_symbol_1;
+  0u;
+  do {
+    x_58_phi = 0;
+    [loop] while (true) {
+      int x_84 = 0;
+      int x_76 = 0;
+      int x_59 = 0;
+      int x_59_phi = 0;
+      const int x_58 = x_58_phi;
+      x_86_phi = false;
+      if ((x_58 <= 1)) {
+      } else {
+        break;
+      }
+      const int x_65 = tree[x_58].data;
+      if ((5 <= x_65)) {
+        const int x_78_save = x_58;
+        const int x_79 = tree[x_78_save].leftIndex;
+        if ((x_79 == -1)) {
+          tree[x_78_save].leftIndex = 1;
+          const BST tint_symbol_2 = {5, -1, -1};
+          tree[1] = tint_symbol_2;
+          x_86_phi = true;
+          break;
+        } else {
+          x_84 = tree[x_78_save].leftIndex;
+          x_59_phi = x_84;
+          {
+            x_59 = x_59_phi;
+            x_58_phi = x_59;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_70_save = x_58;
+        const int x_71 = tree[x_70_save].rightIndex;
+        if ((x_71 == -1)) {
+          tree[x_70_save].rightIndex = 1;
+          const BST tint_symbol_3 = {5, -1, -1};
+          tree[1] = tint_symbol_3;
+          x_86_phi = true;
+          break;
+        } else {
+          x_76 = tree[x_70_save].rightIndex;
+          x_59_phi = x_76;
+          {
+            x_59 = x_59_phi;
+            x_58_phi = x_59;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_59 = x_59_phi;
+        x_58_phi = x_59;
+      }
+    }
+    if (x_86_phi) {
+      break;
+    }
+  } while (false);
+  int x_91_phi = 0;
+  bool x_119_phi = false;
+  0u;
+  do {
+    x_91_phi = 0;
+    [loop] while (true) {
+      int x_117 = 0;
+      int x_109 = 0;
+      int x_92 = 0;
+      int x_92_phi = 0;
+      const int x_91 = x_91_phi;
+      x_119_phi = false;
+      if ((x_91 <= 2)) {
+      } else {
+        break;
+      }
+      const int x_98 = tree[x_91].data;
+      if ((12 <= x_98)) {
+        const int x_111_save = x_91;
+        const int x_112 = tree[x_111_save].leftIndex;
+        if ((x_112 == -1)) {
+          tree[x_111_save].leftIndex = 2;
+          const BST tint_symbol_4 = {12, -1, -1};
+          tree[2] = tint_symbol_4;
+          x_119_phi = true;
+          break;
+        } else {
+          x_117 = tree[x_111_save].leftIndex;
+          x_92_phi = x_117;
+          {
+            x_92 = x_92_phi;
+            x_91_phi = x_92;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_103_save = x_91;
+        const int x_104 = tree[x_103_save].rightIndex;
+        if ((x_104 == -1)) {
+          tree[x_103_save].rightIndex = 2;
+          const BST tint_symbol_5 = {12, -1, -1};
+          tree[2] = tint_symbol_5;
+          x_119_phi = true;
+          break;
+        } else {
+          x_109 = tree[x_103_save].rightIndex;
+          x_92_phi = x_109;
+          {
+            x_92 = x_92_phi;
+            x_91_phi = x_92;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_92 = x_92_phi;
+        x_91_phi = x_92;
+      }
+    }
+    if (x_119_phi) {
+      break;
+    }
+  } while (false);
+  int x_124_phi = 0;
+  bool x_152_phi = false;
+  0u;
+  do {
+    x_124_phi = 0;
+    [loop] while (true) {
+      int x_150 = 0;
+      int x_142 = 0;
+      int x_125 = 0;
+      int x_125_phi = 0;
+      const int x_124 = x_124_phi;
+      x_152_phi = false;
+      if ((x_124 <= 3)) {
+      } else {
+        break;
+      }
+      const int x_131 = tree[x_124].data;
+      if ((15 <= x_131)) {
+        const int x_144_save = x_124;
+        const int x_145 = tree[x_144_save].leftIndex;
+        if ((x_145 == -1)) {
+          tree[x_144_save].leftIndex = 3;
+          const BST tint_symbol_6 = {15, -1, -1};
+          tree[3] = tint_symbol_6;
+          x_152_phi = true;
+          break;
+        } else {
+          x_150 = tree[x_144_save].leftIndex;
+          x_125_phi = x_150;
+          {
+            x_125 = x_125_phi;
+            x_124_phi = x_125;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_136_save = x_124;
+        const int x_137 = tree[x_136_save].rightIndex;
+        if ((x_137 == -1)) {
+          tree[x_136_save].rightIndex = 3;
+          const BST tint_symbol_7 = {15, -1, -1};
+          tree[3] = tint_symbol_7;
+          x_152_phi = true;
+          break;
+        } else {
+          x_142 = tree[x_136_save].rightIndex;
+          x_125_phi = x_142;
+          {
+            x_125 = x_125_phi;
+            x_124_phi = x_125;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_125 = x_125_phi;
+        x_124_phi = x_125;
+      }
+    }
+    if (x_152_phi) {
+      break;
+    }
+  } while (false);
+  int x_157_phi = 0;
+  bool x_185_phi = false;
+  0u;
+  do {
+    x_157_phi = 0;
+    [loop] while (true) {
+      int x_183 = 0;
+      int x_175 = 0;
+      int x_158 = 0;
+      int x_158_phi = 0;
+      const int x_157 = x_157_phi;
+      x_185_phi = false;
+      if ((x_157 <= 4)) {
+      } else {
+        break;
+      }
+      const int x_164 = tree[x_157].data;
+      if ((7 <= x_164)) {
+        const int x_177_save = x_157;
+        const int x_178 = tree[x_177_save].leftIndex;
+        if ((x_178 == -1)) {
+          tree[x_177_save].leftIndex = 4;
+          const BST tint_symbol_8 = {7, -1, -1};
+          tree[4] = tint_symbol_8;
+          x_185_phi = true;
+          break;
+        } else {
+          x_183 = tree[x_177_save].leftIndex;
+          x_158_phi = x_183;
+          {
+            x_158 = x_158_phi;
+            x_157_phi = x_158;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_169_save = x_157;
+        const int x_170 = tree[x_169_save].rightIndex;
+        if ((x_170 == -1)) {
+          tree[x_169_save].rightIndex = 4;
+          const BST tint_symbol_9 = {7, -1, -1};
+          tree[4] = tint_symbol_9;
+          x_185_phi = true;
+          break;
+        } else {
+          x_175 = tree[x_169_save].rightIndex;
+          x_158_phi = x_175;
+          {
+            x_158 = x_158_phi;
+            x_157_phi = x_158;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_158 = x_158_phi;
+        x_157_phi = x_158;
+      }
+    }
+    if (x_185_phi) {
+      break;
+    }
+  } while (false);
+  int x_190_phi = 0;
+  bool x_218_phi = false;
+  0u;
+  do {
+    x_190_phi = 0;
+    [loop] while (true) {
+      int x_216 = 0;
+      int x_208 = 0;
+      int x_191 = 0;
+      int x_191_phi = 0;
+      const int x_190 = x_190_phi;
+      x_218_phi = false;
+      if ((x_190 <= 5)) {
+      } else {
+        break;
+      }
+      const int x_197 = tree[x_190].data;
+      if ((8 <= x_197)) {
+        const int x_210_save = x_190;
+        const int x_211 = tree[x_210_save].leftIndex;
+        if ((x_211 == -1)) {
+          tree[x_210_save].leftIndex = 5;
+          const BST tint_symbol_10 = {8, -1, -1};
+          tree[5] = tint_symbol_10;
+          x_218_phi = true;
+          break;
+        } else {
+          x_216 = tree[x_210_save].leftIndex;
+          x_191_phi = x_216;
+          {
+            x_191 = x_191_phi;
+            x_190_phi = x_191;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_202_save = x_190;
+        const int x_203 = tree[x_202_save].rightIndex;
+        if ((x_203 == -1)) {
+          tree[x_202_save].rightIndex = 5;
+          const BST tint_symbol_11 = {8, -1, -1};
+          tree[5] = tint_symbol_11;
+          x_218_phi = true;
+          break;
+        } else {
+          x_208 = tree[x_202_save].rightIndex;
+          x_191_phi = x_208;
+          {
+            x_191 = x_191_phi;
+            x_190_phi = x_191;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_191 = x_191_phi;
+        x_190_phi = x_191;
+      }
+    }
+    if (x_218_phi) {
+      break;
+    }
+  } while (false);
+  int x_223_phi = 0;
+  bool x_251_phi = false;
+  0u;
+  do {
+    x_223_phi = 0;
+    [loop] while (true) {
+      int x_249 = 0;
+      int x_241 = 0;
+      int x_224 = 0;
+      int x_224_phi = 0;
+      const int x_223 = x_223_phi;
+      x_251_phi = false;
+      if ((x_223 <= 6)) {
+      } else {
+        break;
+      }
+      const int x_230 = tree[x_223].data;
+      if ((2 <= x_230)) {
+        const int x_243_save = x_223;
+        const int x_244 = tree[x_243_save].leftIndex;
+        if ((x_244 == -1)) {
+          tree[x_243_save].leftIndex = 6;
+          const BST tint_symbol_12 = {2, -1, -1};
+          tree[6] = tint_symbol_12;
+          x_251_phi = true;
+          break;
+        } else {
+          x_249 = tree[x_243_save].leftIndex;
+          x_224_phi = x_249;
+          {
+            x_224 = x_224_phi;
+            x_223_phi = x_224;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_235_save = x_223;
+        const int x_236 = tree[x_235_save].rightIndex;
+        if ((x_236 == -1)) {
+          tree[x_235_save].rightIndex = 6;
+          const BST tint_symbol_13 = {2, -1, -1};
+          tree[6] = tint_symbol_13;
+          x_251_phi = true;
+          break;
+        } else {
+          x_241 = tree[x_235_save].rightIndex;
+          x_224_phi = x_241;
+          {
+            x_224 = x_224_phi;
+            x_223_phi = x_224;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_224 = x_224_phi;
+        x_223_phi = x_224;
+      }
+    }
+    if (x_251_phi) {
+      break;
+    }
+  } while (false);
+  int x_256_phi = 0;
+  bool x_284_phi = false;
+  0u;
+  do {
+    x_256_phi = 0;
+    [loop] while (true) {
+      int x_282 = 0;
+      int x_274 = 0;
+      int x_257 = 0;
+      int x_257_phi = 0;
+      const int x_256 = x_256_phi;
+      x_284_phi = false;
+      if ((x_256 <= 7)) {
+      } else {
+        break;
+      }
+      const int x_263 = tree[x_256].data;
+      if ((6 <= x_263)) {
+        const int x_276_save = x_256;
+        const int x_277 = tree[x_276_save].leftIndex;
+        if ((x_277 == -1)) {
+          tree[x_276_save].leftIndex = 7;
+          const BST tint_symbol_14 = {6, -1, -1};
+          tree[7] = tint_symbol_14;
+          x_284_phi = true;
+          break;
+        } else {
+          x_282 = tree[x_276_save].leftIndex;
+          x_257_phi = x_282;
+          {
+            x_257 = x_257_phi;
+            x_256_phi = x_257;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_268_save = x_256;
+        const int x_269 = tree[x_268_save].rightIndex;
+        if ((x_269 == -1)) {
+          tree[x_268_save].rightIndex = 7;
+          const BST tint_symbol_15 = {6, -1, -1};
+          tree[7] = tint_symbol_15;
+          x_284_phi = true;
+          break;
+        } else {
+          x_274 = tree[x_268_save].rightIndex;
+          x_257_phi = x_274;
+          {
+            x_257 = x_257_phi;
+            x_256_phi = x_257;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_257 = x_257_phi;
+        x_256_phi = x_257;
+      }
+    }
+    if (x_284_phi) {
+      break;
+    }
+  } while (false);
+  int x_289_phi = 0;
+  bool x_317_phi = false;
+  0u;
+  do {
+    x_289_phi = 0;
+    [loop] while (true) {
+      int x_315 = 0;
+      int x_307 = 0;
+      int x_290 = 0;
+      int x_290_phi = 0;
+      const int x_289 = x_289_phi;
+      x_317_phi = false;
+      if ((x_289 <= 8)) {
+      } else {
+        break;
+      }
+      const int x_296 = tree[x_289].data;
+      if ((17 <= x_296)) {
+        const int x_309_save = x_289;
+        const int x_310 = tree[x_309_save].leftIndex;
+        if ((x_310 == -1)) {
+          tree[x_309_save].leftIndex = 8;
+          const BST tint_symbol_16 = {17, -1, -1};
+          tree[8] = tint_symbol_16;
+          x_317_phi = true;
+          break;
+        } else {
+          x_315 = tree[x_309_save].leftIndex;
+          x_290_phi = x_315;
+          {
+            x_290 = x_290_phi;
+            x_289_phi = x_290;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_301_save = x_289;
+        const int x_302 = tree[x_301_save].rightIndex;
+        if ((x_302 == -1)) {
+          tree[x_301_save].rightIndex = 8;
+          const BST tint_symbol_17 = {17, -1, -1};
+          tree[8] = tint_symbol_17;
+          x_317_phi = true;
+          break;
+        } else {
+          x_307 = tree[x_301_save].rightIndex;
+          x_290_phi = x_307;
+          {
+            x_290 = x_290_phi;
+            x_289_phi = x_290;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_290 = x_290_phi;
+        x_289_phi = x_290;
+      }
+    }
+    if (x_317_phi) {
+      break;
+    }
+  } while (false);
+  int x_322_phi = 0;
+  bool x_350_phi = false;
+  0u;
+  do {
+    x_322_phi = 0;
+    [loop] while (true) {
+      int x_348 = 0;
+      int x_340 = 0;
+      int x_323 = 0;
+      int x_323_phi = 0;
+      const int x_322 = x_322_phi;
+      x_350_phi = false;
+      if ((x_322 <= 9)) {
+      } else {
+        break;
+      }
+      const int x_329 = tree[x_322].data;
+      if ((13 <= x_329)) {
+        const int x_342_save = x_322;
+        const int x_343 = tree[x_342_save].leftIndex;
+        if ((x_343 == -1)) {
+          tree[x_342_save].leftIndex = 9;
+          const BST tint_symbol_18 = {13, -1, -1};
+          tree[9] = tint_symbol_18;
+          x_350_phi = true;
+          break;
+        } else {
+          x_348 = tree[x_342_save].leftIndex;
+          x_323_phi = x_348;
+          {
+            x_323 = x_323_phi;
+            x_322_phi = x_323;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_334_save = x_322;
+        const int x_335 = tree[x_334_save].rightIndex;
+        if ((x_335 == -1)) {
+          tree[x_334_save].rightIndex = 9;
+          const BST tint_symbol_19 = {13, -1, -1};
+          tree[9] = tint_symbol_19;
+          x_350_phi = true;
+          break;
+        } else {
+          x_340 = tree[x_334_save].rightIndex;
+          x_323_phi = x_340;
+          {
+            x_323 = x_323_phi;
+            x_322_phi = x_323;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_323 = x_323_phi;
+        x_322_phi = x_323;
+      }
+    }
+    if (x_350_phi) {
+      break;
+    }
+  } while (false);
+  x_353_phi = 0;
+  x_356_phi = 0;
+  x_358_phi = 0;
+  [loop] while (true) {
+    int x_381 = 0;
+    int x_391 = 0;
+    int x_396 = 0;
+    int x_359 = 0;
+    int x_354_phi = 0;
+    int x_357_phi = 0;
+    const int x_353 = x_353_phi;
+    x_356 = x_356_phi;
+    const int x_358 = x_358_phi;
+    if ((x_358 < 20)) {
+    } else {
+      break;
+    }
+    int x_366_phi = 0;
+    int x_381_phi = 0;
+    bool x_382_phi = false;
+    0u;
+    do {
+      x_366_phi = 0;
+      [loop] while (true) {
+        const int x_366 = x_366_phi;
+        x_381_phi = x_353;
+        x_382_phi = false;
+        if ((x_366 != -1)) {
+        } else {
+          break;
+        }
+        const BST x_373 = tree[x_366];
+        const int x_374 = x_373.data;
+        const int x_375 = x_373.leftIndex;
+        const int x_376 = x_373.rightIndex;
+        if ((x_374 == x_358)) {
+          x_381_phi = x_358;
+          x_382_phi = true;
+          break;
+        }
+        {
+          x_366_phi = ((x_358 > x_374) ? x_376 : x_375);
+        }
+      }
+      x_381 = x_381_phi;
+      const bool x_382 = x_382_phi;
+      x_354_phi = x_381;
+      if (x_382) {
+        break;
+      }
+      x_354_phi = -1;
+    } while (false);
+    int x_354 = 0;
+    int x_390 = 0;
+    int x_395 = 0;
+    int x_391_phi = 0;
+    int x_396_phi = 0;
+    x_354 = x_354_phi;
+    switch(x_358) {
+      case 2:
+      case 5:
+      case 6:
+      case 7:
+      case 8:
+      case 9:
+      case 12:
+      case 13:
+      case 15:
+      case 17: {
+        x_391_phi = x_356;
+        if ((x_354 == asint(x_358))) {
+          x_390 = asint((x_356 + asint(1)));
+          x_391_phi = x_390;
+        }
+        x_391 = x_391_phi;
+        x_357_phi = x_391;
+        break;
+      }
+      default: {
+        x_396_phi = x_356;
+        if ((x_354 == asint(-1))) {
+          x_395 = asint((x_356 + asint(1)));
+          x_396_phi = x_395;
+        }
+        x_396 = x_396_phi;
+        x_357_phi = x_396;
+        break;
+      }
+    }
+    const int x_357 = x_357_phi;
+    {
+      x_359 = (x_358 + 1);
+      x_353_phi = x_354;
+      x_356_phi = x_357;
+      x_358_phi = x_359;
+    }
+  }
+  if ((x_356 == asint(20))) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_20 = {x_GLF_color};
+  return tint_symbol_20;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000022EDBF08060(82,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(22,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000022EDBF08060(148,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(214,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(280,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(346,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(412,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(478,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(544,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(610,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000022EDBF08060(662,7-19): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl
new file mode 100644
index 0000000..1861aed
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.hlsl
@@ -0,0 +1,857 @@
+SKIP: FAILED
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:46:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:60:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:62:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:105:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:119:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:121:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:164:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:178:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:180:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:223:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:237:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:239:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:282:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:296:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:298:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:341:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:355:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:357:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:400:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:414:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:416:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:459:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:473:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:475:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:518:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:532:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl:534:9 warning: code is unreachable
+        return;
+        ^^^^^^
+
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  BST tree[10] = (BST[10])0;
+  int x_356 = 0;
+  int x_58_phi = 0;
+  bool x_86_phi = false;
+  int x_353_phi = 0;
+  int x_356_phi = 0;
+  int x_358_phi = 0;
+  const BST tint_symbol_1 = {9, -1, -1};
+  tree[0] = tint_symbol_1;
+  0u;
+  do {
+    x_58_phi = 0;
+    [loop] while (true) {
+      int x_84 = 0;
+      int x_76 = 0;
+      int x_59 = 0;
+      int x_59_phi = 0;
+      const int x_58 = x_58_phi;
+      x_86_phi = false;
+      if ((x_58 <= 1)) {
+      } else {
+        break;
+      }
+      const int x_65 = tree[x_58].data;
+      if ((5 <= x_65)) {
+        const int x_78_save = x_58;
+        const int x_79 = tree[x_78_save].leftIndex;
+        if ((x_79 == -1)) {
+          tree[x_78_save].leftIndex = 1;
+          const BST tint_symbol_2 = {5, -1, -1};
+          tree[1] = tint_symbol_2;
+          x_86_phi = true;
+          break;
+        } else {
+          x_84 = tree[x_78_save].leftIndex;
+          x_59_phi = x_84;
+          {
+            x_59 = x_59_phi;
+            x_58_phi = x_59;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_70_save = x_58;
+        const int x_71 = tree[x_70_save].rightIndex;
+        if ((x_71 == -1)) {
+          tree[x_70_save].rightIndex = 1;
+          const BST tint_symbol_3 = {5, -1, -1};
+          tree[1] = tint_symbol_3;
+          x_86_phi = true;
+          break;
+        } else {
+          x_76 = tree[x_70_save].rightIndex;
+          x_59_phi = x_76;
+          {
+            x_59 = x_59_phi;
+            x_58_phi = x_59;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_59 = x_59_phi;
+        x_58_phi = x_59;
+      }
+    }
+    if (x_86_phi) {
+      break;
+    }
+  } while (false);
+  int x_91_phi = 0;
+  bool x_119_phi = false;
+  0u;
+  do {
+    x_91_phi = 0;
+    [loop] while (true) {
+      int x_117 = 0;
+      int x_109 = 0;
+      int x_92 = 0;
+      int x_92_phi = 0;
+      const int x_91 = x_91_phi;
+      x_119_phi = false;
+      if ((x_91 <= 2)) {
+      } else {
+        break;
+      }
+      const int x_98 = tree[x_91].data;
+      if ((12 <= x_98)) {
+        const int x_111_save = x_91;
+        const int x_112 = tree[x_111_save].leftIndex;
+        if ((x_112 == -1)) {
+          tree[x_111_save].leftIndex = 2;
+          const BST tint_symbol_4 = {12, -1, -1};
+          tree[2] = tint_symbol_4;
+          x_119_phi = true;
+          break;
+        } else {
+          x_117 = tree[x_111_save].leftIndex;
+          x_92_phi = x_117;
+          {
+            x_92 = x_92_phi;
+            x_91_phi = x_92;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_103_save = x_91;
+        const int x_104 = tree[x_103_save].rightIndex;
+        if ((x_104 == -1)) {
+          tree[x_103_save].rightIndex = 2;
+          const BST tint_symbol_5 = {12, -1, -1};
+          tree[2] = tint_symbol_5;
+          x_119_phi = true;
+          break;
+        } else {
+          x_109 = tree[x_103_save].rightIndex;
+          x_92_phi = x_109;
+          {
+            x_92 = x_92_phi;
+            x_91_phi = x_92;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_92 = x_92_phi;
+        x_91_phi = x_92;
+      }
+    }
+    if (x_119_phi) {
+      break;
+    }
+  } while (false);
+  int x_124_phi = 0;
+  bool x_152_phi = false;
+  0u;
+  do {
+    x_124_phi = 0;
+    [loop] while (true) {
+      int x_150 = 0;
+      int x_142 = 0;
+      int x_125 = 0;
+      int x_125_phi = 0;
+      const int x_124 = x_124_phi;
+      x_152_phi = false;
+      if ((x_124 <= 3)) {
+      } else {
+        break;
+      }
+      const int x_131 = tree[x_124].data;
+      if ((15 <= x_131)) {
+        const int x_144_save = x_124;
+        const int x_145 = tree[x_144_save].leftIndex;
+        if ((x_145 == -1)) {
+          tree[x_144_save].leftIndex = 3;
+          const BST tint_symbol_6 = {15, -1, -1};
+          tree[3] = tint_symbol_6;
+          x_152_phi = true;
+          break;
+        } else {
+          x_150 = tree[x_144_save].leftIndex;
+          x_125_phi = x_150;
+          {
+            x_125 = x_125_phi;
+            x_124_phi = x_125;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_136_save = x_124;
+        const int x_137 = tree[x_136_save].rightIndex;
+        if ((x_137 == -1)) {
+          tree[x_136_save].rightIndex = 3;
+          const BST tint_symbol_7 = {15, -1, -1};
+          tree[3] = tint_symbol_7;
+          x_152_phi = true;
+          break;
+        } else {
+          x_142 = tree[x_136_save].rightIndex;
+          x_125_phi = x_142;
+          {
+            x_125 = x_125_phi;
+            x_124_phi = x_125;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_125 = x_125_phi;
+        x_124_phi = x_125;
+      }
+    }
+    if (x_152_phi) {
+      break;
+    }
+  } while (false);
+  int x_157_phi = 0;
+  bool x_185_phi = false;
+  0u;
+  do {
+    x_157_phi = 0;
+    [loop] while (true) {
+      int x_183 = 0;
+      int x_175 = 0;
+      int x_158 = 0;
+      int x_158_phi = 0;
+      const int x_157 = x_157_phi;
+      x_185_phi = false;
+      if ((x_157 <= 4)) {
+      } else {
+        break;
+      }
+      const int x_164 = tree[x_157].data;
+      if ((7 <= x_164)) {
+        const int x_177_save = x_157;
+        const int x_178 = tree[x_177_save].leftIndex;
+        if ((x_178 == -1)) {
+          tree[x_177_save].leftIndex = 4;
+          const BST tint_symbol_8 = {7, -1, -1};
+          tree[4] = tint_symbol_8;
+          x_185_phi = true;
+          break;
+        } else {
+          x_183 = tree[x_177_save].leftIndex;
+          x_158_phi = x_183;
+          {
+            x_158 = x_158_phi;
+            x_157_phi = x_158;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_169_save = x_157;
+        const int x_170 = tree[x_169_save].rightIndex;
+        if ((x_170 == -1)) {
+          tree[x_169_save].rightIndex = 4;
+          const BST tint_symbol_9 = {7, -1, -1};
+          tree[4] = tint_symbol_9;
+          x_185_phi = true;
+          break;
+        } else {
+          x_175 = tree[x_169_save].rightIndex;
+          x_158_phi = x_175;
+          {
+            x_158 = x_158_phi;
+            x_157_phi = x_158;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_158 = x_158_phi;
+        x_157_phi = x_158;
+      }
+    }
+    if (x_185_phi) {
+      break;
+    }
+  } while (false);
+  int x_190_phi = 0;
+  bool x_218_phi = false;
+  0u;
+  do {
+    x_190_phi = 0;
+    [loop] while (true) {
+      int x_216 = 0;
+      int x_208 = 0;
+      int x_191 = 0;
+      int x_191_phi = 0;
+      const int x_190 = x_190_phi;
+      x_218_phi = false;
+      if ((x_190 <= 5)) {
+      } else {
+        break;
+      }
+      const int x_197 = tree[x_190].data;
+      if ((8 <= x_197)) {
+        const int x_210_save = x_190;
+        const int x_211 = tree[x_210_save].leftIndex;
+        if ((x_211 == -1)) {
+          tree[x_210_save].leftIndex = 5;
+          const BST tint_symbol_10 = {8, -1, -1};
+          tree[5] = tint_symbol_10;
+          x_218_phi = true;
+          break;
+        } else {
+          x_216 = tree[x_210_save].leftIndex;
+          x_191_phi = x_216;
+          {
+            x_191 = x_191_phi;
+            x_190_phi = x_191;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_202_save = x_190;
+        const int x_203 = tree[x_202_save].rightIndex;
+        if ((x_203 == -1)) {
+          tree[x_202_save].rightIndex = 5;
+          const BST tint_symbol_11 = {8, -1, -1};
+          tree[5] = tint_symbol_11;
+          x_218_phi = true;
+          break;
+        } else {
+          x_208 = tree[x_202_save].rightIndex;
+          x_191_phi = x_208;
+          {
+            x_191 = x_191_phi;
+            x_190_phi = x_191;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_191 = x_191_phi;
+        x_190_phi = x_191;
+      }
+    }
+    if (x_218_phi) {
+      break;
+    }
+  } while (false);
+  int x_223_phi = 0;
+  bool x_251_phi = false;
+  0u;
+  do {
+    x_223_phi = 0;
+    [loop] while (true) {
+      int x_249 = 0;
+      int x_241 = 0;
+      int x_224 = 0;
+      int x_224_phi = 0;
+      const int x_223 = x_223_phi;
+      x_251_phi = false;
+      if ((x_223 <= 6)) {
+      } else {
+        break;
+      }
+      const int x_230 = tree[x_223].data;
+      if ((2 <= x_230)) {
+        const int x_243_save = x_223;
+        const int x_244 = tree[x_243_save].leftIndex;
+        if ((x_244 == -1)) {
+          tree[x_243_save].leftIndex = 6;
+          const BST tint_symbol_12 = {2, -1, -1};
+          tree[6] = tint_symbol_12;
+          x_251_phi = true;
+          break;
+        } else {
+          x_249 = tree[x_243_save].leftIndex;
+          x_224_phi = x_249;
+          {
+            x_224 = x_224_phi;
+            x_223_phi = x_224;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_235_save = x_223;
+        const int x_236 = tree[x_235_save].rightIndex;
+        if ((x_236 == -1)) {
+          tree[x_235_save].rightIndex = 6;
+          const BST tint_symbol_13 = {2, -1, -1};
+          tree[6] = tint_symbol_13;
+          x_251_phi = true;
+          break;
+        } else {
+          x_241 = tree[x_235_save].rightIndex;
+          x_224_phi = x_241;
+          {
+            x_224 = x_224_phi;
+            x_223_phi = x_224;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_224 = x_224_phi;
+        x_223_phi = x_224;
+      }
+    }
+    if (x_251_phi) {
+      break;
+    }
+  } while (false);
+  int x_256_phi = 0;
+  bool x_284_phi = false;
+  0u;
+  do {
+    x_256_phi = 0;
+    [loop] while (true) {
+      int x_282 = 0;
+      int x_274 = 0;
+      int x_257 = 0;
+      int x_257_phi = 0;
+      const int x_256 = x_256_phi;
+      x_284_phi = false;
+      if ((x_256 <= 7)) {
+      } else {
+        break;
+      }
+      const int x_263 = tree[x_256].data;
+      if ((6 <= x_263)) {
+        const int x_276_save = x_256;
+        const int x_277 = tree[x_276_save].leftIndex;
+        if ((x_277 == -1)) {
+          tree[x_276_save].leftIndex = 7;
+          const BST tint_symbol_14 = {6, -1, -1};
+          tree[7] = tint_symbol_14;
+          x_284_phi = true;
+          break;
+        } else {
+          x_282 = tree[x_276_save].leftIndex;
+          x_257_phi = x_282;
+          {
+            x_257 = x_257_phi;
+            x_256_phi = x_257;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_268_save = x_256;
+        const int x_269 = tree[x_268_save].rightIndex;
+        if ((x_269 == -1)) {
+          tree[x_268_save].rightIndex = 7;
+          const BST tint_symbol_15 = {6, -1, -1};
+          tree[7] = tint_symbol_15;
+          x_284_phi = true;
+          break;
+        } else {
+          x_274 = tree[x_268_save].rightIndex;
+          x_257_phi = x_274;
+          {
+            x_257 = x_257_phi;
+            x_256_phi = x_257;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_257 = x_257_phi;
+        x_256_phi = x_257;
+      }
+    }
+    if (x_284_phi) {
+      break;
+    }
+  } while (false);
+  int x_289_phi = 0;
+  bool x_317_phi = false;
+  0u;
+  do {
+    x_289_phi = 0;
+    [loop] while (true) {
+      int x_315 = 0;
+      int x_307 = 0;
+      int x_290 = 0;
+      int x_290_phi = 0;
+      const int x_289 = x_289_phi;
+      x_317_phi = false;
+      if ((x_289 <= 8)) {
+      } else {
+        break;
+      }
+      const int x_296 = tree[x_289].data;
+      if ((17 <= x_296)) {
+        const int x_309_save = x_289;
+        const int x_310 = tree[x_309_save].leftIndex;
+        if ((x_310 == -1)) {
+          tree[x_309_save].leftIndex = 8;
+          const BST tint_symbol_16 = {17, -1, -1};
+          tree[8] = tint_symbol_16;
+          x_317_phi = true;
+          break;
+        } else {
+          x_315 = tree[x_309_save].leftIndex;
+          x_290_phi = x_315;
+          {
+            x_290 = x_290_phi;
+            x_289_phi = x_290;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_301_save = x_289;
+        const int x_302 = tree[x_301_save].rightIndex;
+        if ((x_302 == -1)) {
+          tree[x_301_save].rightIndex = 8;
+          const BST tint_symbol_17 = {17, -1, -1};
+          tree[8] = tint_symbol_17;
+          x_317_phi = true;
+          break;
+        } else {
+          x_307 = tree[x_301_save].rightIndex;
+          x_290_phi = x_307;
+          {
+            x_290 = x_290_phi;
+            x_289_phi = x_290;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_290 = x_290_phi;
+        x_289_phi = x_290;
+      }
+    }
+    if (x_317_phi) {
+      break;
+    }
+  } while (false);
+  int x_322_phi = 0;
+  bool x_350_phi = false;
+  0u;
+  do {
+    x_322_phi = 0;
+    [loop] while (true) {
+      int x_348 = 0;
+      int x_340 = 0;
+      int x_323 = 0;
+      int x_323_phi = 0;
+      const int x_322 = x_322_phi;
+      x_350_phi = false;
+      if ((x_322 <= 9)) {
+      } else {
+        break;
+      }
+      const int x_329 = tree[x_322].data;
+      if ((13 <= x_329)) {
+        const int x_342_save = x_322;
+        const int x_343 = tree[x_342_save].leftIndex;
+        if ((x_343 == -1)) {
+          tree[x_342_save].leftIndex = 9;
+          const BST tint_symbol_18 = {13, -1, -1};
+          tree[9] = tint_symbol_18;
+          x_350_phi = true;
+          break;
+        } else {
+          x_348 = tree[x_342_save].leftIndex;
+          x_323_phi = x_348;
+          {
+            x_323 = x_323_phi;
+            x_322_phi = x_323;
+          }
+          continue;
+        }
+        return;
+      } else {
+        const int x_334_save = x_322;
+        const int x_335 = tree[x_334_save].rightIndex;
+        if ((x_335 == -1)) {
+          tree[x_334_save].rightIndex = 9;
+          const BST tint_symbol_19 = {13, -1, -1};
+          tree[9] = tint_symbol_19;
+          x_350_phi = true;
+          break;
+        } else {
+          x_340 = tree[x_334_save].rightIndex;
+          x_323_phi = x_340;
+          {
+            x_323 = x_323_phi;
+            x_322_phi = x_323;
+          }
+          continue;
+        }
+        return;
+      }
+      return;
+      {
+        x_323 = x_323_phi;
+        x_322_phi = x_323;
+      }
+    }
+    if (x_350_phi) {
+      break;
+    }
+  } while (false);
+  x_353_phi = 0;
+  x_356_phi = 0;
+  x_358_phi = 0;
+  [loop] while (true) {
+    int x_381 = 0;
+    int x_391 = 0;
+    int x_396 = 0;
+    int x_359 = 0;
+    int x_354_phi = 0;
+    int x_357_phi = 0;
+    const int x_353 = x_353_phi;
+    x_356 = x_356_phi;
+    const int x_358 = x_358_phi;
+    if ((x_358 < 20)) {
+    } else {
+      break;
+    }
+    int x_366_phi = 0;
+    int x_381_phi = 0;
+    bool x_382_phi = false;
+    0u;
+    do {
+      x_366_phi = 0;
+      [loop] while (true) {
+        const int x_366 = x_366_phi;
+        x_381_phi = x_353;
+        x_382_phi = false;
+        if ((x_366 != -1)) {
+        } else {
+          break;
+        }
+        const BST x_373 = tree[x_366];
+        const int x_374 = x_373.data;
+        const int x_375 = x_373.leftIndex;
+        const int x_376 = x_373.rightIndex;
+        if ((x_374 == x_358)) {
+          x_381_phi = x_358;
+          x_382_phi = true;
+          break;
+        }
+        {
+          x_366_phi = ((x_358 > x_374) ? x_376 : x_375);
+        }
+      }
+      x_381 = x_381_phi;
+      const bool x_382 = x_382_phi;
+      x_354_phi = x_381;
+      if (x_382) {
+        break;
+      }
+      x_354_phi = -1;
+    } while (false);
+    int x_354 = 0;
+    int x_390 = 0;
+    int x_395 = 0;
+    int x_391_phi = 0;
+    int x_396_phi = 0;
+    x_354 = x_354_phi;
+    switch(x_358) {
+      case 2:
+      case 5:
+      case 6:
+      case 7:
+      case 8:
+      case 9:
+      case 12:
+      case 13:
+      case 15:
+      case 17: {
+        x_391_phi = x_356;
+        if ((x_354 == asint(x_358))) {
+          x_390 = asint((x_356 + asint(1)));
+          x_391_phi = x_390;
+        }
+        x_391 = x_391_phi;
+        x_357_phi = x_391;
+        break;
+      }
+      default: {
+        x_396_phi = x_356;
+        if ((x_354 == asint(-1))) {
+          x_395 = asint((x_356 + asint(1)));
+          x_396_phi = x_395;
+        }
+        x_396 = x_396_phi;
+        x_357_phi = x_396;
+        break;
+      }
+    }
+    const int x_357 = x_357_phi;
+    {
+      x_359 = (x_358 + 1);
+      x_353_phi = x_354;
+      x_356_phi = x_357;
+      x_358_phi = x_359;
+    }
+  }
+  if ((x_356 == asint(20))) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_20 = {x_GLF_color};
+  return tint_symbol_20;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001F23007A140(82,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(22,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x000001F23007A140(148,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(214,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(280,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(346,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(412,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(478,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(544,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(610,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x000001F23007A140(662,7-19): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.hlsl
index bb46607..4a7eed3 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.spvasm.expected.hlsl
@@ -1,5 +1,23 @@
 SKIP: FAILED
 
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
 struct BST {
   int data;
   int leftIndex;
@@ -24,109 +42,107 @@
   int x_569_phi = 0;
   int x_572_phi = 0;
   int x_574_phi = 0;
-  const BST tint_symbol_5 = {9, -1, -1};
-  tree[0] = tint_symbol_5;
-  switch(0u) {
-    default: {
-      x_67_phi = false;
-      x_70_phi = 0;
-      while (true) {
-        int x_95 = 0;
-        int x_87 = 0;
-        bool x_68 = false;
-        int x_71 = 0;
-        bool x_68_phi = false;
-        int x_71_phi = 0;
-        x_67 = x_67_phi;
-        const int x_70 = x_70_phi;
-        x_116_phi = x_67;
-        if ((x_70 <= 1)) {
-        } else {
-          break;
-        }
-        const int x_76 = tree[x_70].data;
-        if ((5 <= x_76)) {
-          bool x_114_phi = false;
-          const int x_89_save = x_70;
-          const int x_90 = tree[x_89_save].leftIndex;
-          if ((x_90 == -1)) {
-            const float x_97 = asfloat(x_8[0].y);
-            const float x_99 = asfloat(x_8[0].x);
-            if ((x_97 < x_99)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_89_save].leftIndex = 1;
-            const BST tint_symbol_6 = {5, -1, -1};
-            tree[1] = tint_symbol_6;
-            while (true) {
-              x_114_phi = x_67;
-              if ((0 < int(x_97))) {
-              } else {
-                break;
-              }
-              x_114_phi = true;
-              break;
-            }
-            x_114 = x_114_phi;
-            x_116_phi = x_114;
-            if (x_114) {
-              break;
-            }
-          } else {
-            x_95 = tree[x_89_save].leftIndex;
-            x_68_phi = x_67;
-            x_71_phi = x_95;
-            {
-              x_68 = x_68_phi;
-              x_71 = x_71_phi;
-              x_67_phi = x_68;
-              x_70_phi = x_71;
-            }
-            continue;
-          }
-        } else {
-          const int x_81_save = x_70;
-          const int x_82 = tree[x_81_save].rightIndex;
-          if ((x_82 == -1)) {
-            tree[x_81_save].rightIndex = 1;
-            const BST tint_symbol_7 = {5, -1, -1};
-            tree[1] = tint_symbol_7;
-            x_116_phi = true;
-            break;
-          } else {
-            x_87 = tree[x_81_save].rightIndex;
-            x_68_phi = x_67;
-            x_71_phi = x_87;
-            {
-              x_68 = x_68_phi;
-              x_71 = x_71_phi;
-              x_67_phi = x_68;
-              x_70_phi = x_71;
-            }
-            continue;
-          }
-          return;
-        }
-        x_68_phi = x_114;
-        x_71_phi = x_70;
-        {
-          x_68 = x_68_phi;
-          x_71 = x_71_phi;
-          x_67_phi = x_68;
-          x_70_phi = x_71;
-        }
-      }
-      if (x_116_phi) {
+  const BST tint_symbol_4 = {9, -1, -1};
+  tree[0] = tint_symbol_4;
+  0u;
+  do {
+    x_67_phi = false;
+    x_70_phi = 0;
+    [loop] while (true) {
+      int x_95 = 0;
+      int x_87 = 0;
+      bool x_68 = false;
+      int x_71 = 0;
+      bool x_68_phi = false;
+      int x_71_phi = 0;
+      x_67 = x_67_phi;
+      const int x_70 = x_70_phi;
+      x_116_phi = x_67;
+      if ((x_70 <= 1)) {
+      } else {
         break;
       }
+      const int x_76 = tree[x_70].data;
+      if ((5 <= x_76)) {
+        bool x_114_phi = false;
+        const int x_89_save = x_70;
+        const int x_90 = tree[x_89_save].leftIndex;
+        if ((x_90 == -1)) {
+          const float x_97 = asfloat(x_8[0].y);
+          const float x_99 = asfloat(x_8[0].x);
+          if ((x_97 < x_99)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_89_save].leftIndex = 1;
+          const BST tint_symbol_5 = {5, -1, -1};
+          tree[1] = tint_symbol_5;
+          [loop] while (true) {
+            x_114_phi = x_67;
+            if ((0 < int(x_97))) {
+            } else {
+              break;
+            }
+            x_114_phi = true;
+            break;
+          }
+          x_114 = x_114_phi;
+          x_116_phi = x_114;
+          if (x_114) {
+            break;
+          }
+        } else {
+          x_95 = tree[x_89_save].leftIndex;
+          x_68_phi = x_67;
+          x_71_phi = x_95;
+          {
+            x_68 = x_68_phi;
+            x_71 = x_71_phi;
+            x_67_phi = x_68;
+            x_70_phi = x_71;
+          }
+          continue;
+        }
+      } else {
+        const int x_81_save = x_70;
+        const int x_82 = tree[x_81_save].rightIndex;
+        if ((x_82 == -1)) {
+          tree[x_81_save].rightIndex = 1;
+          const BST tint_symbol_6 = {5, -1, -1};
+          tree[1] = tint_symbol_6;
+          x_116_phi = true;
+          break;
+        } else {
+          x_87 = tree[x_81_save].rightIndex;
+          x_68_phi = x_67;
+          x_71_phi = x_87;
+          {
+            x_68 = x_68_phi;
+            x_71 = x_71_phi;
+            x_67_phi = x_68;
+            x_70_phi = x_71;
+          }
+          continue;
+        }
+        return;
+      }
+      x_68_phi = x_114;
+      x_71_phi = x_70;
+      {
+        x_68 = x_68_phi;
+        x_71 = x_71_phi;
+        x_67_phi = x_68;
+        x_70_phi = x_71;
+      }
+    }
+    if (x_116_phi) {
       break;
     }
-  }
+  } while (false);
   x_119_phi = 0;
-  while (true) {
+  [loop] while (true) {
     bool x_133 = false;
     int x_120 = 0;
     bool x_134_phi = false;
@@ -148,105 +164,103 @@
     bool x_139_phi = false;
     int x_142_phi = 0;
     bool x_188_phi = false;
-    switch(0u) {
-      default: {
-        x_139_phi = false;
-        x_142_phi = 0;
-        while (true) {
-          int x_167 = 0;
-          int x_159 = 0;
-          bool x_140 = false;
-          int x_143 = 0;
-          bool x_140_phi = false;
-          int x_143_phi = 0;
-          x_139 = x_139_phi;
-          const int x_142 = x_142_phi;
-          x_188_phi = x_139;
-          if ((x_142 <= 2)) {
-          } else {
-            break;
-          }
-          const int x_148 = tree[x_142].data;
-          if ((12 <= x_148)) {
-            bool x_186_phi = false;
-            const int x_161_save = x_142;
-            const int x_162 = tree[x_161_save].leftIndex;
-            if ((x_162 == -1)) {
-              const float x_169 = asfloat(x_8[0].y);
-              const float x_171 = asfloat(x_8[0].x);
-              if ((x_169 < x_171)) {
-                while (true) {
-                  discard;
-                }
-                return;
-              }
-              tree[x_161_save].leftIndex = 2;
-              const BST tint_symbol_8 = {12, -1, -1};
-              tree[2] = tint_symbol_8;
-              while (true) {
-                x_186_phi = x_139;
-                if ((0 < int(x_169))) {
-                } else {
-                  break;
-                }
-                x_186_phi = true;
-                break;
-              }
-              x_186 = x_186_phi;
-              x_188_phi = x_186;
-              if (x_186) {
-                break;
-              }
-            } else {
-              x_167 = tree[x_161_save].leftIndex;
-              x_140_phi = x_139;
-              x_143_phi = x_167;
-              {
-                x_140 = x_140_phi;
-                x_143 = x_143_phi;
-                x_139_phi = x_140;
-                x_142_phi = x_143;
-              }
-              continue;
-            }
-          } else {
-            const int x_153_save = x_142;
-            const int x_154 = tree[x_153_save].rightIndex;
-            if ((x_154 == -1)) {
-              tree[x_153_save].rightIndex = 2;
-              const BST tint_symbol_9 = {12, -1, -1};
-              tree[2] = tint_symbol_9;
-              x_188_phi = true;
-              break;
-            } else {
-              x_159 = tree[x_153_save].rightIndex;
-              x_140_phi = x_139;
-              x_143_phi = x_159;
-              {
-                x_140 = x_140_phi;
-                x_143 = x_143_phi;
-                x_139_phi = x_140;
-                x_142_phi = x_143;
-              }
-              continue;
-            }
-            return;
-          }
-          x_140_phi = x_186;
-          x_143_phi = x_142;
-          {
-            x_140 = x_140_phi;
-            x_143 = x_143_phi;
-            x_139_phi = x_140;
-            x_142_phi = x_143;
-          }
-        }
-        if (x_188_phi) {
+    0u;
+    do {
+      x_139_phi = false;
+      x_142_phi = 0;
+      [loop] while (true) {
+        int x_167 = 0;
+        int x_159 = 0;
+        bool x_140 = false;
+        int x_143 = 0;
+        bool x_140_phi = false;
+        int x_143_phi = 0;
+        x_139 = x_139_phi;
+        const int x_142 = x_142_phi;
+        x_188_phi = x_139;
+        if ((x_142 <= 2)) {
+        } else {
           break;
         }
+        const int x_148 = tree[x_142].data;
+        if ((12 <= x_148)) {
+          bool x_186_phi = false;
+          const int x_161_save = x_142;
+          const int x_162 = tree[x_161_save].leftIndex;
+          if ((x_162 == -1)) {
+            const float x_169 = asfloat(x_8[0].y);
+            const float x_171 = asfloat(x_8[0].x);
+            if ((x_169 < x_171)) {
+              [loop] while (true) {
+                discard;
+              }
+              return;
+            }
+            tree[x_161_save].leftIndex = 2;
+            const BST tint_symbol_7 = {12, -1, -1};
+            tree[2] = tint_symbol_7;
+            [loop] while (true) {
+              x_186_phi = x_139;
+              if ((0 < int(x_169))) {
+              } else {
+                break;
+              }
+              x_186_phi = true;
+              break;
+            }
+            x_186 = x_186_phi;
+            x_188_phi = x_186;
+            if (x_186) {
+              break;
+            }
+          } else {
+            x_167 = tree[x_161_save].leftIndex;
+            x_140_phi = x_139;
+            x_143_phi = x_167;
+            {
+              x_140 = x_140_phi;
+              x_143 = x_143_phi;
+              x_139_phi = x_140;
+              x_142_phi = x_143;
+            }
+            continue;
+          }
+        } else {
+          const int x_153_save = x_142;
+          const int x_154 = tree[x_153_save].rightIndex;
+          if ((x_154 == -1)) {
+            tree[x_153_save].rightIndex = 2;
+            const BST tint_symbol_8 = {12, -1, -1};
+            tree[2] = tint_symbol_8;
+            x_188_phi = true;
+            break;
+          } else {
+            x_159 = tree[x_153_save].rightIndex;
+            x_140_phi = x_139;
+            x_143_phi = x_159;
+            {
+              x_140 = x_140_phi;
+              x_143 = x_143_phi;
+              x_139_phi = x_140;
+              x_142_phi = x_143;
+            }
+            continue;
+          }
+          return;
+        }
+        x_140_phi = x_186;
+        x_143_phi = x_142;
+        {
+          x_140 = x_140_phi;
+          x_143 = x_143_phi;
+          x_139_phi = x_140;
+          x_142_phi = x_143;
+        }
+      }
+      if (x_188_phi) {
         break;
       }
-    }
+    } while (false);
     {
       x_120 = (x_119 + 1);
       x_119_phi = x_120;
@@ -257,733 +271,719 @@
   bool x_193_phi = false;
   int x_196_phi = 0;
   bool x_242_phi = false;
-  switch(0u) {
-    default: {
-      x_193_phi = false;
-      x_196_phi = 0;
-      while (true) {
-        int x_221 = 0;
-        int x_213 = 0;
-        bool x_194 = false;
-        int x_197 = 0;
-        bool x_194_phi = false;
-        int x_197_phi = 0;
-        x_193 = x_193_phi;
-        const int x_196 = x_196_phi;
-        x_242_phi = x_193;
-        if ((x_196 <= 3)) {
-        } else {
-          break;
-        }
-        const int x_202 = tree[x_196].data;
-        if ((15 <= x_202)) {
-          bool x_240_phi = false;
-          const int x_215_save = x_196;
-          const int x_216 = tree[x_215_save].leftIndex;
-          if ((x_216 == -1)) {
-            const float x_223 = asfloat(x_8[0].y);
-            const float x_225 = asfloat(x_8[0].x);
-            if ((x_223 < x_225)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_215_save].leftIndex = 3;
-            const BST tint_symbol_10 = {15, -1, -1};
-            tree[3] = tint_symbol_10;
-            while (true) {
-              x_240_phi = x_193;
-              if ((0 < int(x_223))) {
-              } else {
-                break;
-              }
-              x_240_phi = true;
-              break;
-            }
-            x_240 = x_240_phi;
-            x_242_phi = x_240;
-            if (x_240) {
-              break;
-            }
-          } else {
-            x_221 = tree[x_215_save].leftIndex;
-            x_194_phi = x_193;
-            x_197_phi = x_221;
-            {
-              x_194 = x_194_phi;
-              x_197 = x_197_phi;
-              x_193_phi = x_194;
-              x_196_phi = x_197;
-            }
-            continue;
-          }
-        } else {
-          const int x_207_save = x_196;
-          const int x_208 = tree[x_207_save].rightIndex;
-          if ((x_208 == -1)) {
-            tree[x_207_save].rightIndex = 3;
-            const BST tint_symbol_11 = {15, -1, -1};
-            tree[3] = tint_symbol_11;
-            x_242_phi = true;
-            break;
-          } else {
-            x_213 = tree[x_207_save].rightIndex;
-            x_194_phi = x_193;
-            x_197_phi = x_213;
-            {
-              x_194 = x_194_phi;
-              x_197 = x_197_phi;
-              x_193_phi = x_194;
-              x_196_phi = x_197;
-            }
-            continue;
-          }
-          return;
-        }
-        x_194_phi = x_240;
-        x_197_phi = x_196;
-        {
-          x_194 = x_194_phi;
-          x_197 = x_197_phi;
-          x_193_phi = x_194;
-          x_196_phi = x_197;
-        }
-      }
-      if (x_242_phi) {
+  0u;
+  do {
+    x_193_phi = false;
+    x_196_phi = 0;
+    [loop] while (true) {
+      int x_221 = 0;
+      int x_213 = 0;
+      bool x_194 = false;
+      int x_197 = 0;
+      bool x_194_phi = false;
+      int x_197_phi = 0;
+      x_193 = x_193_phi;
+      const int x_196 = x_196_phi;
+      x_242_phi = x_193;
+      if ((x_196 <= 3)) {
+      } else {
         break;
       }
+      const int x_202 = tree[x_196].data;
+      if ((15 <= x_202)) {
+        bool x_240_phi = false;
+        const int x_215_save = x_196;
+        const int x_216 = tree[x_215_save].leftIndex;
+        if ((x_216 == -1)) {
+          const float x_223 = asfloat(x_8[0].y);
+          const float x_225 = asfloat(x_8[0].x);
+          if ((x_223 < x_225)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_215_save].leftIndex = 3;
+          const BST tint_symbol_9 = {15, -1, -1};
+          tree[3] = tint_symbol_9;
+          [loop] while (true) {
+            x_240_phi = x_193;
+            if ((0 < int(x_223))) {
+            } else {
+              break;
+            }
+            x_240_phi = true;
+            break;
+          }
+          x_240 = x_240_phi;
+          x_242_phi = x_240;
+          if (x_240) {
+            break;
+          }
+        } else {
+          x_221 = tree[x_215_save].leftIndex;
+          x_194_phi = x_193;
+          x_197_phi = x_221;
+          {
+            x_194 = x_194_phi;
+            x_197 = x_197_phi;
+            x_193_phi = x_194;
+            x_196_phi = x_197;
+          }
+          continue;
+        }
+      } else {
+        const int x_207_save = x_196;
+        const int x_208 = tree[x_207_save].rightIndex;
+        if ((x_208 == -1)) {
+          tree[x_207_save].rightIndex = 3;
+          const BST tint_symbol_10 = {15, -1, -1};
+          tree[3] = tint_symbol_10;
+          x_242_phi = true;
+          break;
+        } else {
+          x_213 = tree[x_207_save].rightIndex;
+          x_194_phi = x_193;
+          x_197_phi = x_213;
+          {
+            x_194 = x_194_phi;
+            x_197 = x_197_phi;
+            x_193_phi = x_194;
+            x_196_phi = x_197;
+          }
+          continue;
+        }
+        return;
+      }
+      x_194_phi = x_240;
+      x_197_phi = x_196;
+      {
+        x_194 = x_194_phi;
+        x_197 = x_197_phi;
+        x_193_phi = x_194;
+        x_196_phi = x_197;
+      }
+    }
+    if (x_242_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_247 = false;
   bool x_294 = false;
   bool x_247_phi = false;
   int x_250_phi = 0;
   bool x_296_phi = false;
-  switch(0u) {
-    default: {
-      x_247_phi = false;
-      x_250_phi = 0;
-      while (true) {
-        int x_275 = 0;
-        int x_267 = 0;
-        bool x_248 = false;
-        int x_251 = 0;
-        bool x_248_phi = false;
-        int x_251_phi = 0;
-        x_247 = x_247_phi;
-        const int x_250 = x_250_phi;
-        x_296_phi = x_247;
-        if ((x_250 <= 4)) {
-        } else {
-          break;
-        }
-        const int x_256 = tree[x_250].data;
-        if ((7 <= x_256)) {
-          bool x_294_phi = false;
-          const int x_269_save = x_250;
-          const int x_270 = tree[x_269_save].leftIndex;
-          if ((x_270 == -1)) {
-            const float x_277 = asfloat(x_8[0].y);
-            const float x_279 = asfloat(x_8[0].x);
-            if ((x_277 < x_279)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_269_save].leftIndex = 4;
-            const BST tint_symbol_12 = {7, -1, -1};
-            tree[4] = tint_symbol_12;
-            while (true) {
-              x_294_phi = x_247;
-              if ((0 < int(x_277))) {
-              } else {
-                break;
-              }
-              x_294_phi = true;
-              break;
-            }
-            x_294 = x_294_phi;
-            x_296_phi = x_294;
-            if (x_294) {
-              break;
-            }
-          } else {
-            x_275 = tree[x_269_save].leftIndex;
-            x_248_phi = x_247;
-            x_251_phi = x_275;
-            {
-              x_248 = x_248_phi;
-              x_251 = x_251_phi;
-              x_247_phi = x_248;
-              x_250_phi = x_251;
-            }
-            continue;
-          }
-        } else {
-          const int x_261_save = x_250;
-          const int x_262 = tree[x_261_save].rightIndex;
-          if ((x_262 == -1)) {
-            tree[x_261_save].rightIndex = 4;
-            const BST tint_symbol_13 = {7, -1, -1};
-            tree[4] = tint_symbol_13;
-            x_296_phi = true;
-            break;
-          } else {
-            x_267 = tree[x_261_save].rightIndex;
-            x_248_phi = x_247;
-            x_251_phi = x_267;
-            {
-              x_248 = x_248_phi;
-              x_251 = x_251_phi;
-              x_247_phi = x_248;
-              x_250_phi = x_251;
-            }
-            continue;
-          }
-          return;
-        }
-        x_248_phi = x_294;
-        x_251_phi = x_250;
-        {
-          x_248 = x_248_phi;
-          x_251 = x_251_phi;
-          x_247_phi = x_248;
-          x_250_phi = x_251;
-        }
-      }
-      if (x_296_phi) {
+  0u;
+  do {
+    x_247_phi = false;
+    x_250_phi = 0;
+    [loop] while (true) {
+      int x_275 = 0;
+      int x_267 = 0;
+      bool x_248 = false;
+      int x_251 = 0;
+      bool x_248_phi = false;
+      int x_251_phi = 0;
+      x_247 = x_247_phi;
+      const int x_250 = x_250_phi;
+      x_296_phi = x_247;
+      if ((x_250 <= 4)) {
+      } else {
         break;
       }
+      const int x_256 = tree[x_250].data;
+      if ((7 <= x_256)) {
+        bool x_294_phi = false;
+        const int x_269_save = x_250;
+        const int x_270 = tree[x_269_save].leftIndex;
+        if ((x_270 == -1)) {
+          const float x_277 = asfloat(x_8[0].y);
+          const float x_279 = asfloat(x_8[0].x);
+          if ((x_277 < x_279)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_269_save].leftIndex = 4;
+          const BST tint_symbol_11 = {7, -1, -1};
+          tree[4] = tint_symbol_11;
+          [loop] while (true) {
+            x_294_phi = x_247;
+            if ((0 < int(x_277))) {
+            } else {
+              break;
+            }
+            x_294_phi = true;
+            break;
+          }
+          x_294 = x_294_phi;
+          x_296_phi = x_294;
+          if (x_294) {
+            break;
+          }
+        } else {
+          x_275 = tree[x_269_save].leftIndex;
+          x_248_phi = x_247;
+          x_251_phi = x_275;
+          {
+            x_248 = x_248_phi;
+            x_251 = x_251_phi;
+            x_247_phi = x_248;
+            x_250_phi = x_251;
+          }
+          continue;
+        }
+      } else {
+        const int x_261_save = x_250;
+        const int x_262 = tree[x_261_save].rightIndex;
+        if ((x_262 == -1)) {
+          tree[x_261_save].rightIndex = 4;
+          const BST tint_symbol_12 = {7, -1, -1};
+          tree[4] = tint_symbol_12;
+          x_296_phi = true;
+          break;
+        } else {
+          x_267 = tree[x_261_save].rightIndex;
+          x_248_phi = x_247;
+          x_251_phi = x_267;
+          {
+            x_248 = x_248_phi;
+            x_251 = x_251_phi;
+            x_247_phi = x_248;
+            x_250_phi = x_251;
+          }
+          continue;
+        }
+        return;
+      }
+      x_248_phi = x_294;
+      x_251_phi = x_250;
+      {
+        x_248 = x_248_phi;
+        x_251 = x_251_phi;
+        x_247_phi = x_248;
+        x_250_phi = x_251;
+      }
+    }
+    if (x_296_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_301 = false;
   bool x_348 = false;
   bool x_301_phi = false;
   int x_304_phi = 0;
   bool x_350_phi = false;
-  switch(0u) {
-    default: {
-      x_301_phi = false;
-      x_304_phi = 0;
-      while (true) {
-        int x_329 = 0;
-        int x_321 = 0;
-        bool x_302 = false;
-        int x_305 = 0;
-        bool x_302_phi = false;
-        int x_305_phi = 0;
-        x_301 = x_301_phi;
-        const int x_304 = x_304_phi;
-        x_350_phi = x_301;
-        if ((x_304 <= 5)) {
-        } else {
-          break;
-        }
-        const int x_310 = tree[x_304].data;
-        if ((8 <= x_310)) {
-          bool x_348_phi = false;
-          const int x_323_save = x_304;
-          const int x_324 = tree[x_323_save].leftIndex;
-          if ((x_324 == -1)) {
-            const float x_331 = asfloat(x_8[0].y);
-            const float x_333 = asfloat(x_8[0].x);
-            if ((x_331 < x_333)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_323_save].leftIndex = 5;
-            const BST tint_symbol_14 = {8, -1, -1};
-            tree[5] = tint_symbol_14;
-            while (true) {
-              x_348_phi = x_301;
-              if ((0 < int(x_331))) {
-              } else {
-                break;
-              }
-              x_348_phi = true;
-              break;
-            }
-            x_348 = x_348_phi;
-            x_350_phi = x_348;
-            if (x_348) {
-              break;
-            }
-          } else {
-            x_329 = tree[x_323_save].leftIndex;
-            x_302_phi = x_301;
-            x_305_phi = x_329;
-            {
-              x_302 = x_302_phi;
-              x_305 = x_305_phi;
-              x_301_phi = x_302;
-              x_304_phi = x_305;
-            }
-            continue;
-          }
-        } else {
-          const int x_315_save = x_304;
-          const int x_316 = tree[x_315_save].rightIndex;
-          if ((x_316 == -1)) {
-            tree[x_315_save].rightIndex = 5;
-            const BST tint_symbol_15 = {8, -1, -1};
-            tree[5] = tint_symbol_15;
-            x_350_phi = true;
-            break;
-          } else {
-            x_321 = tree[x_315_save].rightIndex;
-            x_302_phi = x_301;
-            x_305_phi = x_321;
-            {
-              x_302 = x_302_phi;
-              x_305 = x_305_phi;
-              x_301_phi = x_302;
-              x_304_phi = x_305;
-            }
-            continue;
-          }
-          return;
-        }
-        x_302_phi = x_348;
-        x_305_phi = x_304;
-        {
-          x_302 = x_302_phi;
-          x_305 = x_305_phi;
-          x_301_phi = x_302;
-          x_304_phi = x_305;
-        }
-      }
-      if (x_350_phi) {
+  0u;
+  do {
+    x_301_phi = false;
+    x_304_phi = 0;
+    [loop] while (true) {
+      int x_329 = 0;
+      int x_321 = 0;
+      bool x_302 = false;
+      int x_305 = 0;
+      bool x_302_phi = false;
+      int x_305_phi = 0;
+      x_301 = x_301_phi;
+      const int x_304 = x_304_phi;
+      x_350_phi = x_301;
+      if ((x_304 <= 5)) {
+      } else {
         break;
       }
+      const int x_310 = tree[x_304].data;
+      if ((8 <= x_310)) {
+        bool x_348_phi = false;
+        const int x_323_save = x_304;
+        const int x_324 = tree[x_323_save].leftIndex;
+        if ((x_324 == -1)) {
+          const float x_331 = asfloat(x_8[0].y);
+          const float x_333 = asfloat(x_8[0].x);
+          if ((x_331 < x_333)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_323_save].leftIndex = 5;
+          const BST tint_symbol_13 = {8, -1, -1};
+          tree[5] = tint_symbol_13;
+          [loop] while (true) {
+            x_348_phi = x_301;
+            if ((0 < int(x_331))) {
+            } else {
+              break;
+            }
+            x_348_phi = true;
+            break;
+          }
+          x_348 = x_348_phi;
+          x_350_phi = x_348;
+          if (x_348) {
+            break;
+          }
+        } else {
+          x_329 = tree[x_323_save].leftIndex;
+          x_302_phi = x_301;
+          x_305_phi = x_329;
+          {
+            x_302 = x_302_phi;
+            x_305 = x_305_phi;
+            x_301_phi = x_302;
+            x_304_phi = x_305;
+          }
+          continue;
+        }
+      } else {
+        const int x_315_save = x_304;
+        const int x_316 = tree[x_315_save].rightIndex;
+        if ((x_316 == -1)) {
+          tree[x_315_save].rightIndex = 5;
+          const BST tint_symbol_14 = {8, -1, -1};
+          tree[5] = tint_symbol_14;
+          x_350_phi = true;
+          break;
+        } else {
+          x_321 = tree[x_315_save].rightIndex;
+          x_302_phi = x_301;
+          x_305_phi = x_321;
+          {
+            x_302 = x_302_phi;
+            x_305 = x_305_phi;
+            x_301_phi = x_302;
+            x_304_phi = x_305;
+          }
+          continue;
+        }
+        return;
+      }
+      x_302_phi = x_348;
+      x_305_phi = x_304;
+      {
+        x_302 = x_302_phi;
+        x_305 = x_305_phi;
+        x_301_phi = x_302;
+        x_304_phi = x_305;
+      }
+    }
+    if (x_350_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_355 = false;
   bool x_402 = false;
   bool x_355_phi = false;
   int x_358_phi = 0;
   bool x_404_phi = false;
-  switch(0u) {
-    default: {
-      x_355_phi = false;
-      x_358_phi = 0;
-      while (true) {
-        int x_383 = 0;
-        int x_375 = 0;
-        bool x_356 = false;
-        int x_359 = 0;
-        bool x_356_phi = false;
-        int x_359_phi = 0;
-        x_355 = x_355_phi;
-        const int x_358 = x_358_phi;
-        x_404_phi = x_355;
-        if ((x_358 <= 6)) {
-        } else {
-          break;
-        }
-        const int x_364 = tree[x_358].data;
-        if ((2 <= x_364)) {
-          bool x_402_phi = false;
-          const int x_377_save = x_358;
-          const int x_378 = tree[x_377_save].leftIndex;
-          if ((x_378 == -1)) {
-            const float x_385 = asfloat(x_8[0].y);
-            const float x_387 = asfloat(x_8[0].x);
-            if ((x_385 < x_387)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_377_save].leftIndex = 6;
-            const BST tint_symbol_16 = {2, -1, -1};
-            tree[6] = tint_symbol_16;
-            while (true) {
-              x_402_phi = x_355;
-              if ((0 < int(x_385))) {
-              } else {
-                break;
-              }
-              x_402_phi = true;
-              break;
-            }
-            x_402 = x_402_phi;
-            x_404_phi = x_402;
-            if (x_402) {
-              break;
-            }
-          } else {
-            x_383 = tree[x_377_save].leftIndex;
-            x_356_phi = x_355;
-            x_359_phi = x_383;
-            {
-              x_356 = x_356_phi;
-              x_359 = x_359_phi;
-              x_355_phi = x_356;
-              x_358_phi = x_359;
-            }
-            continue;
-          }
-        } else {
-          const int x_369_save = x_358;
-          const int x_370 = tree[x_369_save].rightIndex;
-          if ((x_370 == -1)) {
-            tree[x_369_save].rightIndex = 6;
-            const BST tint_symbol_17 = {2, -1, -1};
-            tree[6] = tint_symbol_17;
-            x_404_phi = true;
-            break;
-          } else {
-            x_375 = tree[x_369_save].rightIndex;
-            x_356_phi = x_355;
-            x_359_phi = x_375;
-            {
-              x_356 = x_356_phi;
-              x_359 = x_359_phi;
-              x_355_phi = x_356;
-              x_358_phi = x_359;
-            }
-            continue;
-          }
-          return;
-        }
-        x_356_phi = x_402;
-        x_359_phi = x_358;
-        {
-          x_356 = x_356_phi;
-          x_359 = x_359_phi;
-          x_355_phi = x_356;
-          x_358_phi = x_359;
-        }
-      }
-      if (x_404_phi) {
+  0u;
+  do {
+    x_355_phi = false;
+    x_358_phi = 0;
+    [loop] while (true) {
+      int x_383 = 0;
+      int x_375 = 0;
+      bool x_356 = false;
+      int x_359 = 0;
+      bool x_356_phi = false;
+      int x_359_phi = 0;
+      x_355 = x_355_phi;
+      const int x_358 = x_358_phi;
+      x_404_phi = x_355;
+      if ((x_358 <= 6)) {
+      } else {
         break;
       }
+      const int x_364 = tree[x_358].data;
+      if ((2 <= x_364)) {
+        bool x_402_phi = false;
+        const int x_377_save = x_358;
+        const int x_378 = tree[x_377_save].leftIndex;
+        if ((x_378 == -1)) {
+          const float x_385 = asfloat(x_8[0].y);
+          const float x_387 = asfloat(x_8[0].x);
+          if ((x_385 < x_387)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_377_save].leftIndex = 6;
+          const BST tint_symbol_15 = {2, -1, -1};
+          tree[6] = tint_symbol_15;
+          [loop] while (true) {
+            x_402_phi = x_355;
+            if ((0 < int(x_385))) {
+            } else {
+              break;
+            }
+            x_402_phi = true;
+            break;
+          }
+          x_402 = x_402_phi;
+          x_404_phi = x_402;
+          if (x_402) {
+            break;
+          }
+        } else {
+          x_383 = tree[x_377_save].leftIndex;
+          x_356_phi = x_355;
+          x_359_phi = x_383;
+          {
+            x_356 = x_356_phi;
+            x_359 = x_359_phi;
+            x_355_phi = x_356;
+            x_358_phi = x_359;
+          }
+          continue;
+        }
+      } else {
+        const int x_369_save = x_358;
+        const int x_370 = tree[x_369_save].rightIndex;
+        if ((x_370 == -1)) {
+          tree[x_369_save].rightIndex = 6;
+          const BST tint_symbol_16 = {2, -1, -1};
+          tree[6] = tint_symbol_16;
+          x_404_phi = true;
+          break;
+        } else {
+          x_375 = tree[x_369_save].rightIndex;
+          x_356_phi = x_355;
+          x_359_phi = x_375;
+          {
+            x_356 = x_356_phi;
+            x_359 = x_359_phi;
+            x_355_phi = x_356;
+            x_358_phi = x_359;
+          }
+          continue;
+        }
+        return;
+      }
+      x_356_phi = x_402;
+      x_359_phi = x_358;
+      {
+        x_356 = x_356_phi;
+        x_359 = x_359_phi;
+        x_355_phi = x_356;
+        x_358_phi = x_359;
+      }
+    }
+    if (x_404_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_409 = false;
   bool x_456 = false;
   bool x_409_phi = false;
   int x_412_phi = 0;
   bool x_458_phi = false;
-  switch(0u) {
-    default: {
-      x_409_phi = false;
-      x_412_phi = 0;
-      while (true) {
-        int x_437 = 0;
-        int x_429 = 0;
-        bool x_410 = false;
-        int x_413 = 0;
-        bool x_410_phi = false;
-        int x_413_phi = 0;
-        x_409 = x_409_phi;
-        const int x_412 = x_412_phi;
-        x_458_phi = x_409;
-        if ((x_412 <= 7)) {
-        } else {
-          break;
-        }
-        const int x_418 = tree[x_412].data;
-        if ((6 <= x_418)) {
-          bool x_456_phi = false;
-          const int x_431_save = x_412;
-          const int x_432 = tree[x_431_save].leftIndex;
-          if ((x_432 == -1)) {
-            const float x_439 = asfloat(x_8[0].y);
-            const float x_441 = asfloat(x_8[0].x);
-            if ((x_439 < x_441)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_431_save].leftIndex = 7;
-            const BST tint_symbol_18 = {6, -1, -1};
-            tree[7] = tint_symbol_18;
-            while (true) {
-              x_456_phi = x_409;
-              if ((0 < int(x_439))) {
-              } else {
-                break;
-              }
-              x_456_phi = true;
-              break;
-            }
-            x_456 = x_456_phi;
-            x_458_phi = x_456;
-            if (x_456) {
-              break;
-            }
-          } else {
-            x_437 = tree[x_431_save].leftIndex;
-            x_410_phi = x_409;
-            x_413_phi = x_437;
-            {
-              x_410 = x_410_phi;
-              x_413 = x_413_phi;
-              x_409_phi = x_410;
-              x_412_phi = x_413;
-            }
-            continue;
-          }
-        } else {
-          const int x_423_save = x_412;
-          const int x_424 = tree[x_423_save].rightIndex;
-          if ((x_424 == -1)) {
-            tree[x_423_save].rightIndex = 7;
-            const BST tint_symbol_19 = {6, -1, -1};
-            tree[7] = tint_symbol_19;
-            x_458_phi = true;
-            break;
-          } else {
-            x_429 = tree[x_423_save].rightIndex;
-            x_410_phi = x_409;
-            x_413_phi = x_429;
-            {
-              x_410 = x_410_phi;
-              x_413 = x_413_phi;
-              x_409_phi = x_410;
-              x_412_phi = x_413;
-            }
-            continue;
-          }
-          return;
-        }
-        x_410_phi = x_456;
-        x_413_phi = x_412;
-        {
-          x_410 = x_410_phi;
-          x_413 = x_413_phi;
-          x_409_phi = x_410;
-          x_412_phi = x_413;
-        }
-      }
-      if (x_458_phi) {
+  0u;
+  do {
+    x_409_phi = false;
+    x_412_phi = 0;
+    [loop] while (true) {
+      int x_437 = 0;
+      int x_429 = 0;
+      bool x_410 = false;
+      int x_413 = 0;
+      bool x_410_phi = false;
+      int x_413_phi = 0;
+      x_409 = x_409_phi;
+      const int x_412 = x_412_phi;
+      x_458_phi = x_409;
+      if ((x_412 <= 7)) {
+      } else {
         break;
       }
+      const int x_418 = tree[x_412].data;
+      if ((6 <= x_418)) {
+        bool x_456_phi = false;
+        const int x_431_save = x_412;
+        const int x_432 = tree[x_431_save].leftIndex;
+        if ((x_432 == -1)) {
+          const float x_439 = asfloat(x_8[0].y);
+          const float x_441 = asfloat(x_8[0].x);
+          if ((x_439 < x_441)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_431_save].leftIndex = 7;
+          const BST tint_symbol_17 = {6, -1, -1};
+          tree[7] = tint_symbol_17;
+          [loop] while (true) {
+            x_456_phi = x_409;
+            if ((0 < int(x_439))) {
+            } else {
+              break;
+            }
+            x_456_phi = true;
+            break;
+          }
+          x_456 = x_456_phi;
+          x_458_phi = x_456;
+          if (x_456) {
+            break;
+          }
+        } else {
+          x_437 = tree[x_431_save].leftIndex;
+          x_410_phi = x_409;
+          x_413_phi = x_437;
+          {
+            x_410 = x_410_phi;
+            x_413 = x_413_phi;
+            x_409_phi = x_410;
+            x_412_phi = x_413;
+          }
+          continue;
+        }
+      } else {
+        const int x_423_save = x_412;
+        const int x_424 = tree[x_423_save].rightIndex;
+        if ((x_424 == -1)) {
+          tree[x_423_save].rightIndex = 7;
+          const BST tint_symbol_18 = {6, -1, -1};
+          tree[7] = tint_symbol_18;
+          x_458_phi = true;
+          break;
+        } else {
+          x_429 = tree[x_423_save].rightIndex;
+          x_410_phi = x_409;
+          x_413_phi = x_429;
+          {
+            x_410 = x_410_phi;
+            x_413 = x_413_phi;
+            x_409_phi = x_410;
+            x_412_phi = x_413;
+          }
+          continue;
+        }
+        return;
+      }
+      x_410_phi = x_456;
+      x_413_phi = x_412;
+      {
+        x_410 = x_410_phi;
+        x_413 = x_413_phi;
+        x_409_phi = x_410;
+        x_412_phi = x_413;
+      }
+    }
+    if (x_458_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_463 = false;
   bool x_510 = false;
   bool x_463_phi = false;
   int x_466_phi = 0;
   bool x_512_phi = false;
-  switch(0u) {
-    default: {
-      x_463_phi = false;
-      x_466_phi = 0;
-      while (true) {
-        int x_491 = 0;
-        int x_483 = 0;
-        bool x_464 = false;
-        int x_467 = 0;
-        bool x_464_phi = false;
-        int x_467_phi = 0;
-        x_463 = x_463_phi;
-        const int x_466 = x_466_phi;
-        x_512_phi = x_463;
-        if ((x_466 <= 8)) {
-        } else {
-          break;
-        }
-        const int x_472 = tree[x_466].data;
-        if ((17 <= x_472)) {
-          bool x_510_phi = false;
-          const int x_485_save = x_466;
-          const int x_486 = tree[x_485_save].leftIndex;
-          if ((x_486 == -1)) {
-            const float x_493 = asfloat(x_8[0].y);
-            const float x_495 = asfloat(x_8[0].x);
-            if ((x_493 < x_495)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_485_save].leftIndex = 8;
-            const BST tint_symbol_20 = {17, -1, -1};
-            tree[8] = tint_symbol_20;
-            while (true) {
-              x_510_phi = x_463;
-              if ((0 < int(x_493))) {
-              } else {
-                break;
-              }
-              x_510_phi = true;
-              break;
-            }
-            x_510 = x_510_phi;
-            x_512_phi = x_510;
-            if (x_510) {
-              break;
-            }
-          } else {
-            x_491 = tree[x_485_save].leftIndex;
-            x_464_phi = x_463;
-            x_467_phi = x_491;
-            {
-              x_464 = x_464_phi;
-              x_467 = x_467_phi;
-              x_463_phi = x_464;
-              x_466_phi = x_467;
-            }
-            continue;
-          }
-        } else {
-          const int x_477_save = x_466;
-          const int x_478 = tree[x_477_save].rightIndex;
-          if ((x_478 == -1)) {
-            tree[x_477_save].rightIndex = 8;
-            const BST tint_symbol_21 = {17, -1, -1};
-            tree[8] = tint_symbol_21;
-            x_512_phi = true;
-            break;
-          } else {
-            x_483 = tree[x_477_save].rightIndex;
-            x_464_phi = x_463;
-            x_467_phi = x_483;
-            {
-              x_464 = x_464_phi;
-              x_467 = x_467_phi;
-              x_463_phi = x_464;
-              x_466_phi = x_467;
-            }
-            continue;
-          }
-          return;
-        }
-        x_464_phi = x_510;
-        x_467_phi = x_466;
-        {
-          x_464 = x_464_phi;
-          x_467 = x_467_phi;
-          x_463_phi = x_464;
-          x_466_phi = x_467;
-        }
-      }
-      if (x_512_phi) {
+  0u;
+  do {
+    x_463_phi = false;
+    x_466_phi = 0;
+    [loop] while (true) {
+      int x_491 = 0;
+      int x_483 = 0;
+      bool x_464 = false;
+      int x_467 = 0;
+      bool x_464_phi = false;
+      int x_467_phi = 0;
+      x_463 = x_463_phi;
+      const int x_466 = x_466_phi;
+      x_512_phi = x_463;
+      if ((x_466 <= 8)) {
+      } else {
         break;
       }
+      const int x_472 = tree[x_466].data;
+      if ((17 <= x_472)) {
+        bool x_510_phi = false;
+        const int x_485_save = x_466;
+        const int x_486 = tree[x_485_save].leftIndex;
+        if ((x_486 == -1)) {
+          const float x_493 = asfloat(x_8[0].y);
+          const float x_495 = asfloat(x_8[0].x);
+          if ((x_493 < x_495)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_485_save].leftIndex = 8;
+          const BST tint_symbol_19 = {17, -1, -1};
+          tree[8] = tint_symbol_19;
+          [loop] while (true) {
+            x_510_phi = x_463;
+            if ((0 < int(x_493))) {
+            } else {
+              break;
+            }
+            x_510_phi = true;
+            break;
+          }
+          x_510 = x_510_phi;
+          x_512_phi = x_510;
+          if (x_510) {
+            break;
+          }
+        } else {
+          x_491 = tree[x_485_save].leftIndex;
+          x_464_phi = x_463;
+          x_467_phi = x_491;
+          {
+            x_464 = x_464_phi;
+            x_467 = x_467_phi;
+            x_463_phi = x_464;
+            x_466_phi = x_467;
+          }
+          continue;
+        }
+      } else {
+        const int x_477_save = x_466;
+        const int x_478 = tree[x_477_save].rightIndex;
+        if ((x_478 == -1)) {
+          tree[x_477_save].rightIndex = 8;
+          const BST tint_symbol_20 = {17, -1, -1};
+          tree[8] = tint_symbol_20;
+          x_512_phi = true;
+          break;
+        } else {
+          x_483 = tree[x_477_save].rightIndex;
+          x_464_phi = x_463;
+          x_467_phi = x_483;
+          {
+            x_464 = x_464_phi;
+            x_467 = x_467_phi;
+            x_463_phi = x_464;
+            x_466_phi = x_467;
+          }
+          continue;
+        }
+        return;
+      }
+      x_464_phi = x_510;
+      x_467_phi = x_466;
+      {
+        x_464 = x_464_phi;
+        x_467 = x_467_phi;
+        x_463_phi = x_464;
+        x_466_phi = x_467;
+      }
+    }
+    if (x_512_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_517 = false;
   bool x_564 = false;
   bool x_517_phi = false;
   int x_520_phi = 0;
   bool x_566_phi = false;
-  switch(0u) {
-    default: {
-      x_517_phi = false;
-      x_520_phi = 0;
-      while (true) {
-        int x_545 = 0;
-        int x_537 = 0;
-        bool x_518 = false;
-        int x_521 = 0;
-        bool x_518_phi = false;
-        int x_521_phi = 0;
-        x_517 = x_517_phi;
-        const int x_520 = x_520_phi;
-        x_566_phi = x_517;
-        if ((x_520 <= 9)) {
-        } else {
-          break;
-        }
-        const int x_526 = tree[x_520].data;
-        if ((13 <= x_526)) {
-          bool x_564_phi = false;
-          const int x_539_save = x_520;
-          const int x_540 = tree[x_539_save].leftIndex;
-          if ((x_540 == -1)) {
-            const float x_547 = asfloat(x_8[0].y);
-            const float x_549 = asfloat(x_8[0].x);
-            if ((x_547 < x_549)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_539_save].leftIndex = 9;
-            const BST tint_symbol_22 = {13, -1, -1};
-            tree[9] = tint_symbol_22;
-            while (true) {
-              x_564_phi = x_517;
-              if ((0 < int(x_547))) {
-              } else {
-                break;
-              }
-              x_564_phi = true;
-              break;
-            }
-            x_564 = x_564_phi;
-            x_566_phi = x_564;
-            if (x_564) {
-              break;
-            }
-          } else {
-            x_545 = tree[x_539_save].leftIndex;
-            x_518_phi = x_517;
-            x_521_phi = x_545;
-            {
-              x_518 = x_518_phi;
-              x_521 = x_521_phi;
-              x_517_phi = x_518;
-              x_520_phi = x_521;
-            }
-            continue;
-          }
-        } else {
-          const int x_531_save = x_520;
-          const int x_532 = tree[x_531_save].rightIndex;
-          if ((x_532 == -1)) {
-            tree[x_531_save].rightIndex = 9;
-            const BST tint_symbol_23 = {13, -1, -1};
-            tree[9] = tint_symbol_23;
-            x_566_phi = true;
-            break;
-          } else {
-            x_537 = tree[x_531_save].rightIndex;
-            x_518_phi = x_517;
-            x_521_phi = x_537;
-            {
-              x_518 = x_518_phi;
-              x_521 = x_521_phi;
-              x_517_phi = x_518;
-              x_520_phi = x_521;
-            }
-            continue;
-          }
-          return;
-        }
-        x_518_phi = x_564;
-        x_521_phi = x_520;
-        {
-          x_518 = x_518_phi;
-          x_521 = x_521_phi;
-          x_517_phi = x_518;
-          x_520_phi = x_521;
-        }
-      }
-      if (x_566_phi) {
+  0u;
+  do {
+    x_517_phi = false;
+    x_520_phi = 0;
+    [loop] while (true) {
+      int x_545 = 0;
+      int x_537 = 0;
+      bool x_518 = false;
+      int x_521 = 0;
+      bool x_518_phi = false;
+      int x_521_phi = 0;
+      x_517 = x_517_phi;
+      const int x_520 = x_520_phi;
+      x_566_phi = x_517;
+      if ((x_520 <= 9)) {
+      } else {
         break;
       }
+      const int x_526 = tree[x_520].data;
+      if ((13 <= x_526)) {
+        bool x_564_phi = false;
+        const int x_539_save = x_520;
+        const int x_540 = tree[x_539_save].leftIndex;
+        if ((x_540 == -1)) {
+          const float x_547 = asfloat(x_8[0].y);
+          const float x_549 = asfloat(x_8[0].x);
+          if ((x_547 < x_549)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_539_save].leftIndex = 9;
+          const BST tint_symbol_21 = {13, -1, -1};
+          tree[9] = tint_symbol_21;
+          [loop] while (true) {
+            x_564_phi = x_517;
+            if ((0 < int(x_547))) {
+            } else {
+              break;
+            }
+            x_564_phi = true;
+            break;
+          }
+          x_564 = x_564_phi;
+          x_566_phi = x_564;
+          if (x_564) {
+            break;
+          }
+        } else {
+          x_545 = tree[x_539_save].leftIndex;
+          x_518_phi = x_517;
+          x_521_phi = x_545;
+          {
+            x_518 = x_518_phi;
+            x_521 = x_521_phi;
+            x_517_phi = x_518;
+            x_520_phi = x_521;
+          }
+          continue;
+        }
+      } else {
+        const int x_531_save = x_520;
+        const int x_532 = tree[x_531_save].rightIndex;
+        if ((x_532 == -1)) {
+          tree[x_531_save].rightIndex = 9;
+          const BST tint_symbol_22 = {13, -1, -1};
+          tree[9] = tint_symbol_22;
+          x_566_phi = true;
+          break;
+        } else {
+          x_537 = tree[x_531_save].rightIndex;
+          x_518_phi = x_517;
+          x_521_phi = x_537;
+          {
+            x_518 = x_518_phi;
+            x_521 = x_521_phi;
+            x_517_phi = x_518;
+            x_520_phi = x_521;
+          }
+          continue;
+        }
+        return;
+      }
+      x_518_phi = x_564;
+      x_521_phi = x_520;
+      {
+        x_518 = x_518_phi;
+        x_521 = x_521_phi;
+        x_517_phi = x_518;
+        x_520_phi = x_521;
+      }
+    }
+    if (x_566_phi) {
       break;
     }
-  }
+  } while (false);
   x_569_phi = 0;
   x_572_phi = 0;
   x_574_phi = 0;
-  while (true) {
+  [loop] while (true) {
     int x_597 = 0;
     int x_607 = 0;
     int x_612 = 0;
@@ -1000,40 +1000,38 @@
     int x_582_phi = 0;
     int x_597_phi = 0;
     bool x_598_phi = false;
-    switch(0u) {
-      default: {
-        x_582_phi = 0;
-        while (true) {
-          const int x_582 = x_582_phi;
-          x_597_phi = x_569;
-          x_598_phi = false;
-          if ((x_582 != -1)) {
-          } else {
-            break;
-          }
-          const BST x_589 = tree[x_582];
-          const int x_590 = x_589.data;
-          const int x_591 = x_589.leftIndex;
-          const int x_592 = x_589.rightIndex;
-          if ((x_590 == x_574)) {
-            x_597_phi = x_574;
-            x_598_phi = true;
-            break;
-          }
-          {
-            x_582_phi = ((x_574 > x_590) ? x_592 : x_591);
-          }
-        }
-        x_597 = x_597_phi;
-        const bool x_598 = x_598_phi;
-        x_570_phi = x_597;
-        if (x_598) {
+    0u;
+    do {
+      x_582_phi = 0;
+      [loop] while (true) {
+        const int x_582 = x_582_phi;
+        x_597_phi = x_569;
+        x_598_phi = false;
+        if ((x_582 != -1)) {
+        } else {
           break;
         }
-        x_570_phi = -1;
+        const BST x_589 = tree[x_582];
+        const int x_590 = x_589.data;
+        const int x_591 = x_589.leftIndex;
+        const int x_592 = x_589.rightIndex;
+        if ((x_590 == x_574)) {
+          x_597_phi = x_574;
+          x_598_phi = true;
+          break;
+        }
+        {
+          x_582_phi = ((x_574 > x_590) ? x_592 : x_591);
+        }
+      }
+      x_597 = x_597_phi;
+      const bool x_598 = x_598_phi;
+      x_570_phi = x_597;
+      if (x_598) {
         break;
       }
-    }
+      x_570_phi = -1;
+    } while (false);
     int x_570 = 0;
     int x_606 = 0;
     int x_611 = 0;
@@ -1097,57 +1095,19 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol_2 main(tint_symbol_1 tint_symbol) {
-  const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
+main_out main_inner(float4 gl_FragCoord_param) {
   gl_FragCoord = gl_FragCoord_param;
   main_1();
-  const main_out tint_symbol_3 = {x_GLF_color};
-  const tint_symbol_2 tint_symbol_24 = {tint_symbol_3.x_GLF_color_1};
-  return tint_symbol_24;
+  const main_out tint_symbol_23 = {x_GLF_color};
+  return tint_symbol_23;
 }
-tint_SR61vW:1053:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
-        if ((x_570 == asint(x_574))) {
-             ~~~~~~^~~~~~~~~~~~~~~
-tint_SR61vW:1053:20: note: remove extraneous parentheses around the comparison to silence this warning
-        if ((x_570 == asint(x_574))) {
-            ~      ^              ~
-tint_SR61vW:1053:20: note: use '=' to turn this equality comparison into an assignment
-        if ((x_570 == asint(x_574))) {
-                   ^~
-                   =
-tint_SR61vW:1063:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
-        if ((x_570 == asint(-1))) {
-             ~~~~~~^~~~~~~~~~~~
-tint_SR61vW:1063:20: note: remove extraneous parentheses around the comparison to silence this warning
-        if ((x_570 == asint(-1))) {
-            ~      ^           ~
-tint_SR61vW:1063:20: note: use '=' to turn this equality comparison into an assignment
-        if ((x_570 == asint(-1))) {
-                   ^~
-                   =
-tint_SR61vW:1080:14: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
-  if ((x_572 == asint(20))) {
-       ~~~~~~^~~~~~~~~~~~
-tint_SR61vW:1080:14: note: remove extraneous parentheses around the comparison to silence this warning
-  if ((x_572 == asint(20))) {
-      ~      ^           ~
-tint_SR61vW:1080:14: note: use '=' to turn this equality comparison into an assignment
-  if ((x_572 == asint(20))) {
-             ^~
-             =
-warning: DXIL.dll not found.  Resulting DXIL will not be signed for use in release environments.
 
-error: validation errors
-tint_SR61vW:1098: error: Loop must have break.
-tint_SR61vW:1098: error: Loop must have break.
-tint_SR61vW:1098: error: Loop must have break.
-tint_SR61vW:1098: error: Loop must have break.
-tint_SR61vW:1098: error: Loop must have break.
-tint_SR61vW:1098: error: Loop must have break.
-tint_SR61vW:1098: error: Loop must have break.
-tint_SR61vW:1098: error: Loop must have break.
-tint_SR61vW:1098: error: Loop must have break.
-Validation failed.
-
-
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000016CFDF12D00(123,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000016CFDF12D00(54,27-30): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.hlsl
index 42418f3..0b0dee9 100755
--- a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl.expected.hlsl
@@ -1,5 +1,77 @@
 SKIP: FAILED
 
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:61:15 warning: code is unreachable
+              return;
+              ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:99:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:171:17 warning: code is unreachable
+                return;
+                ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:209:13 warning: code is unreachable
+            return;
+            ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:268:15 warning: code is unreachable
+              return;
+              ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:306:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:359:15 warning: code is unreachable
+              return;
+              ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:397:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:450:15 warning: code is unreachable
+              return;
+              ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:488:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:541:15 warning: code is unreachable
+              return;
+              ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:579:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:632:15 warning: code is unreachable
+              return;
+              ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:670:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:723:15 warning: code is unreachable
+              return;
+              ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:761:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:814:15 warning: code is unreachable
+              return;
+              ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/1.wgsl:852:11 warning: code is unreachable
+          return;
+          ^^^^^^
+
 struct BST {
   int data;
   int leftIndex;
@@ -24,109 +96,107 @@
   int x_569_phi = 0;
   int x_572_phi = 0;
   int x_574_phi = 0;
-  const BST tint_symbol_5 = {9, -1, -1};
-  tree[0] = tint_symbol_5;
-  switch(0u) {
-    default: {
-      x_67_phi = false;
-      x_70_phi = 0;
-      while (true) {
-        int x_95 = 0;
-        int x_87 = 0;
-        bool x_68 = false;
-        int x_71 = 0;
-        bool x_68_phi = false;
-        int x_71_phi = 0;
-        x_67 = x_67_phi;
-        const int x_70 = x_70_phi;
-        x_116_phi = x_67;
-        if ((x_70 <= 1)) {
-        } else {
-          break;
-        }
-        const int x_76 = tree[x_70].data;
-        if ((5 <= x_76)) {
-          bool x_114_phi = false;
-          const int x_89_save = x_70;
-          const int x_90 = tree[x_89_save].leftIndex;
-          if ((x_90 == -1)) {
-            const float x_97 = asfloat(x_8[0].y);
-            const float x_99 = asfloat(x_8[0].x);
-            if ((x_97 < x_99)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_89_save].leftIndex = 1;
-            const BST tint_symbol_6 = {5, -1, -1};
-            tree[1] = tint_symbol_6;
-            while (true) {
-              x_114_phi = x_67;
-              if ((0 < int(x_97))) {
-              } else {
-                break;
-              }
-              x_114_phi = true;
-              break;
-            }
-            x_114 = x_114_phi;
-            x_116_phi = x_114;
-            if (x_114) {
-              break;
-            }
-          } else {
-            x_95 = tree[x_89_save].leftIndex;
-            x_68_phi = x_67;
-            x_71_phi = x_95;
-            {
-              x_68 = x_68_phi;
-              x_71 = x_71_phi;
-              x_67_phi = x_68;
-              x_70_phi = x_71;
-            }
-            continue;
-          }
-        } else {
-          const int x_81_save = x_70;
-          const int x_82 = tree[x_81_save].rightIndex;
-          if ((x_82 == -1)) {
-            tree[x_81_save].rightIndex = 1;
-            const BST tint_symbol_7 = {5, -1, -1};
-            tree[1] = tint_symbol_7;
-            x_116_phi = true;
-            break;
-          } else {
-            x_87 = tree[x_81_save].rightIndex;
-            x_68_phi = x_67;
-            x_71_phi = x_87;
-            {
-              x_68 = x_68_phi;
-              x_71 = x_71_phi;
-              x_67_phi = x_68;
-              x_70_phi = x_71;
-            }
-            continue;
-          }
-          return;
-        }
-        x_68_phi = x_114;
-        x_71_phi = x_70;
-        {
-          x_68 = x_68_phi;
-          x_71 = x_71_phi;
-          x_67_phi = x_68;
-          x_70_phi = x_71;
-        }
-      }
-      if (x_116_phi) {
+  const BST tint_symbol_4 = {9, -1, -1};
+  tree[0] = tint_symbol_4;
+  0u;
+  do {
+    x_67_phi = false;
+    x_70_phi = 0;
+    [loop] while (true) {
+      int x_95 = 0;
+      int x_87 = 0;
+      bool x_68 = false;
+      int x_71 = 0;
+      bool x_68_phi = false;
+      int x_71_phi = 0;
+      x_67 = x_67_phi;
+      const int x_70 = x_70_phi;
+      x_116_phi = x_67;
+      if ((x_70 <= 1)) {
+      } else {
         break;
       }
+      const int x_76 = tree[x_70].data;
+      if ((5 <= x_76)) {
+        bool x_114_phi = false;
+        const int x_89_save = x_70;
+        const int x_90 = tree[x_89_save].leftIndex;
+        if ((x_90 == -1)) {
+          const float x_97 = asfloat(x_8[0].y);
+          const float x_99 = asfloat(x_8[0].x);
+          if ((x_97 < x_99)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_89_save].leftIndex = 1;
+          const BST tint_symbol_5 = {5, -1, -1};
+          tree[1] = tint_symbol_5;
+          [loop] while (true) {
+            x_114_phi = x_67;
+            if ((0 < int(x_97))) {
+            } else {
+              break;
+            }
+            x_114_phi = true;
+            break;
+          }
+          x_114 = x_114_phi;
+          x_116_phi = x_114;
+          if (x_114) {
+            break;
+          }
+        } else {
+          x_95 = tree[x_89_save].leftIndex;
+          x_68_phi = x_67;
+          x_71_phi = x_95;
+          {
+            x_68 = x_68_phi;
+            x_71 = x_71_phi;
+            x_67_phi = x_68;
+            x_70_phi = x_71;
+          }
+          continue;
+        }
+      } else {
+        const int x_81_save = x_70;
+        const int x_82 = tree[x_81_save].rightIndex;
+        if ((x_82 == -1)) {
+          tree[x_81_save].rightIndex = 1;
+          const BST tint_symbol_6 = {5, -1, -1};
+          tree[1] = tint_symbol_6;
+          x_116_phi = true;
+          break;
+        } else {
+          x_87 = tree[x_81_save].rightIndex;
+          x_68_phi = x_67;
+          x_71_phi = x_87;
+          {
+            x_68 = x_68_phi;
+            x_71 = x_71_phi;
+            x_67_phi = x_68;
+            x_70_phi = x_71;
+          }
+          continue;
+        }
+        return;
+      }
+      x_68_phi = x_114;
+      x_71_phi = x_70;
+      {
+        x_68 = x_68_phi;
+        x_71 = x_71_phi;
+        x_67_phi = x_68;
+        x_70_phi = x_71;
+      }
+    }
+    if (x_116_phi) {
       break;
     }
-  }
+  } while (false);
   x_119_phi = 0;
-  while (true) {
+  [loop] while (true) {
     bool x_133 = false;
     int x_120 = 0;
     bool x_134_phi = false;
@@ -148,105 +218,103 @@
     bool x_139_phi = false;
     int x_142_phi = 0;
     bool x_188_phi = false;
-    switch(0u) {
-      default: {
-        x_139_phi = false;
-        x_142_phi = 0;
-        while (true) {
-          int x_167 = 0;
-          int x_159 = 0;
-          bool x_140 = false;
-          int x_143 = 0;
-          bool x_140_phi = false;
-          int x_143_phi = 0;
-          x_139 = x_139_phi;
-          const int x_142 = x_142_phi;
-          x_188_phi = x_139;
-          if ((x_142 <= 2)) {
-          } else {
-            break;
-          }
-          const int x_148 = tree[x_142].data;
-          if ((12 <= x_148)) {
-            bool x_186_phi = false;
-            const int x_161_save = x_142;
-            const int x_162 = tree[x_161_save].leftIndex;
-            if ((x_162 == -1)) {
-              const float x_169 = asfloat(x_8[0].y);
-              const float x_171 = asfloat(x_8[0].x);
-              if ((x_169 < x_171)) {
-                while (true) {
-                  discard;
-                }
-                return;
-              }
-              tree[x_161_save].leftIndex = 2;
-              const BST tint_symbol_8 = {12, -1, -1};
-              tree[2] = tint_symbol_8;
-              while (true) {
-                x_186_phi = x_139;
-                if ((0 < int(x_169))) {
-                } else {
-                  break;
-                }
-                x_186_phi = true;
-                break;
-              }
-              x_186 = x_186_phi;
-              x_188_phi = x_186;
-              if (x_186) {
-                break;
-              }
-            } else {
-              x_167 = tree[x_161_save].leftIndex;
-              x_140_phi = x_139;
-              x_143_phi = x_167;
-              {
-                x_140 = x_140_phi;
-                x_143 = x_143_phi;
-                x_139_phi = x_140;
-                x_142_phi = x_143;
-              }
-              continue;
-            }
-          } else {
-            const int x_153_save = x_142;
-            const int x_154 = tree[x_153_save].rightIndex;
-            if ((x_154 == -1)) {
-              tree[x_153_save].rightIndex = 2;
-              const BST tint_symbol_9 = {12, -1, -1};
-              tree[2] = tint_symbol_9;
-              x_188_phi = true;
-              break;
-            } else {
-              x_159 = tree[x_153_save].rightIndex;
-              x_140_phi = x_139;
-              x_143_phi = x_159;
-              {
-                x_140 = x_140_phi;
-                x_143 = x_143_phi;
-                x_139_phi = x_140;
-                x_142_phi = x_143;
-              }
-              continue;
-            }
-            return;
-          }
-          x_140_phi = x_186;
-          x_143_phi = x_142;
-          {
-            x_140 = x_140_phi;
-            x_143 = x_143_phi;
-            x_139_phi = x_140;
-            x_142_phi = x_143;
-          }
-        }
-        if (x_188_phi) {
+    0u;
+    do {
+      x_139_phi = false;
+      x_142_phi = 0;
+      [loop] while (true) {
+        int x_167 = 0;
+        int x_159 = 0;
+        bool x_140 = false;
+        int x_143 = 0;
+        bool x_140_phi = false;
+        int x_143_phi = 0;
+        x_139 = x_139_phi;
+        const int x_142 = x_142_phi;
+        x_188_phi = x_139;
+        if ((x_142 <= 2)) {
+        } else {
           break;
         }
+        const int x_148 = tree[x_142].data;
+        if ((12 <= x_148)) {
+          bool x_186_phi = false;
+          const int x_161_save = x_142;
+          const int x_162 = tree[x_161_save].leftIndex;
+          if ((x_162 == -1)) {
+            const float x_169 = asfloat(x_8[0].y);
+            const float x_171 = asfloat(x_8[0].x);
+            if ((x_169 < x_171)) {
+              [loop] while (true) {
+                discard;
+              }
+              return;
+            }
+            tree[x_161_save].leftIndex = 2;
+            const BST tint_symbol_7 = {12, -1, -1};
+            tree[2] = tint_symbol_7;
+            [loop] while (true) {
+              x_186_phi = x_139;
+              if ((0 < int(x_169))) {
+              } else {
+                break;
+              }
+              x_186_phi = true;
+              break;
+            }
+            x_186 = x_186_phi;
+            x_188_phi = x_186;
+            if (x_186) {
+              break;
+            }
+          } else {
+            x_167 = tree[x_161_save].leftIndex;
+            x_140_phi = x_139;
+            x_143_phi = x_167;
+            {
+              x_140 = x_140_phi;
+              x_143 = x_143_phi;
+              x_139_phi = x_140;
+              x_142_phi = x_143;
+            }
+            continue;
+          }
+        } else {
+          const int x_153_save = x_142;
+          const int x_154 = tree[x_153_save].rightIndex;
+          if ((x_154 == -1)) {
+            tree[x_153_save].rightIndex = 2;
+            const BST tint_symbol_8 = {12, -1, -1};
+            tree[2] = tint_symbol_8;
+            x_188_phi = true;
+            break;
+          } else {
+            x_159 = tree[x_153_save].rightIndex;
+            x_140_phi = x_139;
+            x_143_phi = x_159;
+            {
+              x_140 = x_140_phi;
+              x_143 = x_143_phi;
+              x_139_phi = x_140;
+              x_142_phi = x_143;
+            }
+            continue;
+          }
+          return;
+        }
+        x_140_phi = x_186;
+        x_143_phi = x_142;
+        {
+          x_140 = x_140_phi;
+          x_143 = x_143_phi;
+          x_139_phi = x_140;
+          x_142_phi = x_143;
+        }
+      }
+      if (x_188_phi) {
         break;
       }
-    }
+    } while (false);
     {
       x_120 = (x_119 + 1);
       x_119_phi = x_120;
@@ -257,733 +325,719 @@
   bool x_193_phi = false;
   int x_196_phi = 0;
   bool x_242_phi = false;
-  switch(0u) {
-    default: {
-      x_193_phi = false;
-      x_196_phi = 0;
-      while (true) {
-        int x_221 = 0;
-        int x_213 = 0;
-        bool x_194 = false;
-        int x_197 = 0;
-        bool x_194_phi = false;
-        int x_197_phi = 0;
-        x_193 = x_193_phi;
-        const int x_196 = x_196_phi;
-        x_242_phi = x_193;
-        if ((x_196 <= 3)) {
-        } else {
-          break;
-        }
-        const int x_202 = tree[x_196].data;
-        if ((15 <= x_202)) {
-          bool x_240_phi = false;
-          const int x_215_save = x_196;
-          const int x_216 = tree[x_215_save].leftIndex;
-          if ((x_216 == -1)) {
-            const float x_223 = asfloat(x_8[0].y);
-            const float x_225 = asfloat(x_8[0].x);
-            if ((x_223 < x_225)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_215_save].leftIndex = 3;
-            const BST tint_symbol_10 = {15, -1, -1};
-            tree[3] = tint_symbol_10;
-            while (true) {
-              x_240_phi = x_193;
-              if ((0 < int(x_223))) {
-              } else {
-                break;
-              }
-              x_240_phi = true;
-              break;
-            }
-            x_240 = x_240_phi;
-            x_242_phi = x_240;
-            if (x_240) {
-              break;
-            }
-          } else {
-            x_221 = tree[x_215_save].leftIndex;
-            x_194_phi = x_193;
-            x_197_phi = x_221;
-            {
-              x_194 = x_194_phi;
-              x_197 = x_197_phi;
-              x_193_phi = x_194;
-              x_196_phi = x_197;
-            }
-            continue;
-          }
-        } else {
-          const int x_207_save = x_196;
-          const int x_208 = tree[x_207_save].rightIndex;
-          if ((x_208 == -1)) {
-            tree[x_207_save].rightIndex = 3;
-            const BST tint_symbol_11 = {15, -1, -1};
-            tree[3] = tint_symbol_11;
-            x_242_phi = true;
-            break;
-          } else {
-            x_213 = tree[x_207_save].rightIndex;
-            x_194_phi = x_193;
-            x_197_phi = x_213;
-            {
-              x_194 = x_194_phi;
-              x_197 = x_197_phi;
-              x_193_phi = x_194;
-              x_196_phi = x_197;
-            }
-            continue;
-          }
-          return;
-        }
-        x_194_phi = x_240;
-        x_197_phi = x_196;
-        {
-          x_194 = x_194_phi;
-          x_197 = x_197_phi;
-          x_193_phi = x_194;
-          x_196_phi = x_197;
-        }
-      }
-      if (x_242_phi) {
+  0u;
+  do {
+    x_193_phi = false;
+    x_196_phi = 0;
+    [loop] while (true) {
+      int x_221 = 0;
+      int x_213 = 0;
+      bool x_194 = false;
+      int x_197 = 0;
+      bool x_194_phi = false;
+      int x_197_phi = 0;
+      x_193 = x_193_phi;
+      const int x_196 = x_196_phi;
+      x_242_phi = x_193;
+      if ((x_196 <= 3)) {
+      } else {
         break;
       }
+      const int x_202 = tree[x_196].data;
+      if ((15 <= x_202)) {
+        bool x_240_phi = false;
+        const int x_215_save = x_196;
+        const int x_216 = tree[x_215_save].leftIndex;
+        if ((x_216 == -1)) {
+          const float x_223 = asfloat(x_8[0].y);
+          const float x_225 = asfloat(x_8[0].x);
+          if ((x_223 < x_225)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_215_save].leftIndex = 3;
+          const BST tint_symbol_9 = {15, -1, -1};
+          tree[3] = tint_symbol_9;
+          [loop] while (true) {
+            x_240_phi = x_193;
+            if ((0 < int(x_223))) {
+            } else {
+              break;
+            }
+            x_240_phi = true;
+            break;
+          }
+          x_240 = x_240_phi;
+          x_242_phi = x_240;
+          if (x_240) {
+            break;
+          }
+        } else {
+          x_221 = tree[x_215_save].leftIndex;
+          x_194_phi = x_193;
+          x_197_phi = x_221;
+          {
+            x_194 = x_194_phi;
+            x_197 = x_197_phi;
+            x_193_phi = x_194;
+            x_196_phi = x_197;
+          }
+          continue;
+        }
+      } else {
+        const int x_207_save = x_196;
+        const int x_208 = tree[x_207_save].rightIndex;
+        if ((x_208 == -1)) {
+          tree[x_207_save].rightIndex = 3;
+          const BST tint_symbol_10 = {15, -1, -1};
+          tree[3] = tint_symbol_10;
+          x_242_phi = true;
+          break;
+        } else {
+          x_213 = tree[x_207_save].rightIndex;
+          x_194_phi = x_193;
+          x_197_phi = x_213;
+          {
+            x_194 = x_194_phi;
+            x_197 = x_197_phi;
+            x_193_phi = x_194;
+            x_196_phi = x_197;
+          }
+          continue;
+        }
+        return;
+      }
+      x_194_phi = x_240;
+      x_197_phi = x_196;
+      {
+        x_194 = x_194_phi;
+        x_197 = x_197_phi;
+        x_193_phi = x_194;
+        x_196_phi = x_197;
+      }
+    }
+    if (x_242_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_247 = false;
   bool x_294 = false;
   bool x_247_phi = false;
   int x_250_phi = 0;
   bool x_296_phi = false;
-  switch(0u) {
-    default: {
-      x_247_phi = false;
-      x_250_phi = 0;
-      while (true) {
-        int x_275 = 0;
-        int x_267 = 0;
-        bool x_248 = false;
-        int x_251 = 0;
-        bool x_248_phi = false;
-        int x_251_phi = 0;
-        x_247 = x_247_phi;
-        const int x_250 = x_250_phi;
-        x_296_phi = x_247;
-        if ((x_250 <= 4)) {
-        } else {
-          break;
-        }
-        const int x_256 = tree[x_250].data;
-        if ((7 <= x_256)) {
-          bool x_294_phi = false;
-          const int x_269_save = x_250;
-          const int x_270 = tree[x_269_save].leftIndex;
-          if ((x_270 == -1)) {
-            const float x_277 = asfloat(x_8[0].y);
-            const float x_279 = asfloat(x_8[0].x);
-            if ((x_277 < x_279)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_269_save].leftIndex = 4;
-            const BST tint_symbol_12 = {7, -1, -1};
-            tree[4] = tint_symbol_12;
-            while (true) {
-              x_294_phi = x_247;
-              if ((0 < int(x_277))) {
-              } else {
-                break;
-              }
-              x_294_phi = true;
-              break;
-            }
-            x_294 = x_294_phi;
-            x_296_phi = x_294;
-            if (x_294) {
-              break;
-            }
-          } else {
-            x_275 = tree[x_269_save].leftIndex;
-            x_248_phi = x_247;
-            x_251_phi = x_275;
-            {
-              x_248 = x_248_phi;
-              x_251 = x_251_phi;
-              x_247_phi = x_248;
-              x_250_phi = x_251;
-            }
-            continue;
-          }
-        } else {
-          const int x_261_save = x_250;
-          const int x_262 = tree[x_261_save].rightIndex;
-          if ((x_262 == -1)) {
-            tree[x_261_save].rightIndex = 4;
-            const BST tint_symbol_13 = {7, -1, -1};
-            tree[4] = tint_symbol_13;
-            x_296_phi = true;
-            break;
-          } else {
-            x_267 = tree[x_261_save].rightIndex;
-            x_248_phi = x_247;
-            x_251_phi = x_267;
-            {
-              x_248 = x_248_phi;
-              x_251 = x_251_phi;
-              x_247_phi = x_248;
-              x_250_phi = x_251;
-            }
-            continue;
-          }
-          return;
-        }
-        x_248_phi = x_294;
-        x_251_phi = x_250;
-        {
-          x_248 = x_248_phi;
-          x_251 = x_251_phi;
-          x_247_phi = x_248;
-          x_250_phi = x_251;
-        }
-      }
-      if (x_296_phi) {
+  0u;
+  do {
+    x_247_phi = false;
+    x_250_phi = 0;
+    [loop] while (true) {
+      int x_275 = 0;
+      int x_267 = 0;
+      bool x_248 = false;
+      int x_251 = 0;
+      bool x_248_phi = false;
+      int x_251_phi = 0;
+      x_247 = x_247_phi;
+      const int x_250 = x_250_phi;
+      x_296_phi = x_247;
+      if ((x_250 <= 4)) {
+      } else {
         break;
       }
+      const int x_256 = tree[x_250].data;
+      if ((7 <= x_256)) {
+        bool x_294_phi = false;
+        const int x_269_save = x_250;
+        const int x_270 = tree[x_269_save].leftIndex;
+        if ((x_270 == -1)) {
+          const float x_277 = asfloat(x_8[0].y);
+          const float x_279 = asfloat(x_8[0].x);
+          if ((x_277 < x_279)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_269_save].leftIndex = 4;
+          const BST tint_symbol_11 = {7, -1, -1};
+          tree[4] = tint_symbol_11;
+          [loop] while (true) {
+            x_294_phi = x_247;
+            if ((0 < int(x_277))) {
+            } else {
+              break;
+            }
+            x_294_phi = true;
+            break;
+          }
+          x_294 = x_294_phi;
+          x_296_phi = x_294;
+          if (x_294) {
+            break;
+          }
+        } else {
+          x_275 = tree[x_269_save].leftIndex;
+          x_248_phi = x_247;
+          x_251_phi = x_275;
+          {
+            x_248 = x_248_phi;
+            x_251 = x_251_phi;
+            x_247_phi = x_248;
+            x_250_phi = x_251;
+          }
+          continue;
+        }
+      } else {
+        const int x_261_save = x_250;
+        const int x_262 = tree[x_261_save].rightIndex;
+        if ((x_262 == -1)) {
+          tree[x_261_save].rightIndex = 4;
+          const BST tint_symbol_12 = {7, -1, -1};
+          tree[4] = tint_symbol_12;
+          x_296_phi = true;
+          break;
+        } else {
+          x_267 = tree[x_261_save].rightIndex;
+          x_248_phi = x_247;
+          x_251_phi = x_267;
+          {
+            x_248 = x_248_phi;
+            x_251 = x_251_phi;
+            x_247_phi = x_248;
+            x_250_phi = x_251;
+          }
+          continue;
+        }
+        return;
+      }
+      x_248_phi = x_294;
+      x_251_phi = x_250;
+      {
+        x_248 = x_248_phi;
+        x_251 = x_251_phi;
+        x_247_phi = x_248;
+        x_250_phi = x_251;
+      }
+    }
+    if (x_296_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_301 = false;
   bool x_348 = false;
   bool x_301_phi = false;
   int x_304_phi = 0;
   bool x_350_phi = false;
-  switch(0u) {
-    default: {
-      x_301_phi = false;
-      x_304_phi = 0;
-      while (true) {
-        int x_329 = 0;
-        int x_321 = 0;
-        bool x_302 = false;
-        int x_305 = 0;
-        bool x_302_phi = false;
-        int x_305_phi = 0;
-        x_301 = x_301_phi;
-        const int x_304 = x_304_phi;
-        x_350_phi = x_301;
-        if ((x_304 <= 5)) {
-        } else {
-          break;
-        }
-        const int x_310 = tree[x_304].data;
-        if ((8 <= x_310)) {
-          bool x_348_phi = false;
-          const int x_323_save = x_304;
-          const int x_324 = tree[x_323_save].leftIndex;
-          if ((x_324 == -1)) {
-            const float x_331 = asfloat(x_8[0].y);
-            const float x_333 = asfloat(x_8[0].x);
-            if ((x_331 < x_333)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_323_save].leftIndex = 5;
-            const BST tint_symbol_14 = {8, -1, -1};
-            tree[5] = tint_symbol_14;
-            while (true) {
-              x_348_phi = x_301;
-              if ((0 < int(x_331))) {
-              } else {
-                break;
-              }
-              x_348_phi = true;
-              break;
-            }
-            x_348 = x_348_phi;
-            x_350_phi = x_348;
-            if (x_348) {
-              break;
-            }
-          } else {
-            x_329 = tree[x_323_save].leftIndex;
-            x_302_phi = x_301;
-            x_305_phi = x_329;
-            {
-              x_302 = x_302_phi;
-              x_305 = x_305_phi;
-              x_301_phi = x_302;
-              x_304_phi = x_305;
-            }
-            continue;
-          }
-        } else {
-          const int x_315_save = x_304;
-          const int x_316 = tree[x_315_save].rightIndex;
-          if ((x_316 == -1)) {
-            tree[x_315_save].rightIndex = 5;
-            const BST tint_symbol_15 = {8, -1, -1};
-            tree[5] = tint_symbol_15;
-            x_350_phi = true;
-            break;
-          } else {
-            x_321 = tree[x_315_save].rightIndex;
-            x_302_phi = x_301;
-            x_305_phi = x_321;
-            {
-              x_302 = x_302_phi;
-              x_305 = x_305_phi;
-              x_301_phi = x_302;
-              x_304_phi = x_305;
-            }
-            continue;
-          }
-          return;
-        }
-        x_302_phi = x_348;
-        x_305_phi = x_304;
-        {
-          x_302 = x_302_phi;
-          x_305 = x_305_phi;
-          x_301_phi = x_302;
-          x_304_phi = x_305;
-        }
-      }
-      if (x_350_phi) {
+  0u;
+  do {
+    x_301_phi = false;
+    x_304_phi = 0;
+    [loop] while (true) {
+      int x_329 = 0;
+      int x_321 = 0;
+      bool x_302 = false;
+      int x_305 = 0;
+      bool x_302_phi = false;
+      int x_305_phi = 0;
+      x_301 = x_301_phi;
+      const int x_304 = x_304_phi;
+      x_350_phi = x_301;
+      if ((x_304 <= 5)) {
+      } else {
         break;
       }
+      const int x_310 = tree[x_304].data;
+      if ((8 <= x_310)) {
+        bool x_348_phi = false;
+        const int x_323_save = x_304;
+        const int x_324 = tree[x_323_save].leftIndex;
+        if ((x_324 == -1)) {
+          const float x_331 = asfloat(x_8[0].y);
+          const float x_333 = asfloat(x_8[0].x);
+          if ((x_331 < x_333)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_323_save].leftIndex = 5;
+          const BST tint_symbol_13 = {8, -1, -1};
+          tree[5] = tint_symbol_13;
+          [loop] while (true) {
+            x_348_phi = x_301;
+            if ((0 < int(x_331))) {
+            } else {
+              break;
+            }
+            x_348_phi = true;
+            break;
+          }
+          x_348 = x_348_phi;
+          x_350_phi = x_348;
+          if (x_348) {
+            break;
+          }
+        } else {
+          x_329 = tree[x_323_save].leftIndex;
+          x_302_phi = x_301;
+          x_305_phi = x_329;
+          {
+            x_302 = x_302_phi;
+            x_305 = x_305_phi;
+            x_301_phi = x_302;
+            x_304_phi = x_305;
+          }
+          continue;
+        }
+      } else {
+        const int x_315_save = x_304;
+        const int x_316 = tree[x_315_save].rightIndex;
+        if ((x_316 == -1)) {
+          tree[x_315_save].rightIndex = 5;
+          const BST tint_symbol_14 = {8, -1, -1};
+          tree[5] = tint_symbol_14;
+          x_350_phi = true;
+          break;
+        } else {
+          x_321 = tree[x_315_save].rightIndex;
+          x_302_phi = x_301;
+          x_305_phi = x_321;
+          {
+            x_302 = x_302_phi;
+            x_305 = x_305_phi;
+            x_301_phi = x_302;
+            x_304_phi = x_305;
+          }
+          continue;
+        }
+        return;
+      }
+      x_302_phi = x_348;
+      x_305_phi = x_304;
+      {
+        x_302 = x_302_phi;
+        x_305 = x_305_phi;
+        x_301_phi = x_302;
+        x_304_phi = x_305;
+      }
+    }
+    if (x_350_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_355 = false;
   bool x_402 = false;
   bool x_355_phi = false;
   int x_358_phi = 0;
   bool x_404_phi = false;
-  switch(0u) {
-    default: {
-      x_355_phi = false;
-      x_358_phi = 0;
-      while (true) {
-        int x_383 = 0;
-        int x_375 = 0;
-        bool x_356 = false;
-        int x_359 = 0;
-        bool x_356_phi = false;
-        int x_359_phi = 0;
-        x_355 = x_355_phi;
-        const int x_358 = x_358_phi;
-        x_404_phi = x_355;
-        if ((x_358 <= 6)) {
-        } else {
-          break;
-        }
-        const int x_364 = tree[x_358].data;
-        if ((2 <= x_364)) {
-          bool x_402_phi = false;
-          const int x_377_save = x_358;
-          const int x_378 = tree[x_377_save].leftIndex;
-          if ((x_378 == -1)) {
-            const float x_385 = asfloat(x_8[0].y);
-            const float x_387 = asfloat(x_8[0].x);
-            if ((x_385 < x_387)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_377_save].leftIndex = 6;
-            const BST tint_symbol_16 = {2, -1, -1};
-            tree[6] = tint_symbol_16;
-            while (true) {
-              x_402_phi = x_355;
-              if ((0 < int(x_385))) {
-              } else {
-                break;
-              }
-              x_402_phi = true;
-              break;
-            }
-            x_402 = x_402_phi;
-            x_404_phi = x_402;
-            if (x_402) {
-              break;
-            }
-          } else {
-            x_383 = tree[x_377_save].leftIndex;
-            x_356_phi = x_355;
-            x_359_phi = x_383;
-            {
-              x_356 = x_356_phi;
-              x_359 = x_359_phi;
-              x_355_phi = x_356;
-              x_358_phi = x_359;
-            }
-            continue;
-          }
-        } else {
-          const int x_369_save = x_358;
-          const int x_370 = tree[x_369_save].rightIndex;
-          if ((x_370 == -1)) {
-            tree[x_369_save].rightIndex = 6;
-            const BST tint_symbol_17 = {2, -1, -1};
-            tree[6] = tint_symbol_17;
-            x_404_phi = true;
-            break;
-          } else {
-            x_375 = tree[x_369_save].rightIndex;
-            x_356_phi = x_355;
-            x_359_phi = x_375;
-            {
-              x_356 = x_356_phi;
-              x_359 = x_359_phi;
-              x_355_phi = x_356;
-              x_358_phi = x_359;
-            }
-            continue;
-          }
-          return;
-        }
-        x_356_phi = x_402;
-        x_359_phi = x_358;
-        {
-          x_356 = x_356_phi;
-          x_359 = x_359_phi;
-          x_355_phi = x_356;
-          x_358_phi = x_359;
-        }
-      }
-      if (x_404_phi) {
+  0u;
+  do {
+    x_355_phi = false;
+    x_358_phi = 0;
+    [loop] while (true) {
+      int x_383 = 0;
+      int x_375 = 0;
+      bool x_356 = false;
+      int x_359 = 0;
+      bool x_356_phi = false;
+      int x_359_phi = 0;
+      x_355 = x_355_phi;
+      const int x_358 = x_358_phi;
+      x_404_phi = x_355;
+      if ((x_358 <= 6)) {
+      } else {
         break;
       }
+      const int x_364 = tree[x_358].data;
+      if ((2 <= x_364)) {
+        bool x_402_phi = false;
+        const int x_377_save = x_358;
+        const int x_378 = tree[x_377_save].leftIndex;
+        if ((x_378 == -1)) {
+          const float x_385 = asfloat(x_8[0].y);
+          const float x_387 = asfloat(x_8[0].x);
+          if ((x_385 < x_387)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_377_save].leftIndex = 6;
+          const BST tint_symbol_15 = {2, -1, -1};
+          tree[6] = tint_symbol_15;
+          [loop] while (true) {
+            x_402_phi = x_355;
+            if ((0 < int(x_385))) {
+            } else {
+              break;
+            }
+            x_402_phi = true;
+            break;
+          }
+          x_402 = x_402_phi;
+          x_404_phi = x_402;
+          if (x_402) {
+            break;
+          }
+        } else {
+          x_383 = tree[x_377_save].leftIndex;
+          x_356_phi = x_355;
+          x_359_phi = x_383;
+          {
+            x_356 = x_356_phi;
+            x_359 = x_359_phi;
+            x_355_phi = x_356;
+            x_358_phi = x_359;
+          }
+          continue;
+        }
+      } else {
+        const int x_369_save = x_358;
+        const int x_370 = tree[x_369_save].rightIndex;
+        if ((x_370 == -1)) {
+          tree[x_369_save].rightIndex = 6;
+          const BST tint_symbol_16 = {2, -1, -1};
+          tree[6] = tint_symbol_16;
+          x_404_phi = true;
+          break;
+        } else {
+          x_375 = tree[x_369_save].rightIndex;
+          x_356_phi = x_355;
+          x_359_phi = x_375;
+          {
+            x_356 = x_356_phi;
+            x_359 = x_359_phi;
+            x_355_phi = x_356;
+            x_358_phi = x_359;
+          }
+          continue;
+        }
+        return;
+      }
+      x_356_phi = x_402;
+      x_359_phi = x_358;
+      {
+        x_356 = x_356_phi;
+        x_359 = x_359_phi;
+        x_355_phi = x_356;
+        x_358_phi = x_359;
+      }
+    }
+    if (x_404_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_409 = false;
   bool x_456 = false;
   bool x_409_phi = false;
   int x_412_phi = 0;
   bool x_458_phi = false;
-  switch(0u) {
-    default: {
-      x_409_phi = false;
-      x_412_phi = 0;
-      while (true) {
-        int x_437 = 0;
-        int x_429 = 0;
-        bool x_410 = false;
-        int x_413 = 0;
-        bool x_410_phi = false;
-        int x_413_phi = 0;
-        x_409 = x_409_phi;
-        const int x_412 = x_412_phi;
-        x_458_phi = x_409;
-        if ((x_412 <= 7)) {
-        } else {
-          break;
-        }
-        const int x_418 = tree[x_412].data;
-        if ((6 <= x_418)) {
-          bool x_456_phi = false;
-          const int x_431_save = x_412;
-          const int x_432 = tree[x_431_save].leftIndex;
-          if ((x_432 == -1)) {
-            const float x_439 = asfloat(x_8[0].y);
-            const float x_441 = asfloat(x_8[0].x);
-            if ((x_439 < x_441)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_431_save].leftIndex = 7;
-            const BST tint_symbol_18 = {6, -1, -1};
-            tree[7] = tint_symbol_18;
-            while (true) {
-              x_456_phi = x_409;
-              if ((0 < int(x_439))) {
-              } else {
-                break;
-              }
-              x_456_phi = true;
-              break;
-            }
-            x_456 = x_456_phi;
-            x_458_phi = x_456;
-            if (x_456) {
-              break;
-            }
-          } else {
-            x_437 = tree[x_431_save].leftIndex;
-            x_410_phi = x_409;
-            x_413_phi = x_437;
-            {
-              x_410 = x_410_phi;
-              x_413 = x_413_phi;
-              x_409_phi = x_410;
-              x_412_phi = x_413;
-            }
-            continue;
-          }
-        } else {
-          const int x_423_save = x_412;
-          const int x_424 = tree[x_423_save].rightIndex;
-          if ((x_424 == -1)) {
-            tree[x_423_save].rightIndex = 7;
-            const BST tint_symbol_19 = {6, -1, -1};
-            tree[7] = tint_symbol_19;
-            x_458_phi = true;
-            break;
-          } else {
-            x_429 = tree[x_423_save].rightIndex;
-            x_410_phi = x_409;
-            x_413_phi = x_429;
-            {
-              x_410 = x_410_phi;
-              x_413 = x_413_phi;
-              x_409_phi = x_410;
-              x_412_phi = x_413;
-            }
-            continue;
-          }
-          return;
-        }
-        x_410_phi = x_456;
-        x_413_phi = x_412;
-        {
-          x_410 = x_410_phi;
-          x_413 = x_413_phi;
-          x_409_phi = x_410;
-          x_412_phi = x_413;
-        }
-      }
-      if (x_458_phi) {
+  0u;
+  do {
+    x_409_phi = false;
+    x_412_phi = 0;
+    [loop] while (true) {
+      int x_437 = 0;
+      int x_429 = 0;
+      bool x_410 = false;
+      int x_413 = 0;
+      bool x_410_phi = false;
+      int x_413_phi = 0;
+      x_409 = x_409_phi;
+      const int x_412 = x_412_phi;
+      x_458_phi = x_409;
+      if ((x_412 <= 7)) {
+      } else {
         break;
       }
+      const int x_418 = tree[x_412].data;
+      if ((6 <= x_418)) {
+        bool x_456_phi = false;
+        const int x_431_save = x_412;
+        const int x_432 = tree[x_431_save].leftIndex;
+        if ((x_432 == -1)) {
+          const float x_439 = asfloat(x_8[0].y);
+          const float x_441 = asfloat(x_8[0].x);
+          if ((x_439 < x_441)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_431_save].leftIndex = 7;
+          const BST tint_symbol_17 = {6, -1, -1};
+          tree[7] = tint_symbol_17;
+          [loop] while (true) {
+            x_456_phi = x_409;
+            if ((0 < int(x_439))) {
+            } else {
+              break;
+            }
+            x_456_phi = true;
+            break;
+          }
+          x_456 = x_456_phi;
+          x_458_phi = x_456;
+          if (x_456) {
+            break;
+          }
+        } else {
+          x_437 = tree[x_431_save].leftIndex;
+          x_410_phi = x_409;
+          x_413_phi = x_437;
+          {
+            x_410 = x_410_phi;
+            x_413 = x_413_phi;
+            x_409_phi = x_410;
+            x_412_phi = x_413;
+          }
+          continue;
+        }
+      } else {
+        const int x_423_save = x_412;
+        const int x_424 = tree[x_423_save].rightIndex;
+        if ((x_424 == -1)) {
+          tree[x_423_save].rightIndex = 7;
+          const BST tint_symbol_18 = {6, -1, -1};
+          tree[7] = tint_symbol_18;
+          x_458_phi = true;
+          break;
+        } else {
+          x_429 = tree[x_423_save].rightIndex;
+          x_410_phi = x_409;
+          x_413_phi = x_429;
+          {
+            x_410 = x_410_phi;
+            x_413 = x_413_phi;
+            x_409_phi = x_410;
+            x_412_phi = x_413;
+          }
+          continue;
+        }
+        return;
+      }
+      x_410_phi = x_456;
+      x_413_phi = x_412;
+      {
+        x_410 = x_410_phi;
+        x_413 = x_413_phi;
+        x_409_phi = x_410;
+        x_412_phi = x_413;
+      }
+    }
+    if (x_458_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_463 = false;
   bool x_510 = false;
   bool x_463_phi = false;
   int x_466_phi = 0;
   bool x_512_phi = false;
-  switch(0u) {
-    default: {
-      x_463_phi = false;
-      x_466_phi = 0;
-      while (true) {
-        int x_491 = 0;
-        int x_483 = 0;
-        bool x_464 = false;
-        int x_467 = 0;
-        bool x_464_phi = false;
-        int x_467_phi = 0;
-        x_463 = x_463_phi;
-        const int x_466 = x_466_phi;
-        x_512_phi = x_463;
-        if ((x_466 <= 8)) {
-        } else {
-          break;
-        }
-        const int x_472 = tree[x_466].data;
-        if ((17 <= x_472)) {
-          bool x_510_phi = false;
-          const int x_485_save = x_466;
-          const int x_486 = tree[x_485_save].leftIndex;
-          if ((x_486 == -1)) {
-            const float x_493 = asfloat(x_8[0].y);
-            const float x_495 = asfloat(x_8[0].x);
-            if ((x_493 < x_495)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_485_save].leftIndex = 8;
-            const BST tint_symbol_20 = {17, -1, -1};
-            tree[8] = tint_symbol_20;
-            while (true) {
-              x_510_phi = x_463;
-              if ((0 < int(x_493))) {
-              } else {
-                break;
-              }
-              x_510_phi = true;
-              break;
-            }
-            x_510 = x_510_phi;
-            x_512_phi = x_510;
-            if (x_510) {
-              break;
-            }
-          } else {
-            x_491 = tree[x_485_save].leftIndex;
-            x_464_phi = x_463;
-            x_467_phi = x_491;
-            {
-              x_464 = x_464_phi;
-              x_467 = x_467_phi;
-              x_463_phi = x_464;
-              x_466_phi = x_467;
-            }
-            continue;
-          }
-        } else {
-          const int x_477_save = x_466;
-          const int x_478 = tree[x_477_save].rightIndex;
-          if ((x_478 == -1)) {
-            tree[x_477_save].rightIndex = 8;
-            const BST tint_symbol_21 = {17, -1, -1};
-            tree[8] = tint_symbol_21;
-            x_512_phi = true;
-            break;
-          } else {
-            x_483 = tree[x_477_save].rightIndex;
-            x_464_phi = x_463;
-            x_467_phi = x_483;
-            {
-              x_464 = x_464_phi;
-              x_467 = x_467_phi;
-              x_463_phi = x_464;
-              x_466_phi = x_467;
-            }
-            continue;
-          }
-          return;
-        }
-        x_464_phi = x_510;
-        x_467_phi = x_466;
-        {
-          x_464 = x_464_phi;
-          x_467 = x_467_phi;
-          x_463_phi = x_464;
-          x_466_phi = x_467;
-        }
-      }
-      if (x_512_phi) {
+  0u;
+  do {
+    x_463_phi = false;
+    x_466_phi = 0;
+    [loop] while (true) {
+      int x_491 = 0;
+      int x_483 = 0;
+      bool x_464 = false;
+      int x_467 = 0;
+      bool x_464_phi = false;
+      int x_467_phi = 0;
+      x_463 = x_463_phi;
+      const int x_466 = x_466_phi;
+      x_512_phi = x_463;
+      if ((x_466 <= 8)) {
+      } else {
         break;
       }
+      const int x_472 = tree[x_466].data;
+      if ((17 <= x_472)) {
+        bool x_510_phi = false;
+        const int x_485_save = x_466;
+        const int x_486 = tree[x_485_save].leftIndex;
+        if ((x_486 == -1)) {
+          const float x_493 = asfloat(x_8[0].y);
+          const float x_495 = asfloat(x_8[0].x);
+          if ((x_493 < x_495)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_485_save].leftIndex = 8;
+          const BST tint_symbol_19 = {17, -1, -1};
+          tree[8] = tint_symbol_19;
+          [loop] while (true) {
+            x_510_phi = x_463;
+            if ((0 < int(x_493))) {
+            } else {
+              break;
+            }
+            x_510_phi = true;
+            break;
+          }
+          x_510 = x_510_phi;
+          x_512_phi = x_510;
+          if (x_510) {
+            break;
+          }
+        } else {
+          x_491 = tree[x_485_save].leftIndex;
+          x_464_phi = x_463;
+          x_467_phi = x_491;
+          {
+            x_464 = x_464_phi;
+            x_467 = x_467_phi;
+            x_463_phi = x_464;
+            x_466_phi = x_467;
+          }
+          continue;
+        }
+      } else {
+        const int x_477_save = x_466;
+        const int x_478 = tree[x_477_save].rightIndex;
+        if ((x_478 == -1)) {
+          tree[x_477_save].rightIndex = 8;
+          const BST tint_symbol_20 = {17, -1, -1};
+          tree[8] = tint_symbol_20;
+          x_512_phi = true;
+          break;
+        } else {
+          x_483 = tree[x_477_save].rightIndex;
+          x_464_phi = x_463;
+          x_467_phi = x_483;
+          {
+            x_464 = x_464_phi;
+            x_467 = x_467_phi;
+            x_463_phi = x_464;
+            x_466_phi = x_467;
+          }
+          continue;
+        }
+        return;
+      }
+      x_464_phi = x_510;
+      x_467_phi = x_466;
+      {
+        x_464 = x_464_phi;
+        x_467 = x_467_phi;
+        x_463_phi = x_464;
+        x_466_phi = x_467;
+      }
+    }
+    if (x_512_phi) {
       break;
     }
-  }
+  } while (false);
   bool x_517 = false;
   bool x_564 = false;
   bool x_517_phi = false;
   int x_520_phi = 0;
   bool x_566_phi = false;
-  switch(0u) {
-    default: {
-      x_517_phi = false;
-      x_520_phi = 0;
-      while (true) {
-        int x_545 = 0;
-        int x_537 = 0;
-        bool x_518 = false;
-        int x_521 = 0;
-        bool x_518_phi = false;
-        int x_521_phi = 0;
-        x_517 = x_517_phi;
-        const int x_520 = x_520_phi;
-        x_566_phi = x_517;
-        if ((x_520 <= 9)) {
-        } else {
-          break;
-        }
-        const int x_526 = tree[x_520].data;
-        if ((13 <= x_526)) {
-          bool x_564_phi = false;
-          const int x_539_save = x_520;
-          const int x_540 = tree[x_539_save].leftIndex;
-          if ((x_540 == -1)) {
-            const float x_547 = asfloat(x_8[0].y);
-            const float x_549 = asfloat(x_8[0].x);
-            if ((x_547 < x_549)) {
-              while (true) {
-                discard;
-              }
-              return;
-            }
-            tree[x_539_save].leftIndex = 9;
-            const BST tint_symbol_22 = {13, -1, -1};
-            tree[9] = tint_symbol_22;
-            while (true) {
-              x_564_phi = x_517;
-              if ((0 < int(x_547))) {
-              } else {
-                break;
-              }
-              x_564_phi = true;
-              break;
-            }
-            x_564 = x_564_phi;
-            x_566_phi = x_564;
-            if (x_564) {
-              break;
-            }
-          } else {
-            x_545 = tree[x_539_save].leftIndex;
-            x_518_phi = x_517;
-            x_521_phi = x_545;
-            {
-              x_518 = x_518_phi;
-              x_521 = x_521_phi;
-              x_517_phi = x_518;
-              x_520_phi = x_521;
-            }
-            continue;
-          }
-        } else {
-          const int x_531_save = x_520;
-          const int x_532 = tree[x_531_save].rightIndex;
-          if ((x_532 == -1)) {
-            tree[x_531_save].rightIndex = 9;
-            const BST tint_symbol_23 = {13, -1, -1};
-            tree[9] = tint_symbol_23;
-            x_566_phi = true;
-            break;
-          } else {
-            x_537 = tree[x_531_save].rightIndex;
-            x_518_phi = x_517;
-            x_521_phi = x_537;
-            {
-              x_518 = x_518_phi;
-              x_521 = x_521_phi;
-              x_517_phi = x_518;
-              x_520_phi = x_521;
-            }
-            continue;
-          }
-          return;
-        }
-        x_518_phi = x_564;
-        x_521_phi = x_520;
-        {
-          x_518 = x_518_phi;
-          x_521 = x_521_phi;
-          x_517_phi = x_518;
-          x_520_phi = x_521;
-        }
-      }
-      if (x_566_phi) {
+  0u;
+  do {
+    x_517_phi = false;
+    x_520_phi = 0;
+    [loop] while (true) {
+      int x_545 = 0;
+      int x_537 = 0;
+      bool x_518 = false;
+      int x_521 = 0;
+      bool x_518_phi = false;
+      int x_521_phi = 0;
+      x_517 = x_517_phi;
+      const int x_520 = x_520_phi;
+      x_566_phi = x_517;
+      if ((x_520 <= 9)) {
+      } else {
         break;
       }
+      const int x_526 = tree[x_520].data;
+      if ((13 <= x_526)) {
+        bool x_564_phi = false;
+        const int x_539_save = x_520;
+        const int x_540 = tree[x_539_save].leftIndex;
+        if ((x_540 == -1)) {
+          const float x_547 = asfloat(x_8[0].y);
+          const float x_549 = asfloat(x_8[0].x);
+          if ((x_547 < x_549)) {
+            [loop] while (true) {
+              discard;
+            }
+            return;
+          }
+          tree[x_539_save].leftIndex = 9;
+          const BST tint_symbol_21 = {13, -1, -1};
+          tree[9] = tint_symbol_21;
+          [loop] while (true) {
+            x_564_phi = x_517;
+            if ((0 < int(x_547))) {
+            } else {
+              break;
+            }
+            x_564_phi = true;
+            break;
+          }
+          x_564 = x_564_phi;
+          x_566_phi = x_564;
+          if (x_564) {
+            break;
+          }
+        } else {
+          x_545 = tree[x_539_save].leftIndex;
+          x_518_phi = x_517;
+          x_521_phi = x_545;
+          {
+            x_518 = x_518_phi;
+            x_521 = x_521_phi;
+            x_517_phi = x_518;
+            x_520_phi = x_521;
+          }
+          continue;
+        }
+      } else {
+        const int x_531_save = x_520;
+        const int x_532 = tree[x_531_save].rightIndex;
+        if ((x_532 == -1)) {
+          tree[x_531_save].rightIndex = 9;
+          const BST tint_symbol_22 = {13, -1, -1};
+          tree[9] = tint_symbol_22;
+          x_566_phi = true;
+          break;
+        } else {
+          x_537 = tree[x_531_save].rightIndex;
+          x_518_phi = x_517;
+          x_521_phi = x_537;
+          {
+            x_518 = x_518_phi;
+            x_521 = x_521_phi;
+            x_517_phi = x_518;
+            x_520_phi = x_521;
+          }
+          continue;
+        }
+        return;
+      }
+      x_518_phi = x_564;
+      x_521_phi = x_520;
+      {
+        x_518 = x_518_phi;
+        x_521 = x_521_phi;
+        x_517_phi = x_518;
+        x_520_phi = x_521;
+      }
+    }
+    if (x_566_phi) {
       break;
     }
-  }
+  } while (false);
   x_569_phi = 0;
   x_572_phi = 0;
   x_574_phi = 0;
-  while (true) {
+  [loop] while (true) {
     int x_597 = 0;
     int x_607 = 0;
     int x_612 = 0;
@@ -1000,40 +1054,38 @@
     int x_582_phi = 0;
     int x_597_phi = 0;
     bool x_598_phi = false;
-    switch(0u) {
-      default: {
-        x_582_phi = 0;
-        while (true) {
-          const int x_582 = x_582_phi;
-          x_597_phi = x_569;
-          x_598_phi = false;
-          if ((x_582 != -1)) {
-          } else {
-            break;
-          }
-          const BST x_589 = tree[x_582];
-          const int x_590 = x_589.data;
-          const int x_591 = x_589.leftIndex;
-          const int x_592 = x_589.rightIndex;
-          if ((x_590 == x_574)) {
-            x_597_phi = x_574;
-            x_598_phi = true;
-            break;
-          }
-          {
-            x_582_phi = ((x_574 > x_590) ? x_592 : x_591);
-          }
-        }
-        x_597 = x_597_phi;
-        const bool x_598 = x_598_phi;
-        x_570_phi = x_597;
-        if (x_598) {
+    0u;
+    do {
+      x_582_phi = 0;
+      [loop] while (true) {
+        const int x_582 = x_582_phi;
+        x_597_phi = x_569;
+        x_598_phi = false;
+        if ((x_582 != -1)) {
+        } else {
           break;
         }
-        x_570_phi = -1;
+        const BST x_589 = tree[x_582];
+        const int x_590 = x_589.data;
+        const int x_591 = x_589.leftIndex;
+        const int x_592 = x_589.rightIndex;
+        if ((x_590 == x_574)) {
+          x_597_phi = x_574;
+          x_598_phi = true;
+          break;
+        }
+        {
+          x_582_phi = ((x_574 > x_590) ? x_592 : x_591);
+        }
+      }
+      x_597 = x_597_phi;
+      const bool x_598 = x_598_phi;
+      x_570_phi = x_597;
+      if (x_598) {
         break;
       }
-    }
+      x_570_phi = -1;
+    } while (false);
     int x_570 = 0;
     int x_606 = 0;
     int x_611 = 0;
@@ -1097,57 +1149,19 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol_2 main(tint_symbol_1 tint_symbol) {
-  const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
+main_out main_inner(float4 gl_FragCoord_param) {
   gl_FragCoord = gl_FragCoord_param;
   main_1();
-  const main_out tint_symbol_3 = {x_GLF_color};
-  const tint_symbol_2 tint_symbol_24 = {tint_symbol_3.x_GLF_color_1};
-  return tint_symbol_24;
+  const main_out tint_symbol_23 = {x_GLF_color};
+  return tint_symbol_23;
 }
-tint_wDgsnM:1053:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
-        if ((x_570 == asint(x_574))) {
-             ~~~~~~^~~~~~~~~~~~~~~
-tint_wDgsnM:1053:20: note: remove extraneous parentheses around the comparison to silence this warning
-        if ((x_570 == asint(x_574))) {
-            ~      ^              ~
-tint_wDgsnM:1053:20: note: use '=' to turn this equality comparison into an assignment
-        if ((x_570 == asint(x_574))) {
-                   ^~
-                   =
-tint_wDgsnM:1063:20: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
-        if ((x_570 == asint(-1))) {
-             ~~~~~~^~~~~~~~~~~~
-tint_wDgsnM:1063:20: note: remove extraneous parentheses around the comparison to silence this warning
-        if ((x_570 == asint(-1))) {
-            ~      ^           ~
-tint_wDgsnM:1063:20: note: use '=' to turn this equality comparison into an assignment
-        if ((x_570 == asint(-1))) {
-                   ^~
-                   =
-tint_wDgsnM:1080:14: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
-  if ((x_572 == asint(20))) {
-       ~~~~~~^~~~~~~~~~~~
-tint_wDgsnM:1080:14: note: remove extraneous parentheses around the comparison to silence this warning
-  if ((x_572 == asint(20))) {
-      ~      ^           ~
-tint_wDgsnM:1080:14: note: use '=' to turn this equality comparison into an assignment
-  if ((x_572 == asint(20))) {
-             ^~
-             =
-warning: DXIL.dll not found.  Resulting DXIL will not be signed for use in release environments.
 
-error: validation errors
-tint_wDgsnM:1098: error: Loop must have break.
-tint_wDgsnM:1098: error: Loop must have break.
-tint_wDgsnM:1098: error: Loop must have break.
-tint_wDgsnM:1098: error: Loop must have break.
-tint_wDgsnM:1098: error: Loop must have break.
-tint_wDgsnM:1098: error: Loop must have break.
-tint_wDgsnM:1098: error: Loop must have break.
-tint_wDgsnM:1098: error: Loop must have break.
-tint_wDgsnM:1098: error: Loop must have break.
-Validation failed.
-
-
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000023795628100(123,5-17): warning X3557: loop only executes for 1 iteration(s), forcing loop to unroll
+C:\src\tint\test\Shader@0x0000023795628100(54,27-30): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5f76001
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.hlsl
@@ -0,0 +1,246 @@
+SKIP: FAILED
+
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static BST tree_1[10] = (BST[10])0;
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) {
+  const int x_158 = data;
+  tree.data = x_158;
+  tree.leftIndex = -1;
+  tree.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_167 = baseIndex;
+    const int x_168 = treeIndex;
+    if ((x_167 <= x_168)) {
+    } else {
+      break;
+    }
+    const int x_171 = data_1;
+    const int x_174 = tree_1[baseIndex].data;
+    if ((x_171 <= x_174)) {
+      const int x_181 = tree_1[baseIndex].leftIndex;
+      if ((x_181 == -1)) {
+        const int x_186 = baseIndex;
+        const int x_187 = treeIndex;
+        tree_1[x_186].leftIndex = x_187;
+        const int x_189 = treeIndex;
+        const BST x_191 = tree_1[x_189];
+        param = x_191;
+        const int x_192 = data_1;
+        param_1 = x_192;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree_1[x_189] = param;
+        return;
+      } else {
+        const int x_198 = tree_1[baseIndex].leftIndex;
+        baseIndex = x_198;
+        continue;
+      }
+      return;
+    } else {
+      const int x_201 = tree_1[baseIndex].rightIndex;
+      if ((x_201 == -1)) {
+        const int x_206 = baseIndex;
+        const int x_207 = treeIndex;
+        tree_1[x_206].rightIndex = x_207;
+        const int x_209 = treeIndex;
+        const BST x_211 = tree_1[x_209];
+        param_2 = x_211;
+        const int x_212 = data_1;
+        param_3 = x_212;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree_1[x_209] = param_2;
+        return;
+      } else {
+        const int x_218 = tree_1[baseIndex].rightIndex;
+        baseIndex = x_218;
+        continue;
+      }
+      return;
+    }
+    return;
+  }
+  return;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_220 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_230 = tree_1[index];
+    currentNode = x_230;
+    const int x_232 = currentNode.data;
+    const int x_233 = target;
+    if ((x_232 == x_233)) {
+      const int x_237 = target;
+      return x_237;
+    }
+    const int x_238 = target;
+    const int x_240 = currentNode.data;
+    if ((x_238 > x_240)) {
+      const int x_246 = currentNode.rightIndex;
+      x_220 = x_246;
+    } else {
+      const int x_248 = currentNode.leftIndex;
+      x_220 = x_248;
+    }
+    index = x_220;
+  }
+  return -1;
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_4 = (BST)0;
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  int param_8 = 0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int count = 0;
+  int i = 0;
+  int result = 0;
+  int param_24 = 0;
+  treeIndex_1 = 0;
+  const BST x_84 = tree_1[0];
+  param_4 = x_84;
+  param_5 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
+  tree_1[0] = param_4;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_6 = treeIndex_1;
+  param_7 = 5;
+  insert_i1_i1_(param_6, param_7);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_8 = treeIndex_1;
+  param_9 = 12;
+  insert_i1_i1_(param_8, param_9);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 15;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_12 = treeIndex_1;
+  param_13 = 7;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 8;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 2;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 6;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 17;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 13;
+  insert_i1_i1_(param_22, param_23);
+  count = 0;
+  i = 0;
+  {
+    [loop] for(; (i < 20); i = (i + 1)) {
+      param_24 = i;
+      const int x_132 = search_i1_(param_24);
+      result = x_132;
+      switch(i) {
+        case 2:
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 15:
+        case 17: {
+          if ((result == i)) {
+            count = (count + 1);
+          }
+          break;
+        }
+        default: {
+          if ((result == -1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+      }
+    }
+  }
+  if ((count == 20)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002912962B080(25,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl
new file mode 100644
index 0000000..623d892
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.hlsl
@@ -0,0 +1,255 @@
+SKIP: FAILED
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl:58:7 warning: code is unreachable
+      return;
+      ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl:81:7 warning: code is unreachable
+      return;
+      ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl:83:5 warning: code is unreachable
+    return;
+    ^^^^^^
+
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static BST tree_1[10] = (BST[10])0;
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) {
+  const int x_158 = data;
+  tree.data = x_158;
+  tree.leftIndex = -1;
+  tree.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_167 = baseIndex;
+    const int x_168 = treeIndex;
+    if ((x_167 <= x_168)) {
+    } else {
+      break;
+    }
+    const int x_171 = data_1;
+    const int x_174 = tree_1[baseIndex].data;
+    if ((x_171 <= x_174)) {
+      const int x_181 = tree_1[baseIndex].leftIndex;
+      if ((x_181 == -1)) {
+        const int x_186 = baseIndex;
+        const int x_187 = treeIndex;
+        tree_1[x_186].leftIndex = x_187;
+        const int x_189 = treeIndex;
+        const BST x_191 = tree_1[x_189];
+        param = x_191;
+        const int x_192 = data_1;
+        param_1 = x_192;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree_1[x_189] = param;
+        return;
+      } else {
+        const int x_198 = tree_1[baseIndex].leftIndex;
+        baseIndex = x_198;
+        continue;
+      }
+      return;
+    } else {
+      const int x_201 = tree_1[baseIndex].rightIndex;
+      if ((x_201 == -1)) {
+        const int x_206 = baseIndex;
+        const int x_207 = treeIndex;
+        tree_1[x_206].rightIndex = x_207;
+        const int x_209 = treeIndex;
+        const BST x_211 = tree_1[x_209];
+        param_2 = x_211;
+        const int x_212 = data_1;
+        param_3 = x_212;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree_1[x_209] = param_2;
+        return;
+      } else {
+        const int x_218 = tree_1[baseIndex].rightIndex;
+        baseIndex = x_218;
+        continue;
+      }
+      return;
+    }
+    return;
+  }
+  return;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_220 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_230 = tree_1[index];
+    currentNode = x_230;
+    const int x_232 = currentNode.data;
+    const int x_233 = target;
+    if ((x_232 == x_233)) {
+      const int x_237 = target;
+      return x_237;
+    }
+    const int x_238 = target;
+    const int x_240 = currentNode.data;
+    if ((x_238 > x_240)) {
+      const int x_246 = currentNode.rightIndex;
+      x_220 = x_246;
+    } else {
+      const int x_248 = currentNode.leftIndex;
+      x_220 = x_248;
+    }
+    index = x_220;
+  }
+  return -1;
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_4 = (BST)0;
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  int param_8 = 0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int count = 0;
+  int i = 0;
+  int result = 0;
+  int param_24 = 0;
+  treeIndex_1 = 0;
+  const BST x_84 = tree_1[0];
+  param_4 = x_84;
+  param_5 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
+  tree_1[0] = param_4;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_6 = treeIndex_1;
+  param_7 = 5;
+  insert_i1_i1_(param_6, param_7);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_8 = treeIndex_1;
+  param_9 = 12;
+  insert_i1_i1_(param_8, param_9);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 15;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_12 = treeIndex_1;
+  param_13 = 7;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 8;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 2;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 6;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 17;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 13;
+  insert_i1_i1_(param_22, param_23);
+  count = 0;
+  i = 0;
+  {
+    [loop] for(; (i < 20); i = (i + 1)) {
+      param_24 = i;
+      const int x_132 = search_i1_(param_24);
+      result = x_132;
+      switch(i) {
+        case 2:
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 15:
+        case 17: {
+          if ((result == i)) {
+            count = (count + 1);
+          }
+          break;
+        }
+        default: {
+          if ((result == -1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+      }
+    }
+  }
+  if ((count == 20)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001CA0D820F20(25,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl
new file mode 100644
index 0000000..aba2d95
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.hlsl
@@ -0,0 +1,260 @@
+SKIP: FAILED
+
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static BST tree_1[10] = (BST[10])0;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) {
+  const int x_169 = data;
+  tree.data = x_169;
+  tree.leftIndex = -1;
+  tree.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_178 = baseIndex;
+    const int x_179 = treeIndex;
+    if ((x_178 <= x_179)) {
+    } else {
+      break;
+    }
+    const int x_182 = data_1;
+    const int x_185 = tree_1[baseIndex].data;
+    if ((x_182 <= x_185)) {
+      const int x_192 = tree_1[baseIndex].leftIndex;
+      if ((x_192 == -1)) {
+        const int x_197 = baseIndex;
+        const int x_198 = treeIndex;
+        tree_1[x_197].leftIndex = x_198;
+        const int x_200 = treeIndex;
+        const BST x_202 = tree_1[x_200];
+        param = x_202;
+        const int x_203 = data_1;
+        param_1 = x_203;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree_1[x_200] = param;
+        return;
+      } else {
+        const int x_209 = tree_1[baseIndex].leftIndex;
+        baseIndex = x_209;
+        continue;
+      }
+      return;
+    } else {
+      const int x_212 = tree_1[baseIndex].rightIndex;
+      if ((x_212 == -1)) {
+        const int x_217 = baseIndex;
+        const int x_218 = treeIndex;
+        tree_1[x_217].rightIndex = x_218;
+        const int x_220 = treeIndex;
+        const BST x_222 = tree_1[x_220];
+        param_2 = x_222;
+        const int x_223 = data_1;
+        param_3 = x_223;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree_1[x_220] = param_2;
+        return;
+      } else {
+        const int x_229 = tree_1[baseIndex].rightIndex;
+        baseIndex = x_229;
+        continue;
+      }
+      return;
+    }
+    return;
+  }
+  return;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_231 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_241 = tree_1[index];
+    currentNode = x_241;
+    const int x_243 = currentNode.data;
+    const int x_244 = target;
+    if ((x_243 == x_244)) {
+      const int x_248 = target;
+      return x_248;
+    }
+    const int x_249 = target;
+    const int x_251 = currentNode.data;
+    if ((x_249 > x_251)) {
+      const int x_257 = currentNode.rightIndex;
+      x_231 = x_257;
+    } else {
+      const int x_259 = currentNode.leftIndex;
+      x_231 = x_259;
+    }
+    index = x_231;
+  }
+  return -1;
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_4 = (BST)0;
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  int param_8 = 0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int count = 0;
+  int i = 0;
+  int result = 0;
+  int param_24 = 0;
+  treeIndex_1 = 0;
+  const BST x_88 = tree_1[0];
+  param_4 = x_88;
+  param_5 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
+  tree_1[0] = param_4;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_6 = treeIndex_1;
+  param_7 = 5;
+  insert_i1_i1_(param_6, param_7);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_8 = treeIndex_1;
+  param_9 = 12;
+  insert_i1_i1_(param_8, param_9);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 15;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_12 = treeIndex_1;
+  param_13 = 7;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 8;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 2;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 6;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 17;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 13;
+  insert_i1_i1_(param_22, param_23);
+  count = 0;
+  i = 0;
+  {
+    [loop] for(; (i < 20); i = (i + 1)) {
+      bool x_155 = false;
+      bool x_156_phi = false;
+      param_24 = i;
+      const int x_136 = search_i1_(param_24);
+      result = x_136;
+      switch(i) {
+        case 2:
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 15:
+        case 17: {
+          const bool x_149 = (result == i);
+          x_156_phi = x_149;
+          if (!(x_149)) {
+            const float x_154 = gl_FragCoord.x;
+            x_155 = (x_154 < 0.0f);
+            x_156_phi = x_155;
+          }
+          if (x_156_phi) {
+            count = (count + 1);
+          }
+          break;
+        }
+        default: {
+          if ((result == -1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+      }
+    }
+  }
+  if ((count == 20)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  return tint_symbol_3;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002A8C1306820(26,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl
new file mode 100644
index 0000000..51cea48
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.hlsl
@@ -0,0 +1,269 @@
+SKIP: FAILED
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl:60:7 warning: code is unreachable
+      return;
+      ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl:83:7 warning: code is unreachable
+      return;
+      ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl:85:5 warning: code is unreachable
+    return;
+    ^^^^^^
+
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static BST tree_1[10] = (BST[10])0;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) {
+  const int x_169 = data;
+  tree.data = x_169;
+  tree.leftIndex = -1;
+  tree.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_178 = baseIndex;
+    const int x_179 = treeIndex;
+    if ((x_178 <= x_179)) {
+    } else {
+      break;
+    }
+    const int x_182 = data_1;
+    const int x_185 = tree_1[baseIndex].data;
+    if ((x_182 <= x_185)) {
+      const int x_192 = tree_1[baseIndex].leftIndex;
+      if ((x_192 == -1)) {
+        const int x_197 = baseIndex;
+        const int x_198 = treeIndex;
+        tree_1[x_197].leftIndex = x_198;
+        const int x_200 = treeIndex;
+        const BST x_202 = tree_1[x_200];
+        param = x_202;
+        const int x_203 = data_1;
+        param_1 = x_203;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree_1[x_200] = param;
+        return;
+      } else {
+        const int x_209 = tree_1[baseIndex].leftIndex;
+        baseIndex = x_209;
+        continue;
+      }
+      return;
+    } else {
+      const int x_212 = tree_1[baseIndex].rightIndex;
+      if ((x_212 == -1)) {
+        const int x_217 = baseIndex;
+        const int x_218 = treeIndex;
+        tree_1[x_217].rightIndex = x_218;
+        const int x_220 = treeIndex;
+        const BST x_222 = tree_1[x_220];
+        param_2 = x_222;
+        const int x_223 = data_1;
+        param_3 = x_223;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree_1[x_220] = param_2;
+        return;
+      } else {
+        const int x_229 = tree_1[baseIndex].rightIndex;
+        baseIndex = x_229;
+        continue;
+      }
+      return;
+    }
+    return;
+  }
+  return;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_231 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_241 = tree_1[index];
+    currentNode = x_241;
+    const int x_243 = currentNode.data;
+    const int x_244 = target;
+    if ((x_243 == x_244)) {
+      const int x_248 = target;
+      return x_248;
+    }
+    const int x_249 = target;
+    const int x_251 = currentNode.data;
+    if ((x_249 > x_251)) {
+      const int x_257 = currentNode.rightIndex;
+      x_231 = x_257;
+    } else {
+      const int x_259 = currentNode.leftIndex;
+      x_231 = x_259;
+    }
+    index = x_231;
+  }
+  return -1;
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_4 = (BST)0;
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  int param_8 = 0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int count = 0;
+  int i = 0;
+  int result = 0;
+  int param_24 = 0;
+  treeIndex_1 = 0;
+  const BST x_88 = tree_1[0];
+  param_4 = x_88;
+  param_5 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
+  tree_1[0] = param_4;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_6 = treeIndex_1;
+  param_7 = 5;
+  insert_i1_i1_(param_6, param_7);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_8 = treeIndex_1;
+  param_9 = 12;
+  insert_i1_i1_(param_8, param_9);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 15;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_12 = treeIndex_1;
+  param_13 = 7;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 8;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 2;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 6;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 17;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 13;
+  insert_i1_i1_(param_22, param_23);
+  count = 0;
+  i = 0;
+  {
+    [loop] for(; (i < 20); i = (i + 1)) {
+      bool x_155 = false;
+      bool x_156_phi = false;
+      param_24 = i;
+      const int x_136 = search_i1_(param_24);
+      result = x_136;
+      switch(i) {
+        case 2:
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 15:
+        case 17: {
+          const bool x_149 = (result == i);
+          x_156_phi = x_149;
+          if (!(x_149)) {
+            const float x_154 = gl_FragCoord.x;
+            x_155 = (x_154 < 0.0f);
+            x_156_phi = x_155;
+          }
+          if (x_156_phi) {
+            count = (count + 1);
+          }
+          break;
+        }
+        default: {
+          if ((result == -1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+      }
+    }
+  }
+  if ((count == 20)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_3 = {x_GLF_color};
+  return tint_symbol_3;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001BE36107D80(26,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..62bd6c0
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,246 @@
+SKIP: FAILED
+
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static BST tree[10] = (BST[10])0;
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) {
+  const int x_158 = data;
+  node.data = x_158;
+  node.leftIndex = -1;
+  node.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_167 = baseIndex;
+    const int x_168 = treeIndex;
+    if ((x_167 <= x_168)) {
+    } else {
+      break;
+    }
+    const int x_171 = data_1;
+    const int x_174 = tree[baseIndex].data;
+    if ((x_171 <= x_174)) {
+      const int x_181 = tree[baseIndex].leftIndex;
+      if ((x_181 == -1)) {
+        const int x_186 = baseIndex;
+        const int x_187 = treeIndex;
+        tree[x_186].leftIndex = x_187;
+        const int x_189 = treeIndex;
+        const BST x_191 = tree[x_189];
+        param = x_191;
+        const int x_192 = data_1;
+        param_1 = x_192;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree[x_189] = param;
+        return;
+      } else {
+        const int x_198 = tree[baseIndex].leftIndex;
+        baseIndex = x_198;
+        continue;
+      }
+      return;
+    } else {
+      const int x_201 = tree[baseIndex].rightIndex;
+      if ((x_201 == -1)) {
+        const int x_206 = baseIndex;
+        const int x_207 = treeIndex;
+        tree[x_206].rightIndex = x_207;
+        const int x_209 = treeIndex;
+        const BST x_211 = tree[x_209];
+        param_2 = x_211;
+        const int x_212 = data_1;
+        param_3 = x_212;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree[x_209] = param_2;
+        return;
+      } else {
+        const int x_218 = tree[baseIndex].rightIndex;
+        baseIndex = x_218;
+        continue;
+      }
+      return;
+    }
+    return;
+  }
+  return;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_220 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_230 = tree[index];
+    currentNode = x_230;
+    const int x_232 = currentNode.data;
+    const int x_233 = target;
+    if ((x_232 == x_233)) {
+      const int x_237 = target;
+      return x_237;
+    }
+    const int x_238 = target;
+    const int x_240 = currentNode.data;
+    if ((x_238 > x_240)) {
+      const int x_246 = currentNode.rightIndex;
+      x_220 = x_246;
+    } else {
+      const int x_248 = currentNode.leftIndex;
+      x_220 = x_248;
+    }
+    index = x_220;
+  }
+  return -1;
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_4 = (BST)0;
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  int param_8 = 0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int count = 0;
+  int i = 0;
+  int result = 0;
+  int param_24 = 0;
+  treeIndex_1 = 0;
+  const BST x_84 = tree[0];
+  param_4 = x_84;
+  param_5 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
+  tree[0] = param_4;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_6 = treeIndex_1;
+  param_7 = 5;
+  insert_i1_i1_(param_6, param_7);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_8 = treeIndex_1;
+  param_9 = 12;
+  insert_i1_i1_(param_8, param_9);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 15;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_12 = treeIndex_1;
+  param_13 = 7;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 8;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 2;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 6;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 17;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 13;
+  insert_i1_i1_(param_22, param_23);
+  count = 0;
+  i = 0;
+  {
+    [loop] for(; (i < 20); i = (i + 1)) {
+      param_24 = i;
+      const int x_132 = search_i1_(param_24);
+      result = x_132;
+      switch(i) {
+        case 2:
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 15:
+        case 17: {
+          if ((result == i)) {
+            count = (count + 1);
+          }
+          break;
+        }
+        default: {
+          if ((result == -1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+      }
+    }
+  }
+  if ((count == 20)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000025CD445EF60(25,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..b4a278c
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,255 @@
+SKIP: FAILED
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl:58:7 warning: code is unreachable
+      return;
+      ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl:81:7 warning: code is unreachable
+      return;
+      ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl:83:5 warning: code is unreachable
+    return;
+    ^^^^^^
+
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+
+static BST tree[10] = (BST[10])0;
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) {
+  const int x_158 = data;
+  node.data = x_158;
+  node.leftIndex = -1;
+  node.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_167 = baseIndex;
+    const int x_168 = treeIndex;
+    if ((x_167 <= x_168)) {
+    } else {
+      break;
+    }
+    const int x_171 = data_1;
+    const int x_174 = tree[baseIndex].data;
+    if ((x_171 <= x_174)) {
+      const int x_181 = tree[baseIndex].leftIndex;
+      if ((x_181 == -1)) {
+        const int x_186 = baseIndex;
+        const int x_187 = treeIndex;
+        tree[x_186].leftIndex = x_187;
+        const int x_189 = treeIndex;
+        const BST x_191 = tree[x_189];
+        param = x_191;
+        const int x_192 = data_1;
+        param_1 = x_192;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree[x_189] = param;
+        return;
+      } else {
+        const int x_198 = tree[baseIndex].leftIndex;
+        baseIndex = x_198;
+        continue;
+      }
+      return;
+    } else {
+      const int x_201 = tree[baseIndex].rightIndex;
+      if ((x_201 == -1)) {
+        const int x_206 = baseIndex;
+        const int x_207 = treeIndex;
+        tree[x_206].rightIndex = x_207;
+        const int x_209 = treeIndex;
+        const BST x_211 = tree[x_209];
+        param_2 = x_211;
+        const int x_212 = data_1;
+        param_3 = x_212;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree[x_209] = param_2;
+        return;
+      } else {
+        const int x_218 = tree[baseIndex].rightIndex;
+        baseIndex = x_218;
+        continue;
+      }
+      return;
+    }
+    return;
+  }
+  return;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_220 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_230 = tree[index];
+    currentNode = x_230;
+    const int x_232 = currentNode.data;
+    const int x_233 = target;
+    if ((x_232 == x_233)) {
+      const int x_237 = target;
+      return x_237;
+    }
+    const int x_238 = target;
+    const int x_240 = currentNode.data;
+    if ((x_238 > x_240)) {
+      const int x_246 = currentNode.rightIndex;
+      x_220 = x_246;
+    } else {
+      const int x_248 = currentNode.leftIndex;
+      x_220 = x_248;
+    }
+    index = x_220;
+  }
+  return -1;
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_4 = (BST)0;
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  int param_8 = 0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int count = 0;
+  int i = 0;
+  int result = 0;
+  int param_24 = 0;
+  treeIndex_1 = 0;
+  const BST x_84 = tree[0];
+  param_4 = x_84;
+  param_5 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
+  tree[0] = param_4;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_6 = treeIndex_1;
+  param_7 = 5;
+  insert_i1_i1_(param_6, param_7);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_8 = treeIndex_1;
+  param_9 = 12;
+  insert_i1_i1_(param_8, param_9);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 15;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_12 = treeIndex_1;
+  param_13 = 7;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 8;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 2;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 6;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 17;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 13;
+  insert_i1_i1_(param_22, param_23);
+  count = 0;
+  i = 0;
+  {
+    [loop] for(; (i < 20); i = (i + 1)) {
+      param_24 = i;
+      const int x_132 = search_i1_(param_24);
+      result = x_132;
+      switch(i) {
+        case 2:
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 15:
+        case 17: {
+          if ((result == i)) {
+            count = (count + 1);
+          }
+          break;
+        }
+        default: {
+          if ((result == -1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+      }
+    }
+  }
+  if ((count == 20)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001737220A3A0(25,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+internal error: compilation aborted unexpectedly
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl
new file mode 100644
index 0000000..f2edc08
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.hlsl
@@ -0,0 +1,285 @@
+SKIP: FAILED
+
+warning: code is unreachable
+warning: code is unreachable
+warning: code is unreachable
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static BST tree[10] = (BST[10])0;
+cbuffer cbuffer_x_50 : register(b0, space0) {
+  uint4 x_50[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) {
+  const int x_208 = data;
+  node.data = x_208;
+  node.leftIndex = -1;
+  node.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_217 = baseIndex;
+    const int x_218 = treeIndex;
+    if ((x_217 <= x_218)) {
+    } else {
+      break;
+    }
+    const int x_221 = data_1;
+    const int x_224 = tree[baseIndex].data;
+    if ((x_221 <= x_224)) {
+      const int x_231 = tree[baseIndex].leftIndex;
+      if ((x_231 == -1)) {
+        const int x_236 = baseIndex;
+        const int x_237 = treeIndex;
+        tree[x_236].leftIndex = x_237;
+        const int x_239 = treeIndex;
+        const BST x_241 = tree[x_239];
+        param = x_241;
+        const int x_242 = data_1;
+        param_1 = x_242;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree[x_239] = param;
+        return;
+      } else {
+        const int x_248 = tree[baseIndex].leftIndex;
+        baseIndex = x_248;
+        continue;
+      }
+      return;
+    } else {
+      const int x_251 = tree[baseIndex].rightIndex;
+      if ((x_251 == -1)) {
+        const int x_256 = baseIndex;
+        const int x_257 = treeIndex;
+        tree[x_256].rightIndex = x_257;
+        const int x_259 = treeIndex;
+        const BST x_261 = tree[x_259];
+        param_2 = x_261;
+        const int x_262 = data_1;
+        param_3 = x_262;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree[x_259] = param_2;
+        return;
+      } else {
+        const int x_268 = tree[baseIndex].rightIndex;
+        baseIndex = x_268;
+        continue;
+      }
+      return;
+    }
+    return;
+  }
+  return;
+}
+
+int identity_i1_(inout int a) {
+  const int x_202 = a;
+  const int x_203 = a;
+  obj.numbers[x_202] = x_203;
+  const int x_206 = obj.numbers[2];
+  return x_206;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_270 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_280 = tree[index];
+    currentNode = x_280;
+    const int x_282 = currentNode.data;
+    const int x_283 = target;
+    if ((x_282 == x_283)) {
+      const int x_287 = target;
+      return x_287;
+    }
+    const int x_288 = target;
+    const int x_290 = currentNode.data;
+    if ((x_288 > x_290)) {
+      const int x_296 = currentNode.rightIndex;
+      x_270 = x_296;
+    } else {
+      const int x_298 = currentNode.leftIndex;
+      x_270 = x_298;
+    }
+    index = x_270;
+  }
+  return -1;
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_4 = (BST)0;
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  int param_8 = 0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int pp = 0;
+  int looplimiter0 = 0;
+  int i = 0;
+  int param_24 = 0;
+  int count = 0;
+  int i_1 = 0;
+  int result = 0;
+  int param_25 = 0;
+  treeIndex_1 = 0;
+  const BST x_101 = tree[0];
+  param_4 = x_101;
+  param_5 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
+  tree[0] = param_4;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_6 = treeIndex_1;
+  param_7 = 5;
+  insert_i1_i1_(param_6, param_7);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_8 = treeIndex_1;
+  param_9 = 12;
+  insert_i1_i1_(param_8, param_9);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 15;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_12 = treeIndex_1;
+  param_13 = 7;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 8;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 2;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 6;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 17;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 13;
+  insert_i1_i1_(param_22, param_23);
+  pp = 0;
+  looplimiter0 = 0;
+  i = 0;
+  {
+    [loop] for(; (i < 10000); i = (i + 1)) {
+      const int x_148 = looplimiter0;
+      const float x_150 = asfloat(x_50[0].y);
+      if ((x_148 >= int(x_150))) {
+        const float x_156 = asfloat(x_50[0].y);
+        param_24 = (1 + int(x_156));
+        const int x_159 = identity_i1_(param_24);
+        pp = x_159;
+        break;
+      }
+      looplimiter0 = (looplimiter0 + 1);
+    }
+  }
+  if ((pp != 2)) {
+    return;
+  }
+  count = 0;
+  i_1 = 0;
+  {
+    [loop] for(; (i_1 < 20); i_1 = (i_1 + 1)) {
+      param_25 = i_1;
+      const int x_176 = search_i1_(param_25);
+      result = x_176;
+      switch(i_1) {
+        case 2:
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 15:
+        case 17: {
+          if ((result == i_1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+        default: {
+          if ((result == -1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+      }
+    }
+  }
+  if ((count == 20)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000002117DDC0DA0(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x000002117DDC0DA0(203,12-42): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl
new file mode 100644
index 0000000..cb24484
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.hlsl
@@ -0,0 +1,294 @@
+SKIP: FAILED
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:71:7 warning: code is unreachable
+      return;
+      ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:94:7 warning: code is unreachable
+      return;
+      ^^^^^^
+
+vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl:96:5 warning: code is unreachable
+    return;
+    ^^^^^^
+
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static BST tree[10] = (BST[10])0;
+cbuffer cbuffer_x_50 : register(b0, space0) {
+  uint4 x_50[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST node, inout int data) {
+  const int x_208 = data;
+  node.data = x_208;
+  node.leftIndex = -1;
+  node.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_217 = baseIndex;
+    const int x_218 = treeIndex;
+    if ((x_217 <= x_218)) {
+    } else {
+      break;
+    }
+    const int x_221 = data_1;
+    const int x_224 = tree[baseIndex].data;
+    if ((x_221 <= x_224)) {
+      const int x_231 = tree[baseIndex].leftIndex;
+      if ((x_231 == -1)) {
+        const int x_236 = baseIndex;
+        const int x_237 = treeIndex;
+        tree[x_236].leftIndex = x_237;
+        const int x_239 = treeIndex;
+        const BST x_241 = tree[x_239];
+        param = x_241;
+        const int x_242 = data_1;
+        param_1 = x_242;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree[x_239] = param;
+        return;
+      } else {
+        const int x_248 = tree[baseIndex].leftIndex;
+        baseIndex = x_248;
+        continue;
+      }
+      return;
+    } else {
+      const int x_251 = tree[baseIndex].rightIndex;
+      if ((x_251 == -1)) {
+        const int x_256 = baseIndex;
+        const int x_257 = treeIndex;
+        tree[x_256].rightIndex = x_257;
+        const int x_259 = treeIndex;
+        const BST x_261 = tree[x_259];
+        param_2 = x_261;
+        const int x_262 = data_1;
+        param_3 = x_262;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree[x_259] = param_2;
+        return;
+      } else {
+        const int x_268 = tree[baseIndex].rightIndex;
+        baseIndex = x_268;
+        continue;
+      }
+      return;
+    }
+    return;
+  }
+  return;
+}
+
+int identity_i1_(inout int a) {
+  const int x_202 = a;
+  const int x_203 = a;
+  obj.numbers[x_202] = x_203;
+  const int x_206 = obj.numbers[2];
+  return x_206;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_270 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_280 = tree[index];
+    currentNode = x_280;
+    const int x_282 = currentNode.data;
+    const int x_283 = target;
+    if ((x_282 == x_283)) {
+      const int x_287 = target;
+      return x_287;
+    }
+    const int x_288 = target;
+    const int x_290 = currentNode.data;
+    if ((x_288 > x_290)) {
+      const int x_296 = currentNode.rightIndex;
+      x_270 = x_296;
+    } else {
+      const int x_298 = currentNode.leftIndex;
+      x_270 = x_298;
+    }
+    index = x_270;
+  }
+  return -1;
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_4 = (BST)0;
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  int param_8 = 0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int pp = 0;
+  int looplimiter0 = 0;
+  int i = 0;
+  int param_24 = 0;
+  int count = 0;
+  int i_1 = 0;
+  int result = 0;
+  int param_25 = 0;
+  treeIndex_1 = 0;
+  const BST x_101 = tree[0];
+  param_4 = x_101;
+  param_5 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_4, param_5);
+  tree[0] = param_4;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_6 = treeIndex_1;
+  param_7 = 5;
+  insert_i1_i1_(param_6, param_7);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_8 = treeIndex_1;
+  param_9 = 12;
+  insert_i1_i1_(param_8, param_9);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 15;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_12 = treeIndex_1;
+  param_13 = 7;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 8;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 2;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 6;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 17;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 13;
+  insert_i1_i1_(param_22, param_23);
+  pp = 0;
+  looplimiter0 = 0;
+  i = 0;
+  {
+    [loop] for(; (i < 10000); i = (i + 1)) {
+      const int x_148 = looplimiter0;
+      const float x_150 = asfloat(x_50[0].y);
+      if ((x_148 >= int(x_150))) {
+        const float x_156 = asfloat(x_50[0].y);
+        param_24 = (1 + int(x_156));
+        const int x_159 = identity_i1_(param_24);
+        pp = x_159;
+        break;
+      }
+      looplimiter0 = (looplimiter0 + 1);
+    }
+  }
+  if ((pp != 2)) {
+    return;
+  }
+  count = 0;
+  i_1 = 0;
+  {
+    [loop] for(; (i_1 < 20); i_1 = (i_1 + 1)) {
+      param_25 = i_1;
+      const int x_176 = search_i1_(param_25);
+      result = x_176;
+      switch(i_1) {
+        case 2:
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 15:
+        case 17: {
+          if ((result == i_1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+        default: {
+          if ((result == -1)) {
+            count = (count + 1);
+          }
+          break;
+        }
+      }
+    }
+  }
+  if ((count == 20)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 1.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000219E1FE81C0(32,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x00000219E1FE81C0(203,12-42): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.hlsl
new file mode 100644
index 0000000..49e137d
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.spvasm.expected.hlsl
@@ -0,0 +1,242 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b0, space0) {
+  uint4 x_34[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_230 = i;
+  const int x_232 = obj.numbers[x_230];
+  temp = x_232;
+  const int x_233 = i;
+  const int x_234 = j;
+  const int x_236 = obj.numbers[x_234];
+  obj.numbers[x_233] = x_236;
+  const int x_238 = j;
+  obj.numbers[x_238] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_242 = h;
+  const int x_244 = obj.numbers[x_242];
+  pivot = x_244;
+  const int x_245 = l;
+  i_1 = (x_245 - 1);
+  const int x_247 = l;
+  j_1 = x_247;
+  [loop] while (true) {
+    const int x_252 = j_1;
+    const int x_253 = h;
+    if ((x_252 <= (x_253 - 1))) {
+    } else {
+      break;
+    }
+    const int x_259 = obj.numbers[j_1];
+    if ((x_259 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  i_1 = (i_1 + 1);
+  param_2 = i_1;
+  const int x_274 = h;
+  param_3 = x_274;
+  swap_i1_i1_(param_2, param_3);
+  return i_1;
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int int_a = 0;
+  int x_278 = 0;
+  int x_279 = 0;
+  int clamp_a = 0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_281 = (top + 1);
+  top = x_281;
+  stack[x_281] = l_1;
+  const float x_285 = gl_FragCoord.y;
+  if ((x_285 >= 0.0f)) {
+    const int x_290 = h_1;
+    if (false) {
+      x_279 = 1;
+    } else {
+      x_279 = (h_1 << asuint(0));
+    }
+    x_278 = (x_290 | x_279);
+  } else {
+    x_278 = 1;
+  }
+  int_a = x_278;
+  clamp_a = clamp(h_1, h_1, int_a);
+  const int x_304 = (top + 1);
+  top = x_304;
+  stack[x_304] = (clamp_a / 1);
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_315 = top;
+    top = (x_315 - 1);
+    const int x_318 = stack[x_315];
+    h_1 = x_318;
+    const int x_319 = top;
+    top = (x_319 - 1);
+    const int x_322 = stack[x_319];
+    l_1 = x_322;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_325 = performPartition_i1_i1_(param_4, param_5);
+    p = x_325;
+    if (((p - 1) > l_1)) {
+      const int x_333 = (top + 1);
+      top = x_333;
+      stack[x_333] = l_1;
+      const int x_337 = (top + 1);
+      top = x_337;
+      stack[x_337] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_348 = (top + 1);
+      top = x_348;
+      stack[x_348] = (p + 1);
+      const int x_353 = (top + 1);
+      top = x_353;
+      stack[x_353] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_97 = i_2;
+      const int x_100 = obj.numbers[i_2];
+      const int x_103 = obj.numbers[i_2];
+      obj.numbers[x_97] = (x_100 * x_103);
+    }
+  }
+  quicksort_();
+  const float4 x_109 = gl_FragCoord;
+  const float2 x_112 = asfloat(x_34[0].xy);
+  uv = (float2(x_109.x, x_109.y) / x_112);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_115 = obj.numbers[0];
+  const float x_118 = color.x;
+  color.x = (x_118 + float(x_115));
+  const float x_122 = uv.x;
+  if ((x_122 > 0.25f)) {
+    const int x_127 = obj.numbers[1];
+    const float x_130 = color.x;
+    color.x = (x_130 + float(x_127));
+  }
+  const float x_134 = uv.x;
+  if ((x_134 > 0.5f)) {
+    const int x_139 = obj.numbers[2];
+    const float x_142 = color.y;
+    color.y = (x_142 + float(x_139));
+  }
+  const float x_146 = uv.x;
+  if ((x_146 > 0.75f)) {
+    const int x_151 = obj.numbers[3];
+    const float x_154 = color.z;
+    color.z = (x_154 + float(x_151));
+  }
+  const int x_158 = obj.numbers[4];
+  const float x_161 = color.y;
+  color.y = (x_161 + float(x_158));
+  const float x_165 = uv.y;
+  if ((x_165 > 0.25f)) {
+    const int x_170 = obj.numbers[5];
+    const float x_173 = color.x;
+    color.x = (x_173 + float(x_170));
+  }
+  const float x_177 = uv.y;
+  if ((x_177 > 0.5f)) {
+    const int x_182 = obj.numbers[6];
+    const float x_185 = color.y;
+    color.y = (x_185 + float(x_182));
+  }
+  const float x_189 = uv.y;
+  if ((x_189 > 0.75f)) {
+    const int x_194 = obj.numbers[7];
+    const float x_197 = color.z;
+    color.z = (x_197 + float(x_194));
+  }
+  const int x_201 = obj.numbers[8];
+  const float x_204 = color.z;
+  color.z = (x_204 + float(x_201));
+  const float x_208 = uv.x;
+  const float x_210 = uv.y;
+  if ((abs((x_208 - x_210)) < 0.25f)) {
+    const int x_217 = obj.numbers[9];
+    const float x_220 = color.x;
+    color.x = (x_220 + float(x_217));
+  }
+  const float3 x_224 = normalize(color);
+  x_GLF_color = float4(x_224.x, x_224.y, x_224.z, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000240D57880E0(146,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x00000240D57880E0(145,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.hlsl
new file mode 100644
index 0000000..013dea4
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-conditional-bitwise-or-clamp/1.wgsl.expected.hlsl
@@ -0,0 +1,242 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b0, space0) {
+  uint4 x_34[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_230 = i;
+  const int x_232 = obj.numbers[x_230];
+  temp = x_232;
+  const int x_233 = i;
+  const int x_234 = j;
+  const int x_236 = obj.numbers[x_234];
+  obj.numbers[x_233] = x_236;
+  const int x_238 = j;
+  obj.numbers[x_238] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_242 = h;
+  const int x_244 = obj.numbers[x_242];
+  pivot = x_244;
+  const int x_245 = l;
+  i_1 = (x_245 - 1);
+  const int x_247 = l;
+  j_1 = x_247;
+  [loop] while (true) {
+    const int x_252 = j_1;
+    const int x_253 = h;
+    if ((x_252 <= (x_253 - 1))) {
+    } else {
+      break;
+    }
+    const int x_259 = obj.numbers[j_1];
+    if ((x_259 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  i_1 = (i_1 + 1);
+  param_2 = i_1;
+  const int x_274 = h;
+  param_3 = x_274;
+  swap_i1_i1_(param_2, param_3);
+  return i_1;
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int int_a = 0;
+  int x_278 = 0;
+  int x_279 = 0;
+  int clamp_a = 0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_281 = (top + 1);
+  top = x_281;
+  stack[x_281] = l_1;
+  const float x_285 = gl_FragCoord.y;
+  if ((x_285 >= 0.0f)) {
+    const int x_290 = h_1;
+    if (false) {
+      x_279 = 1;
+    } else {
+      x_279 = (h_1 << asuint(0));
+    }
+    x_278 = (x_290 | x_279);
+  } else {
+    x_278 = 1;
+  }
+  int_a = x_278;
+  clamp_a = clamp(h_1, h_1, int_a);
+  const int x_304 = (top + 1);
+  top = x_304;
+  stack[x_304] = (clamp_a / 1);
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_315 = top;
+    top = (x_315 - 1);
+    const int x_318 = stack[x_315];
+    h_1 = x_318;
+    const int x_319 = top;
+    top = (x_319 - 1);
+    const int x_322 = stack[x_319];
+    l_1 = x_322;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_325 = performPartition_i1_i1_(param_4, param_5);
+    p = x_325;
+    if (((p - 1) > l_1)) {
+      const int x_333 = (top + 1);
+      top = x_333;
+      stack[x_333] = l_1;
+      const int x_337 = (top + 1);
+      top = x_337;
+      stack[x_337] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_348 = (top + 1);
+      top = x_348;
+      stack[x_348] = (p + 1);
+      const int x_353 = (top + 1);
+      top = x_353;
+      stack[x_353] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_97 = i_2;
+      const int x_100 = obj.numbers[i_2];
+      const int x_103 = obj.numbers[i_2];
+      obj.numbers[x_97] = (x_100 * x_103);
+    }
+  }
+  quicksort_();
+  const float4 x_109 = gl_FragCoord;
+  const float2 x_112 = asfloat(x_34[0].xy);
+  uv = (float2(x_109.x, x_109.y) / x_112);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_115 = obj.numbers[0];
+  const float x_118 = color.x;
+  color.x = (x_118 + float(x_115));
+  const float x_122 = uv.x;
+  if ((x_122 > 0.25f)) {
+    const int x_127 = obj.numbers[1];
+    const float x_130 = color.x;
+    color.x = (x_130 + float(x_127));
+  }
+  const float x_134 = uv.x;
+  if ((x_134 > 0.5f)) {
+    const int x_139 = obj.numbers[2];
+    const float x_142 = color.y;
+    color.y = (x_142 + float(x_139));
+  }
+  const float x_146 = uv.x;
+  if ((x_146 > 0.75f)) {
+    const int x_151 = obj.numbers[3];
+    const float x_154 = color.z;
+    color.z = (x_154 + float(x_151));
+  }
+  const int x_158 = obj.numbers[4];
+  const float x_161 = color.y;
+  color.y = (x_161 + float(x_158));
+  const float x_165 = uv.y;
+  if ((x_165 > 0.25f)) {
+    const int x_170 = obj.numbers[5];
+    const float x_173 = color.x;
+    color.x = (x_173 + float(x_170));
+  }
+  const float x_177 = uv.y;
+  if ((x_177 > 0.5f)) {
+    const int x_182 = obj.numbers[6];
+    const float x_185 = color.y;
+    color.y = (x_185 + float(x_182));
+  }
+  const float x_189 = uv.y;
+  if ((x_189 > 0.75f)) {
+    const int x_194 = obj.numbers[7];
+    const float x_197 = color.z;
+    color.z = (x_197 + float(x_194));
+  }
+  const int x_201 = obj.numbers[8];
+  const float x_204 = color.z;
+  color.z = (x_204 + float(x_201));
+  const float x_208 = uv.x;
+  const float x_210 = uv.y;
+  if ((abs((x_208 - x_210)) < 0.25f)) {
+    const int x_217 = obj.numbers[9];
+    const float x_220 = color.x;
+    color.x = (x_220 + float(x_217));
+  }
+  const float3 x_224 = normalize(color);
+  x_GLF_color = float4(x_224.x, x_224.y, x_224.z, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001EE8601E080(146,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001EE8601E080(145,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..68cfc73
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,230 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b0, space0) {
+  uint4 x_34[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_239 = i;
+  const int x_241 = obj.numbers[x_239];
+  temp = x_241;
+  const int x_242 = i;
+  const int x_243 = j;
+  const int x_245 = obj.numbers[x_243];
+  obj.numbers[x_242] = x_245;
+  const int x_247 = j;
+  obj.numbers[x_247] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_251 = h;
+  const int x_253 = obj.numbers[x_251];
+  pivot = x_253;
+  const int x_254 = l;
+  i_1 = (x_254 - 1);
+  const int x_256 = l;
+  j_1 = x_256;
+  [loop] while (true) {
+    const int x_261 = j_1;
+    const int x_262 = h;
+    if ((x_261 <= (x_262 - 1))) {
+    } else {
+      break;
+    }
+    const int x_268 = obj.numbers[j_1];
+    if ((x_268 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_282 = h;
+  param_3 = x_282;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_288 = (top + 1);
+  top = x_288;
+  stack[x_288] = l_1;
+  const int x_292 = (top + 1);
+  top = x_292;
+  stack[x_292] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_302 = top;
+    top = (x_302 - 1);
+    const int x_305 = stack[x_302];
+    h_1 = x_305;
+    const int x_306 = top;
+    top = (x_306 - 1);
+    const int x_309 = stack[x_306];
+    l_1 = x_309;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_312 = performPartition_i1_i1_(param_4, param_5);
+    p = x_312;
+    if (((p - 1) > l_1)) {
+      const int x_320 = (top + 1);
+      top = x_320;
+      stack[x_320] = l_1;
+      const int x_324 = (top + 1);
+      top = x_324;
+      stack[x_324] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_335 = (top + 1);
+      top = x_335;
+      stack[x_335] = (p + 1);
+      const int x_340 = (top + 1);
+      top = x_340;
+      stack[x_340] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_104 = i_2;
+      const int x_107 = obj.numbers[i_2];
+      const int x_110 = obj.numbers[i_2];
+      obj.numbers[x_104] = (x_107 * x_110);
+    }
+  }
+  quicksort_();
+  const float4 x_116 = x_GLF_FragCoord;
+  const float2 x_119 = asfloat(x_34[0].xy);
+  uv = (float2(x_116.x, x_116.y) / x_119);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_122 = obj.numbers[0];
+  const float x_125 = color.x;
+  color.x = (x_125 + float(x_122));
+  const float x_129 = uv.x;
+  if ((x_129 > 0.25f)) {
+    const int x_134 = obj.numbers[1];
+    const float x_137 = color.x;
+    color.x = (x_137 + float(x_134));
+  }
+  const float x_141 = uv.x;
+  if ((x_141 > 0.5f)) {
+    const int x_146 = obj.numbers[2];
+    const float x_149 = color.y;
+    color.y = (x_149 + float(x_146));
+  }
+  const float x_153 = uv.x;
+  if ((x_153 > 0.75f)) {
+    const int x_158 = obj.numbers[3];
+    const float x_161 = color.z;
+    color.z = (x_161 + float(x_158));
+  }
+  const int x_165 = obj.numbers[4];
+  const float x_168 = color.y;
+  color.y = (x_168 + float(x_165));
+  const float x_172 = uv.y;
+  if ((x_172 > 0.25f)) {
+    const int x_177 = obj.numbers[5];
+    const float x_180 = color.x;
+    color.x = (x_180 + float(x_177));
+  }
+  const float x_184 = uv.y;
+  if ((x_184 > 0.5f)) {
+    const int x_189 = obj.numbers[6];
+    const float x_192 = color.y;
+    color.y = (x_192 + float(x_189));
+  }
+  const float x_196 = uv.y;
+  if ((x_196 > 0.75f)) {
+    const int x_201 = obj.numbers[7];
+    const float x_204 = color.z;
+    color.z = (x_204 + float(x_201));
+  }
+  const int x_208 = obj.numbers[8];
+  const float x_211 = color.z;
+  color.z = (x_211 + float(x_208));
+  const float x_215 = uv.x;
+  const float x_217 = uv.y;
+  if ((abs((x_215 - x_217)) < 0.25f)) {
+    const int x_224 = obj.numbers[9];
+    const float x_227 = color.x;
+    color.x = (x_227 + float(x_224));
+  }
+  const float3 x_231 = normalize(color);
+  frag_color = float4(x_231.x, x_231.y, x_231.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_4 = {frag_color, gl_Position};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001E481EDD080(130,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001E481EDD080(129,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..21d9cc2
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,230 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b0, space0) {
+  uint4 x_34[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_239 = i;
+  const int x_241 = obj.numbers[x_239];
+  temp = x_241;
+  const int x_242 = i;
+  const int x_243 = j;
+  const int x_245 = obj.numbers[x_243];
+  obj.numbers[x_242] = x_245;
+  const int x_247 = j;
+  obj.numbers[x_247] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_251 = h;
+  const int x_253 = obj.numbers[x_251];
+  pivot = x_253;
+  const int x_254 = l;
+  i_1 = (x_254 - 1);
+  const int x_256 = l;
+  j_1 = x_256;
+  [loop] while (true) {
+    const int x_261 = j_1;
+    const int x_262 = h;
+    if ((x_261 <= (x_262 - 1))) {
+    } else {
+      break;
+    }
+    const int x_268 = obj.numbers[j_1];
+    if ((x_268 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_282 = h;
+  param_3 = x_282;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_288 = (top + 1);
+  top = x_288;
+  stack[x_288] = l_1;
+  const int x_292 = (top + 1);
+  top = x_292;
+  stack[x_292] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_302 = top;
+    top = (x_302 - 1);
+    const int x_305 = stack[x_302];
+    h_1 = x_305;
+    const int x_306 = top;
+    top = (x_306 - 1);
+    const int x_309 = stack[x_306];
+    l_1 = x_309;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_312 = performPartition_i1_i1_(param_4, param_5);
+    p = x_312;
+    if (((p - 1) > l_1)) {
+      const int x_320 = (top + 1);
+      top = x_320;
+      stack[x_320] = l_1;
+      const int x_324 = (top + 1);
+      top = x_324;
+      stack[x_324] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_335 = (top + 1);
+      top = x_335;
+      stack[x_335] = (p + 1);
+      const int x_340 = (top + 1);
+      top = x_340;
+      stack[x_340] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_104 = i_2;
+      const int x_107 = obj.numbers[i_2];
+      const int x_110 = obj.numbers[i_2];
+      obj.numbers[x_104] = (x_107 * x_110);
+    }
+  }
+  quicksort_();
+  const float4 x_116 = x_GLF_FragCoord;
+  const float2 x_119 = asfloat(x_34[0].xy);
+  uv = (float2(x_116.x, x_116.y) / x_119);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_122 = obj.numbers[0];
+  const float x_125 = color.x;
+  color.x = (x_125 + float(x_122));
+  const float x_129 = uv.x;
+  if ((x_129 > 0.25f)) {
+    const int x_134 = obj.numbers[1];
+    const float x_137 = color.x;
+    color.x = (x_137 + float(x_134));
+  }
+  const float x_141 = uv.x;
+  if ((x_141 > 0.5f)) {
+    const int x_146 = obj.numbers[2];
+    const float x_149 = color.y;
+    color.y = (x_149 + float(x_146));
+  }
+  const float x_153 = uv.x;
+  if ((x_153 > 0.75f)) {
+    const int x_158 = obj.numbers[3];
+    const float x_161 = color.z;
+    color.z = (x_161 + float(x_158));
+  }
+  const int x_165 = obj.numbers[4];
+  const float x_168 = color.y;
+  color.y = (x_168 + float(x_165));
+  const float x_172 = uv.y;
+  if ((x_172 > 0.25f)) {
+    const int x_177 = obj.numbers[5];
+    const float x_180 = color.x;
+    color.x = (x_180 + float(x_177));
+  }
+  const float x_184 = uv.y;
+  if ((x_184 > 0.5f)) {
+    const int x_189 = obj.numbers[6];
+    const float x_192 = color.y;
+    color.y = (x_192 + float(x_189));
+  }
+  const float x_196 = uv.y;
+  if ((x_196 > 0.75f)) {
+    const int x_201 = obj.numbers[7];
+    const float x_204 = color.z;
+    color.z = (x_204 + float(x_201));
+  }
+  const int x_208 = obj.numbers[8];
+  const float x_211 = color.z;
+  color.z = (x_211 + float(x_208));
+  const float x_215 = uv.x;
+  const float x_217 = uv.y;
+  if ((abs((x_215 - x_217)) < 0.25f)) {
+    const int x_224 = obj.numbers[9];
+    const float x_227 = color.x;
+    color.x = (x_227 + float(x_224));
+  }
+  const float3 x_231 = normalize(color);
+  frag_color = float4(x_231.x, x_231.y, x_231.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_4 = {frag_color, gl_Position};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001D05546D140(130,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001D05546D140(129,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..dd02853
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.spvasm.expected.hlsl
@@ -0,0 +1,238 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_33 : register(b0, space0) {
+  uint4 x_33[1];
+};
+cbuffer cbuffer_x_36 : register(b1, space0) {
+  uint4 x_36[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_250 = i;
+  const int x_252 = obj.numbers[x_250];
+  temp = x_252;
+  const int x_253 = i;
+  const int x_254 = j;
+  const int x_256 = obj.numbers[x_254];
+  obj.numbers[x_253] = x_256;
+  const int x_258 = j;
+  obj.numbers[x_258] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_262 = h;
+  const int x_264 = obj.numbers[x_262];
+  pivot = x_264;
+  const int x_265 = l;
+  i_1 = (x_265 - 1);
+  const int x_267 = l;
+  j_1 = x_267;
+  [loop] while (true) {
+    const int x_272 = j_1;
+    const int x_273 = h;
+    if ((x_272 <= (x_273 - 1))) {
+    } else {
+      break;
+    }
+    const int x_279 = obj.numbers[j_1];
+    if ((x_279 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_293 = h;
+  param_3 = x_293;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_299 = (top + 1);
+  top = x_299;
+  stack[x_299] = l_1;
+  const int x_303 = (top + 1);
+  top = x_303;
+  stack[x_303] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_313 = top;
+    top = (x_313 - 1);
+    const int x_316 = stack[x_313];
+    h_1 = x_316;
+    const int x_317 = top;
+    top = (x_317 - 1);
+    const int x_320 = stack[x_317];
+    l_1 = x_320;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_323 = performPartition_i1_i1_(param_4, param_5);
+    p = x_323;
+    if (((p - 1) > l_1)) {
+      const int x_331 = (top + 1);
+      top = x_331;
+      stack[x_331] = l_1;
+      const int x_335 = (top + 1);
+      top = x_335;
+      stack[x_335] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_346 = (top + 1);
+      top = x_346;
+      stack[x_346] = (p + 1);
+      const int x_351 = (top + 1);
+      top = x_351;
+      stack[x_351] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const float x_109 = asfloat(x_33[0].x);
+      const float x_111 = asfloat(x_33[0].y);
+      if ((x_109 > x_111)) {
+        break;
+      }
+      const int x_115 = i_2;
+      const int x_118 = obj.numbers[i_2];
+      const int x_121 = obj.numbers[i_2];
+      obj.numbers[x_115] = (x_118 * x_121);
+    }
+  }
+  quicksort_();
+  const float4 x_127 = x_GLF_FragCoord;
+  const float2 x_130 = asfloat(x_36[0].xy);
+  uv = (float2(x_127.x, x_127.y) / x_130);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_133 = obj.numbers[0];
+  const float x_136 = color.x;
+  color.x = (x_136 + float(x_133));
+  const float x_140 = uv.x;
+  if ((x_140 > 0.25f)) {
+    const int x_145 = obj.numbers[1];
+    const float x_148 = color.x;
+    color.x = (x_148 + float(x_145));
+  }
+  const float x_152 = uv.x;
+  if ((x_152 > 0.5f)) {
+    const int x_157 = obj.numbers[2];
+    const float x_160 = color.y;
+    color.y = (x_160 + float(x_157));
+  }
+  const float x_164 = uv.x;
+  if ((x_164 > 0.75f)) {
+    const int x_169 = obj.numbers[3];
+    const float x_172 = color.z;
+    color.z = (x_172 + float(x_169));
+  }
+  const int x_176 = obj.numbers[4];
+  const float x_179 = color.y;
+  color.y = (x_179 + float(x_176));
+  const float x_183 = uv.y;
+  if ((x_183 > 0.25f)) {
+    const int x_188 = obj.numbers[5];
+    const float x_191 = color.x;
+    color.x = (x_191 + float(x_188));
+  }
+  const float x_195 = uv.y;
+  if ((x_195 > 0.5f)) {
+    const int x_200 = obj.numbers[6];
+    const float x_203 = color.y;
+    color.y = (x_203 + float(x_200));
+  }
+  const float x_207 = uv.y;
+  if ((x_207 > 0.75f)) {
+    const int x_212 = obj.numbers[7];
+    const float x_215 = color.z;
+    color.z = (x_215 + float(x_212));
+  }
+  const int x_219 = obj.numbers[8];
+  const float x_222 = color.z;
+  color.z = (x_222 + float(x_219));
+  const float x_226 = uv.x;
+  const float x_228 = uv.y;
+  if ((abs((x_226 - x_228)) < 0.25f)) {
+    const int x_235 = obj.numbers[9];
+    const float x_238 = color.x;
+    color.x = (x_238 + float(x_235));
+  }
+  const float3 x_242 = normalize(color);
+  frag_color = float4(x_242.x, x_242.y, x_242.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_5 = {frag_color, gl_Position};
+  return tint_symbol_5;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000277FFA71560(133,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x00000277FFA71560(132,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..c0c9cf2
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-with-injection/2-opt.wgsl.expected.hlsl
@@ -0,0 +1,238 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_33 : register(b0, space0) {
+  uint4 x_33[1];
+};
+cbuffer cbuffer_x_36 : register(b1, space0) {
+  uint4 x_36[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_250 = i;
+  const int x_252 = obj.numbers[x_250];
+  temp = x_252;
+  const int x_253 = i;
+  const int x_254 = j;
+  const int x_256 = obj.numbers[x_254];
+  obj.numbers[x_253] = x_256;
+  const int x_258 = j;
+  obj.numbers[x_258] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_262 = h;
+  const int x_264 = obj.numbers[x_262];
+  pivot = x_264;
+  const int x_265 = l;
+  i_1 = (x_265 - 1);
+  const int x_267 = l;
+  j_1 = x_267;
+  [loop] while (true) {
+    const int x_272 = j_1;
+    const int x_273 = h;
+    if ((x_272 <= (x_273 - 1))) {
+    } else {
+      break;
+    }
+    const int x_279 = obj.numbers[j_1];
+    if ((x_279 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_293 = h;
+  param_3 = x_293;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_299 = (top + 1);
+  top = x_299;
+  stack[x_299] = l_1;
+  const int x_303 = (top + 1);
+  top = x_303;
+  stack[x_303] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_313 = top;
+    top = (x_313 - 1);
+    const int x_316 = stack[x_313];
+    h_1 = x_316;
+    const int x_317 = top;
+    top = (x_317 - 1);
+    const int x_320 = stack[x_317];
+    l_1 = x_320;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_323 = performPartition_i1_i1_(param_4, param_5);
+    p = x_323;
+    if (((p - 1) > l_1)) {
+      const int x_331 = (top + 1);
+      top = x_331;
+      stack[x_331] = l_1;
+      const int x_335 = (top + 1);
+      top = x_335;
+      stack[x_335] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_346 = (top + 1);
+      top = x_346;
+      stack[x_346] = (p + 1);
+      const int x_351 = (top + 1);
+      top = x_351;
+      stack[x_351] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const float x_109 = asfloat(x_33[0].x);
+      const float x_111 = asfloat(x_33[0].y);
+      if ((x_109 > x_111)) {
+        break;
+      }
+      const int x_115 = i_2;
+      const int x_118 = obj.numbers[i_2];
+      const int x_121 = obj.numbers[i_2];
+      obj.numbers[x_115] = (x_118 * x_121);
+    }
+  }
+  quicksort_();
+  const float4 x_127 = x_GLF_FragCoord;
+  const float2 x_130 = asfloat(x_36[0].xy);
+  uv = (float2(x_127.x, x_127.y) / x_130);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_133 = obj.numbers[0];
+  const float x_136 = color.x;
+  color.x = (x_136 + float(x_133));
+  const float x_140 = uv.x;
+  if ((x_140 > 0.25f)) {
+    const int x_145 = obj.numbers[1];
+    const float x_148 = color.x;
+    color.x = (x_148 + float(x_145));
+  }
+  const float x_152 = uv.x;
+  if ((x_152 > 0.5f)) {
+    const int x_157 = obj.numbers[2];
+    const float x_160 = color.y;
+    color.y = (x_160 + float(x_157));
+  }
+  const float x_164 = uv.x;
+  if ((x_164 > 0.75f)) {
+    const int x_169 = obj.numbers[3];
+    const float x_172 = color.z;
+    color.z = (x_172 + float(x_169));
+  }
+  const int x_176 = obj.numbers[4];
+  const float x_179 = color.y;
+  color.y = (x_179 + float(x_176));
+  const float x_183 = uv.y;
+  if ((x_183 > 0.25f)) {
+    const int x_188 = obj.numbers[5];
+    const float x_191 = color.x;
+    color.x = (x_191 + float(x_188));
+  }
+  const float x_195 = uv.y;
+  if ((x_195 > 0.5f)) {
+    const int x_200 = obj.numbers[6];
+    const float x_203 = color.y;
+    color.y = (x_203 + float(x_200));
+  }
+  const float x_207 = uv.y;
+  if ((x_207 > 0.75f)) {
+    const int x_212 = obj.numbers[7];
+    const float x_215 = color.z;
+    color.z = (x_215 + float(x_212));
+  }
+  const int x_219 = obj.numbers[8];
+  const float x_222 = color.z;
+  color.z = (x_222 + float(x_219));
+  const float x_226 = uv.x;
+  const float x_228 = uv.y;
+  if ((abs((x_226 - x_228)) < 0.25f)) {
+    const int x_235 = obj.numbers[9];
+    const float x_238 = color.x;
+    color.x = (x_238 + float(x_235));
+  }
+  const float3 x_242 = normalize(color);
+  frag_color = float4(x_242.x, x_242.y, x_242.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_5 = {frag_color, gl_Position};
+  return tint_symbol_5;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001A3B2C08520(133,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001A3B2C08520(132,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.hlsl
new file mode 100644
index 0000000..9867861
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.spvasm.expected.hlsl
@@ -0,0 +1,317 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b0, space0) {
+  uint4 x_34[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int x_90 = 0;
+  int x_91 = 0;
+  int x_92 = 0;
+  int x_93 = 0;
+  int x_94 = 0;
+  int x_95 = 0;
+  int x_96 = 0;
+  int x_97 = 0;
+  int x_98 = 0;
+  int x_99 = 0;
+  int x_100 = 0;
+  int x_101 = 0;
+  int x_102 = 0;
+  int x_103[10] = (int[10])0;
+  int x_104 = 0;
+  int x_105 = 0;
+  int x_106 = 0;
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_121 = i_2;
+      const int x_124 = obj.numbers[i_2];
+      const int x_127 = obj.numbers[i_2];
+      obj.numbers[x_121] = (x_124 * x_127);
+    }
+  }
+  x_100 = 0;
+  x_101 = 9;
+  x_102 = -1;
+  const int x_133 = (x_102 + 1);
+  x_102 = x_133;
+  x_103[x_133] = x_100;
+  const int x_137 = (x_102 + 1);
+  x_102 = x_137;
+  x_103[x_137] = x_101;
+  [loop] while (true) {
+    if ((x_102 >= 0)) {
+    } else {
+      break;
+    }
+    const int x_147 = x_102;
+    x_102 = (x_147 - 1);
+    const int x_150 = x_103[x_147];
+    x_101 = x_150;
+    const int x_151 = x_102;
+    x_102 = (x_151 - 1);
+    const int x_154 = x_103[x_151];
+    x_100 = x_154;
+    x_105 = x_100;
+    x_106 = x_101;
+    const int x_159 = obj.numbers[x_106];
+    x_92 = x_159;
+    x_93 = (x_105 - 1);
+    x_94 = x_105;
+    {
+      [loop] for(; (x_94 <= (x_106 - 1)); x_94 = (x_94 + 1)) {
+        const int x_174 = obj.numbers[x_94];
+        if ((x_174 <= x_92)) {
+          x_93 = (x_93 + 1);
+          x_95 = x_93;
+          x_96 = x_94;
+          const int x_185 = obj.numbers[x_95];
+          x_91 = x_185;
+          const int x_186 = x_95;
+          const int x_189 = obj.numbers[x_96];
+          obj.numbers[x_186] = x_189;
+          obj.numbers[x_96] = x_91;
+        }
+      }
+    }
+    x_97 = (x_93 + 1);
+    x_98 = x_106;
+    const int x_201 = obj.numbers[x_97];
+    x_90 = x_201;
+    const int x_202 = x_97;
+    const int x_205 = obj.numbers[x_98];
+    obj.numbers[x_202] = x_205;
+    obj.numbers[x_98] = x_90;
+    x_99 = (x_93 + 1);
+    x_104 = x_99;
+    if (((x_104 - 1) > x_100)) {
+      const int x_220 = (x_102 + 1);
+      x_102 = x_220;
+      x_103[x_220] = x_100;
+      const int x_224 = (x_102 + 1);
+      x_102 = x_224;
+      x_103[x_224] = (x_104 - 1);
+    }
+    if (((x_104 + 1) < x_101)) {
+      const int x_235 = (x_102 + 1);
+      x_102 = x_235;
+      x_103[x_235] = (x_104 + 1);
+      const int x_240 = (x_102 + 1);
+      x_102 = x_240;
+      x_103[x_240] = x_101;
+    }
+  }
+  const float4 x_243 = x_GLF_FragCoord;
+  const float2 x_246 = asfloat(x_34[0].xy);
+  uv = (float2(x_243.x, x_243.y) / x_246);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_249 = obj.numbers[0];
+  const float x_252 = color.x;
+  color.x = (x_252 + float(x_249));
+  const float x_256 = uv.x;
+  if ((x_256 > 0.25f)) {
+    const int x_261 = obj.numbers[1];
+    const float x_264 = color.x;
+    color.x = (x_264 + float(x_261));
+  }
+  const float x_268 = uv.x;
+  if ((x_268 > 0.5f)) {
+    const int x_273 = obj.numbers[2];
+    const float x_276 = color.y;
+    color.y = (x_276 + float(x_273));
+  }
+  const float x_280 = uv.x;
+  if ((x_280 > 0.75f)) {
+    const int x_285 = obj.numbers[3];
+    const float x_288 = color.z;
+    color.z = (x_288 + float(x_285));
+  }
+  const int x_292 = obj.numbers[4];
+  const float x_295 = color.y;
+  color.y = (x_295 + float(x_292));
+  const float x_299 = uv.y;
+  if ((x_299 > 0.25f)) {
+    const int x_304 = obj.numbers[5];
+    const float x_307 = color.x;
+    color.x = (x_307 + float(x_304));
+  }
+  const float x_311 = uv.y;
+  if ((x_311 > 0.5f)) {
+    const int x_316 = obj.numbers[6];
+    const float x_319 = color.y;
+    color.y = (x_319 + float(x_316));
+  }
+  const float x_323 = uv.y;
+  if ((x_323 > 0.75f)) {
+    const int x_328 = obj.numbers[7];
+    const float x_331 = color.z;
+    color.z = (x_331 + float(x_328));
+  }
+  const int x_335 = obj.numbers[8];
+  const float x_338 = color.z;
+  color.z = (x_338 + float(x_335));
+  const float x_342 = uv.x;
+  const float x_344 = uv.y;
+  if ((abs((x_342 - x_344)) < 0.25f)) {
+    const int x_351 = obj.numbers[9];
+    const float x_354 = color.x;
+    color.x = (x_354 + float(x_351));
+  }
+  const float3 x_358 = normalize(color);
+  frag_color = float4(x_358.x, x_358.y, x_358.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_4 = {frag_color, gl_Position};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_366 = i;
+  const int x_368 = obj.numbers[x_366];
+  temp = x_368;
+  const int x_369 = i;
+  const int x_370 = j;
+  const int x_372 = obj.numbers[x_370];
+  obj.numbers[x_369] = x_372;
+  const int x_374 = j;
+  obj.numbers[x_374] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_378 = h;
+  const int x_380 = obj.numbers[x_378];
+  pivot = x_380;
+  const int x_381 = l;
+  i_1 = (x_381 - 1);
+  const int x_383 = l;
+  j_1 = x_383;
+  [loop] while (true) {
+    const int x_388 = j_1;
+    const int x_389 = h;
+    if ((x_388 <= (x_389 - 1))) {
+    } else {
+      break;
+    }
+    const int x_395 = obj.numbers[j_1];
+    if ((x_395 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_409 = h;
+  param_3 = x_409;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_415 = (top + 1);
+  top = x_415;
+  stack[x_415] = l_1;
+  const int x_419 = (top + 1);
+  top = x_419;
+  stack[x_419] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_429 = top;
+    top = (x_429 - 1);
+    const int x_432 = stack[x_429];
+    h_1 = x_432;
+    const int x_433 = top;
+    top = (x_433 - 1);
+    const int x_436 = stack[x_433];
+    l_1 = x_436;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_439 = performPartition_i1_i1_(param_4, param_5);
+    p = x_439;
+    if (((p - 1) > l_1)) {
+      const int x_447 = (top + 1);
+      top = x_447;
+      stack[x_447] = l_1;
+      const int x_451 = (top + 1);
+      top = x_451;
+      stack[x_451] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_462 = (top + 1);
+      top = x_462;
+      stack[x_462] = (p + 1);
+      const int x_467 = (top + 1);
+      top = x_467;
+      stack[x_467] = h_1;
+    }
+  }
+  return;
+}
+C:\src\tint\test\Shader@0x0000028832314060(39,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x0000028832314060(38,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.hlsl
new file mode 100644
index 0000000..0727d5b
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/0.wgsl.expected.hlsl
@@ -0,0 +1,317 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b0, space0) {
+  uint4 x_34[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int x_90 = 0;
+  int x_91 = 0;
+  int x_92 = 0;
+  int x_93 = 0;
+  int x_94 = 0;
+  int x_95 = 0;
+  int x_96 = 0;
+  int x_97 = 0;
+  int x_98 = 0;
+  int x_99 = 0;
+  int x_100 = 0;
+  int x_101 = 0;
+  int x_102 = 0;
+  int x_103[10] = (int[10])0;
+  int x_104 = 0;
+  int x_105 = 0;
+  int x_106 = 0;
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_121 = i_2;
+      const int x_124 = obj.numbers[i_2];
+      const int x_127 = obj.numbers[i_2];
+      obj.numbers[x_121] = (x_124 * x_127);
+    }
+  }
+  x_100 = 0;
+  x_101 = 9;
+  x_102 = -1;
+  const int x_133 = (x_102 + 1);
+  x_102 = x_133;
+  x_103[x_133] = x_100;
+  const int x_137 = (x_102 + 1);
+  x_102 = x_137;
+  x_103[x_137] = x_101;
+  [loop] while (true) {
+    if ((x_102 >= 0)) {
+    } else {
+      break;
+    }
+    const int x_147 = x_102;
+    x_102 = (x_147 - 1);
+    const int x_150 = x_103[x_147];
+    x_101 = x_150;
+    const int x_151 = x_102;
+    x_102 = (x_151 - 1);
+    const int x_154 = x_103[x_151];
+    x_100 = x_154;
+    x_105 = x_100;
+    x_106 = x_101;
+    const int x_159 = obj.numbers[x_106];
+    x_92 = x_159;
+    x_93 = (x_105 - 1);
+    x_94 = x_105;
+    {
+      [loop] for(; (x_94 <= (x_106 - 1)); x_94 = (x_94 + 1)) {
+        const int x_174 = obj.numbers[x_94];
+        if ((x_174 <= x_92)) {
+          x_93 = (x_93 + 1);
+          x_95 = x_93;
+          x_96 = x_94;
+          const int x_185 = obj.numbers[x_95];
+          x_91 = x_185;
+          const int x_186 = x_95;
+          const int x_189 = obj.numbers[x_96];
+          obj.numbers[x_186] = x_189;
+          obj.numbers[x_96] = x_91;
+        }
+      }
+    }
+    x_97 = (x_93 + 1);
+    x_98 = x_106;
+    const int x_201 = obj.numbers[x_97];
+    x_90 = x_201;
+    const int x_202 = x_97;
+    const int x_205 = obj.numbers[x_98];
+    obj.numbers[x_202] = x_205;
+    obj.numbers[x_98] = x_90;
+    x_99 = (x_93 + 1);
+    x_104 = x_99;
+    if (((x_104 - 1) > x_100)) {
+      const int x_220 = (x_102 + 1);
+      x_102 = x_220;
+      x_103[x_220] = x_100;
+      const int x_224 = (x_102 + 1);
+      x_102 = x_224;
+      x_103[x_224] = (x_104 - 1);
+    }
+    if (((x_104 + 1) < x_101)) {
+      const int x_235 = (x_102 + 1);
+      x_102 = x_235;
+      x_103[x_235] = (x_104 + 1);
+      const int x_240 = (x_102 + 1);
+      x_102 = x_240;
+      x_103[x_240] = x_101;
+    }
+  }
+  const float4 x_243 = x_GLF_FragCoord;
+  const float2 x_246 = asfloat(x_34[0].xy);
+  uv = (float2(x_243.x, x_243.y) / x_246);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_249 = obj.numbers[0];
+  const float x_252 = color.x;
+  color.x = (x_252 + float(x_249));
+  const float x_256 = uv.x;
+  if ((x_256 > 0.25f)) {
+    const int x_261 = obj.numbers[1];
+    const float x_264 = color.x;
+    color.x = (x_264 + float(x_261));
+  }
+  const float x_268 = uv.x;
+  if ((x_268 > 0.5f)) {
+    const int x_273 = obj.numbers[2];
+    const float x_276 = color.y;
+    color.y = (x_276 + float(x_273));
+  }
+  const float x_280 = uv.x;
+  if ((x_280 > 0.75f)) {
+    const int x_285 = obj.numbers[3];
+    const float x_288 = color.z;
+    color.z = (x_288 + float(x_285));
+  }
+  const int x_292 = obj.numbers[4];
+  const float x_295 = color.y;
+  color.y = (x_295 + float(x_292));
+  const float x_299 = uv.y;
+  if ((x_299 > 0.25f)) {
+    const int x_304 = obj.numbers[5];
+    const float x_307 = color.x;
+    color.x = (x_307 + float(x_304));
+  }
+  const float x_311 = uv.y;
+  if ((x_311 > 0.5f)) {
+    const int x_316 = obj.numbers[6];
+    const float x_319 = color.y;
+    color.y = (x_319 + float(x_316));
+  }
+  const float x_323 = uv.y;
+  if ((x_323 > 0.75f)) {
+    const int x_328 = obj.numbers[7];
+    const float x_331 = color.z;
+    color.z = (x_331 + float(x_328));
+  }
+  const int x_335 = obj.numbers[8];
+  const float x_338 = color.z;
+  color.z = (x_338 + float(x_335));
+  const float x_342 = uv.x;
+  const float x_344 = uv.y;
+  if ((abs((x_342 - x_344)) < 0.25f)) {
+    const int x_351 = obj.numbers[9];
+    const float x_354 = color.x;
+    color.x = (x_354 + float(x_351));
+  }
+  const float3 x_358 = normalize(color);
+  frag_color = float4(x_358.x, x_358.y, x_358.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_4 = {frag_color, gl_Position};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_366 = i;
+  const int x_368 = obj.numbers[x_366];
+  temp = x_368;
+  const int x_369 = i;
+  const int x_370 = j;
+  const int x_372 = obj.numbers[x_370];
+  obj.numbers[x_369] = x_372;
+  const int x_374 = j;
+  obj.numbers[x_374] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_378 = h;
+  const int x_380 = obj.numbers[x_378];
+  pivot = x_380;
+  const int x_381 = l;
+  i_1 = (x_381 - 1);
+  const int x_383 = l;
+  j_1 = x_383;
+  [loop] while (true) {
+    const int x_388 = j_1;
+    const int x_389 = h;
+    if ((x_388 <= (x_389 - 1))) {
+    } else {
+      break;
+    }
+    const int x_395 = obj.numbers[j_1];
+    if ((x_395 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_409 = h;
+  param_3 = x_409;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_415 = (top + 1);
+  top = x_415;
+  stack[x_415] = l_1;
+  const int x_419 = (top + 1);
+  top = x_419;
+  stack[x_419] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_429 = top;
+    top = (x_429 - 1);
+    const int x_432 = stack[x_429];
+    h_1 = x_432;
+    const int x_433 = top;
+    top = (x_433 - 1);
+    const int x_436 = stack[x_433];
+    l_1 = x_436;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_439 = performPartition_i1_i1_(param_4, param_5);
+    p = x_439;
+    if (((p - 1) > l_1)) {
+      const int x_447 = (top + 1);
+      top = x_447;
+      stack[x_447] = l_1;
+      const int x_451 = (top + 1);
+      top = x_451;
+      stack[x_451] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_462 = (top + 1);
+      top = x_462;
+      stack[x_462] = (p + 1);
+      const int x_467 = (top + 1);
+      top = x_467;
+      stack[x_467] = h_1;
+    }
+  }
+  return;
+}
+C:\src\tint\test\Shader@0x0000028832C83FA0(39,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x0000028832C83FA0(38,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.hlsl
new file mode 100644
index 0000000..cb5a691
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.spvasm.expected.hlsl
@@ -0,0 +1,295 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b0, space0) {
+  uint4 x_34[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int x_314 = 0;
+  int x_315 = 0;
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_316 = h;
+  const int x_318 = obj.numbers[x_316];
+  pivot = x_318;
+  const int x_319 = l;
+  i_1 = (x_319 - 1);
+  const int x_321 = l;
+  j_1 = x_321;
+  [loop] while (true) {
+    const int x_326 = j_1;
+    const int x_327 = h;
+    if ((x_326 <= (x_327 - 1))) {
+    } else {
+      break;
+    }
+    const int x_333 = obj.numbers[j_1];
+    if ((x_333 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      const int x_344 = obj.numbers[param];
+      x_315 = x_344;
+      const int x_345 = param;
+      const int x_348 = obj.numbers[param_1];
+      obj.numbers[x_345] = x_348;
+      obj.numbers[param_1] = x_315;
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_357 = h;
+  param_3 = x_357;
+  const int x_360 = obj.numbers[param_2];
+  x_314 = x_360;
+  const int x_361 = param_2;
+  const int x_364 = obj.numbers[param_3];
+  obj.numbers[x_361] = x_364;
+  obj.numbers[param_3] = x_314;
+  if (false) {
+  } else {
+    return (i_1 + 1);
+  }
+  return 0;
+}
+
+void main_1() {
+  int x_91 = 0;
+  int x_92 = 0;
+  int x_93 = 0;
+  int x_94[10] = (int[10])0;
+  int x_95 = 0;
+  int x_96 = 0;
+  int x_97 = 0;
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_112 = i_2;
+      const int x_115 = obj.numbers[i_2];
+      const int x_118 = obj.numbers[i_2];
+      obj.numbers[x_112] = (x_115 * x_118);
+    }
+  }
+  x_91 = 0;
+  x_92 = 9;
+  x_93 = -1;
+  const int x_124 = (x_93 + 1);
+  x_93 = x_124;
+  x_94[x_124] = x_91;
+  const int x_128 = (x_93 + 1);
+  x_93 = x_128;
+  x_94[x_128] = x_92;
+  [loop] while (true) {
+    if ((x_93 >= 0)) {
+    } else {
+      break;
+    }
+    const int x_138 = x_93;
+    x_93 = (x_138 - 1);
+    const int x_141 = x_94[x_138];
+    x_92 = x_141;
+    const int x_142 = x_93;
+    x_93 = (x_142 - 1);
+    const int x_145 = x_94[x_142];
+    x_91 = x_145;
+    x_96 = x_91;
+    x_97 = x_92;
+    const int x_148 = performPartition_i1_i1_(x_96, x_97);
+    x_95 = x_148;
+    if (((x_95 - 1) > x_91)) {
+      const int x_156 = (x_93 + 1);
+      x_93 = x_156;
+      x_94[x_156] = x_91;
+      const int x_160 = (x_93 + 1);
+      x_93 = x_160;
+      x_94[x_160] = (x_95 - 1);
+    }
+    if (((x_95 + 1) < x_92)) {
+      const int x_171 = (x_93 + 1);
+      x_93 = x_171;
+      x_94[x_171] = (x_95 + 1);
+      const int x_176 = (x_93 + 1);
+      x_93 = x_176;
+      x_94[x_176] = x_92;
+    }
+  }
+  const float4 x_179 = x_GLF_FragCoord;
+  const float2 x_182 = asfloat(x_34[0].xy);
+  uv = (float2(x_179.x, x_179.y) / x_182);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_185 = obj.numbers[0];
+  const float x_188 = color.x;
+  color.x = (x_188 + float(x_185));
+  const float x_192 = uv.x;
+  if ((x_192 > 0.25f)) {
+    const int x_197 = obj.numbers[1];
+    const float x_200 = color.x;
+    color.x = (x_200 + float(x_197));
+  }
+  const float x_204 = uv.x;
+  if ((x_204 > 0.5f)) {
+    const int x_209 = obj.numbers[2];
+    const float x_212 = color.y;
+    color.y = (x_212 + float(x_209));
+  }
+  const float x_216 = uv.x;
+  if ((x_216 > 0.75f)) {
+    const int x_221 = obj.numbers[3];
+    const float x_224 = color.z;
+    color.z = (x_224 + float(x_221));
+  }
+  const int x_228 = obj.numbers[4];
+  const float x_231 = color.y;
+  color.y = (x_231 + float(x_228));
+  const float x_235 = uv.y;
+  if ((x_235 > 0.25f)) {
+    const int x_240 = obj.numbers[5];
+    const float x_243 = color.x;
+    color.x = (x_243 + float(x_240));
+  }
+  const float x_247 = uv.y;
+  if ((x_247 > 0.5f)) {
+    const int x_252 = obj.numbers[6];
+    const float x_255 = color.y;
+    color.y = (x_255 + float(x_252));
+  }
+  const float x_259 = uv.y;
+  if ((x_259 > 0.75f)) {
+    const int x_264 = obj.numbers[7];
+    const float x_267 = color.z;
+    color.z = (x_267 + float(x_264));
+  }
+  const int x_271 = obj.numbers[8];
+  const float x_274 = color.z;
+  color.z = (x_274 + float(x_271));
+  const float x_278 = uv.x;
+  const float x_280 = uv.y;
+  if ((abs((x_278 - x_280)) < 0.25f)) {
+    const int x_287 = obj.numbers[9];
+    const float x_290 = color.x;
+    color.x = (x_290 + float(x_287));
+  }
+  const float3 x_294 = normalize(color);
+  frag_color = float4(x_294.x, x_294.y, x_294.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_4 = {frag_color, gl_Position};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_302 = i;
+  const int x_304 = obj.numbers[x_302];
+  temp = x_304;
+  const int x_305 = i;
+  const int x_306 = j;
+  const int x_308 = obj.numbers[x_306];
+  obj.numbers[x_305] = x_308;
+  const int x_310 = j;
+  obj.numbers[x_310] = temp;
+  return;
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_377 = (top + 1);
+  top = x_377;
+  stack[x_377] = l_1;
+  const int x_381 = (top + 1);
+  top = x_381;
+  stack[x_381] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_391 = top;
+    top = (x_391 - 1);
+    const int x_394 = stack[x_391];
+    h_1 = x_394;
+    const int x_395 = top;
+    top = (x_395 - 1);
+    const int x_398 = stack[x_395];
+    l_1 = x_398;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_401 = performPartition_i1_i1_(param_4, param_5);
+    p = x_401;
+    if (((p - 1) > l_1)) {
+      const int x_409 = (top + 1);
+      top = x_409;
+      stack[x_409] = l_1;
+      const int x_413 = (top + 1);
+      top = x_413;
+      stack[x_413] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_424 = (top + 1);
+      top = x_424;
+      stack[x_424] = (p + 1);
+      const int x_429 = (top + 1);
+      top = x_429;
+      stack[x_429] = h_1;
+    }
+  }
+  return;
+}
+C:\src\tint\test\Shader@0x000002B401B06060(85,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000002B401B06060(84,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.hlsl
new file mode 100644
index 0000000..d7f564d
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-if-false-else-return/2.wgsl.expected.hlsl
@@ -0,0 +1,295 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b0, space0) {
+  uint4 x_34[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int x_314 = 0;
+  int x_315 = 0;
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_316 = h;
+  const int x_318 = obj.numbers[x_316];
+  pivot = x_318;
+  const int x_319 = l;
+  i_1 = (x_319 - 1);
+  const int x_321 = l;
+  j_1 = x_321;
+  [loop] while (true) {
+    const int x_326 = j_1;
+    const int x_327 = h;
+    if ((x_326 <= (x_327 - 1))) {
+    } else {
+      break;
+    }
+    const int x_333 = obj.numbers[j_1];
+    if ((x_333 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      const int x_344 = obj.numbers[param];
+      x_315 = x_344;
+      const int x_345 = param;
+      const int x_348 = obj.numbers[param_1];
+      obj.numbers[x_345] = x_348;
+      obj.numbers[param_1] = x_315;
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_357 = h;
+  param_3 = x_357;
+  const int x_360 = obj.numbers[param_2];
+  x_314 = x_360;
+  const int x_361 = param_2;
+  const int x_364 = obj.numbers[param_3];
+  obj.numbers[x_361] = x_364;
+  obj.numbers[param_3] = x_314;
+  if (false) {
+  } else {
+    return (i_1 + 1);
+  }
+  return 0;
+}
+
+void main_1() {
+  int x_91 = 0;
+  int x_92 = 0;
+  int x_93 = 0;
+  int x_94[10] = (int[10])0;
+  int x_95 = 0;
+  int x_96 = 0;
+  int x_97 = 0;
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_112 = i_2;
+      const int x_115 = obj.numbers[i_2];
+      const int x_118 = obj.numbers[i_2];
+      obj.numbers[x_112] = (x_115 * x_118);
+    }
+  }
+  x_91 = 0;
+  x_92 = 9;
+  x_93 = -1;
+  const int x_124 = (x_93 + 1);
+  x_93 = x_124;
+  x_94[x_124] = x_91;
+  const int x_128 = (x_93 + 1);
+  x_93 = x_128;
+  x_94[x_128] = x_92;
+  [loop] while (true) {
+    if ((x_93 >= 0)) {
+    } else {
+      break;
+    }
+    const int x_138 = x_93;
+    x_93 = (x_138 - 1);
+    const int x_141 = x_94[x_138];
+    x_92 = x_141;
+    const int x_142 = x_93;
+    x_93 = (x_142 - 1);
+    const int x_145 = x_94[x_142];
+    x_91 = x_145;
+    x_96 = x_91;
+    x_97 = x_92;
+    const int x_148 = performPartition_i1_i1_(x_96, x_97);
+    x_95 = x_148;
+    if (((x_95 - 1) > x_91)) {
+      const int x_156 = (x_93 + 1);
+      x_93 = x_156;
+      x_94[x_156] = x_91;
+      const int x_160 = (x_93 + 1);
+      x_93 = x_160;
+      x_94[x_160] = (x_95 - 1);
+    }
+    if (((x_95 + 1) < x_92)) {
+      const int x_171 = (x_93 + 1);
+      x_93 = x_171;
+      x_94[x_171] = (x_95 + 1);
+      const int x_176 = (x_93 + 1);
+      x_93 = x_176;
+      x_94[x_176] = x_92;
+    }
+  }
+  const float4 x_179 = x_GLF_FragCoord;
+  const float2 x_182 = asfloat(x_34[0].xy);
+  uv = (float2(x_179.x, x_179.y) / x_182);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_185 = obj.numbers[0];
+  const float x_188 = color.x;
+  color.x = (x_188 + float(x_185));
+  const float x_192 = uv.x;
+  if ((x_192 > 0.25f)) {
+    const int x_197 = obj.numbers[1];
+    const float x_200 = color.x;
+    color.x = (x_200 + float(x_197));
+  }
+  const float x_204 = uv.x;
+  if ((x_204 > 0.5f)) {
+    const int x_209 = obj.numbers[2];
+    const float x_212 = color.y;
+    color.y = (x_212 + float(x_209));
+  }
+  const float x_216 = uv.x;
+  if ((x_216 > 0.75f)) {
+    const int x_221 = obj.numbers[3];
+    const float x_224 = color.z;
+    color.z = (x_224 + float(x_221));
+  }
+  const int x_228 = obj.numbers[4];
+  const float x_231 = color.y;
+  color.y = (x_231 + float(x_228));
+  const float x_235 = uv.y;
+  if ((x_235 > 0.25f)) {
+    const int x_240 = obj.numbers[5];
+    const float x_243 = color.x;
+    color.x = (x_243 + float(x_240));
+  }
+  const float x_247 = uv.y;
+  if ((x_247 > 0.5f)) {
+    const int x_252 = obj.numbers[6];
+    const float x_255 = color.y;
+    color.y = (x_255 + float(x_252));
+  }
+  const float x_259 = uv.y;
+  if ((x_259 > 0.75f)) {
+    const int x_264 = obj.numbers[7];
+    const float x_267 = color.z;
+    color.z = (x_267 + float(x_264));
+  }
+  const int x_271 = obj.numbers[8];
+  const float x_274 = color.z;
+  color.z = (x_274 + float(x_271));
+  const float x_278 = uv.x;
+  const float x_280 = uv.y;
+  if ((abs((x_278 - x_280)) < 0.25f)) {
+    const int x_287 = obj.numbers[9];
+    const float x_290 = color.x;
+    color.x = (x_290 + float(x_287));
+  }
+  const float3 x_294 = normalize(color);
+  frag_color = float4(x_294.x, x_294.y, x_294.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_4 = {frag_color, gl_Position};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_302 = i;
+  const int x_304 = obj.numbers[x_302];
+  temp = x_304;
+  const int x_305 = i;
+  const int x_306 = j;
+  const int x_308 = obj.numbers[x_306];
+  obj.numbers[x_305] = x_308;
+  const int x_310 = j;
+  obj.numbers[x_310] = temp;
+  return;
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_377 = (top + 1);
+  top = x_377;
+  stack[x_377] = l_1;
+  const int x_381 = (top + 1);
+  top = x_381;
+  stack[x_381] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_391 = top;
+    top = (x_391 - 1);
+    const int x_394 = stack[x_391];
+    h_1 = x_394;
+    const int x_395 = top;
+    top = (x_395 - 1);
+    const int x_398 = stack[x_395];
+    l_1 = x_398;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_401 = performPartition_i1_i1_(param_4, param_5);
+    p = x_401;
+    if (((p - 1) > l_1)) {
+      const int x_409 = (top + 1);
+      top = x_409;
+      stack[x_409] = l_1;
+      const int x_413 = (top + 1);
+      top = x_413;
+      stack[x_413] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_424 = (top + 1);
+      top = x_424;
+      stack[x_424] = (p + 1);
+      const int x_429 = (top + 1);
+      top = x_429;
+      stack[x_429] = h_1;
+    }
+  }
+  return;
+}
+C:\src\tint\test\Shader@0x000001381E0F76E0(85,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001381E0F76E0(84,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..8860431
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.spvasm.expected.hlsl
@@ -0,0 +1,236 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b1, space0) {
+  uint4 x_34[1];
+};
+cbuffer cbuffer_x_37 : register(b0, space0) {
+  uint4 x_37[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_257 = i;
+  const int x_259 = obj.numbers[x_257];
+  temp = x_259;
+  const int x_260 = i;
+  const int x_261 = j;
+  const int x_263 = obj.numbers[x_261];
+  obj.numbers[x_260] = x_263;
+  const int x_265 = j;
+  obj.numbers[x_265] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_269 = h;
+  const int x_271 = obj.numbers[x_269];
+  pivot = x_271;
+  const int x_272 = l;
+  i_1 = (x_272 - 1);
+  const int x_274 = l;
+  j_1 = x_274;
+  [loop] while (true) {
+    const int x_279 = j_1;
+    const int x_280 = h;
+    if ((x_279 <= (x_280 - 1))) {
+    } else {
+      break;
+    }
+    const int x_286 = obj.numbers[j_1];
+    if ((x_286 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_300 = h;
+  param_3 = x_300;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_306 = (top + 1);
+  top = x_306;
+  stack[x_306] = l_1;
+  const int x_310 = (top + 1);
+  top = x_310;
+  stack[x_310] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_320 = top;
+    top = (x_320 - 1);
+    const int x_323 = stack[x_320];
+    h_1 = x_323;
+    const int x_324 = top;
+    top = (x_324 - 1);
+    const int x_327 = stack[x_324];
+    l_1 = x_327;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_330 = performPartition_i1_i1_(param_4, param_5);
+    p = x_330;
+    if (((p - 1) > l_1)) {
+      const int x_338 = (top + 1);
+      top = x_338;
+      stack[x_338] = l_1;
+      const int x_342 = (top + 1);
+      top = x_342;
+      stack[x_342] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_353 = (top + 1);
+      top = x_353;
+      stack[x_353] = (p + 1);
+      const int x_358 = (top + 1);
+      top = x_358;
+      stack[x_358] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_108 = i_2;
+      const int x_111 = obj.numbers[i_2];
+      const int x_114 = obj.numbers[i_2];
+      obj.numbers[x_108] = (x_111 * x_114);
+    }
+  }
+  quicksort_();
+  const float4 x_120 = x_GLF_FragCoord;
+  const float2 x_123 = asfloat(x_34[0].xy);
+  uv = (float2(x_120.x, x_120.y) / x_123);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_126 = obj.numbers[0];
+  const float x_129 = color.x;
+  color.x = (x_129 + float(x_126));
+  const float x_133 = uv.x;
+  if ((x_133 > 0.25f)) {
+    const int x_138 = obj.numbers[1];
+    const float x_141 = color.x;
+    color.x = (x_141 + float(x_138));
+  }
+  const float x_145 = uv.x;
+  if ((x_145 > 0.5f)) {
+    const float x_150 = asfloat(x_37[0].y);
+    const int x_155 = obj.numbers[max((2 * int(x_150)), 2)];
+    const float x_158 = asfloat(x_37[0].y);
+    const int x_163 = obj.numbers[max((2 * int(x_158)), 2)];
+    const float x_167 = color.y;
+    color.y = (x_167 + max(float(x_155), float(x_163)));
+  }
+  const float x_171 = uv.x;
+  if ((x_171 > 0.75f)) {
+    const int x_176 = obj.numbers[3];
+    const float x_179 = color.z;
+    color.z = (x_179 + float(x_176));
+  }
+  const int x_183 = obj.numbers[4];
+  const float x_186 = color.y;
+  color.y = (x_186 + float(x_183));
+  const float x_190 = uv.y;
+  if ((x_190 > 0.25f)) {
+    const int x_195 = obj.numbers[5];
+    const float x_198 = color.x;
+    color.x = (x_198 + float(x_195));
+  }
+  const float x_202 = uv.y;
+  if ((x_202 > 0.5f)) {
+    const int x_207 = obj.numbers[6];
+    const float x_210 = color.y;
+    color.y = (x_210 + float(x_207));
+  }
+  const float x_214 = uv.y;
+  if ((x_214 > 0.75f)) {
+    const int x_219 = obj.numbers[7];
+    const float x_222 = color.z;
+    color.z = (x_222 + float(x_219));
+  }
+  const int x_226 = obj.numbers[8];
+  const float x_229 = color.z;
+  color.z = (x_229 + float(x_226));
+  const float x_233 = uv.x;
+  const float x_235 = uv.y;
+  if ((abs((x_233 - x_235)) < 0.25f)) {
+    const int x_242 = obj.numbers[9];
+    const float x_245 = color.x;
+    color.x = (x_245 + float(x_242));
+  }
+  const float3 x_249 = normalize(color);
+  frag_color = float4(x_249.x, x_249.y, x_249.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_5 = {frag_color, gl_Position};
+  return tint_symbol_5;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000015776479900(133,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x0000015776479900(132,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..dc4f441
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/stable-quicksort-max-value-as-index/2-opt.wgsl.expected.hlsl
@@ -0,0 +1,236 @@
+SKIP: FAILED
+
+struct QuicksortObject {
+  int numbers[10];
+};
+
+static QuicksortObject obj = (QuicksortObject)0;
+static float4 x_GLF_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_pos = float4(0.0f, 0.0f, 0.0f, 0.0f);
+cbuffer cbuffer_x_34 : register(b1, space0) {
+  uint4 x_34[1];
+};
+cbuffer cbuffer_x_37 : register(b0, space0) {
+  uint4 x_37[1];
+};
+static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void swap_i1_i1_(inout int i, inout int j) {
+  int temp = 0;
+  const int x_257 = i;
+  const int x_259 = obj.numbers[x_257];
+  temp = x_259;
+  const int x_260 = i;
+  const int x_261 = j;
+  const int x_263 = obj.numbers[x_261];
+  obj.numbers[x_260] = x_263;
+  const int x_265 = j;
+  obj.numbers[x_265] = temp;
+  return;
+}
+
+int performPartition_i1_i1_(inout int l, inout int h) {
+  int pivot = 0;
+  int i_1 = 0;
+  int j_1 = 0;
+  int param = 0;
+  int param_1 = 0;
+  int param_2 = 0;
+  int param_3 = 0;
+  const int x_269 = h;
+  const int x_271 = obj.numbers[x_269];
+  pivot = x_271;
+  const int x_272 = l;
+  i_1 = (x_272 - 1);
+  const int x_274 = l;
+  j_1 = x_274;
+  [loop] while (true) {
+    const int x_279 = j_1;
+    const int x_280 = h;
+    if ((x_279 <= (x_280 - 1))) {
+    } else {
+      break;
+    }
+    const int x_286 = obj.numbers[j_1];
+    if ((x_286 <= pivot)) {
+      i_1 = (i_1 + 1);
+      param = i_1;
+      param_1 = j_1;
+      swap_i1_i1_(param, param_1);
+    }
+    {
+      j_1 = (j_1 + 1);
+    }
+  }
+  param_2 = (i_1 + 1);
+  const int x_300 = h;
+  param_3 = x_300;
+  swap_i1_i1_(param_2, param_3);
+  return (i_1 + 1);
+}
+
+void quicksort_() {
+  int l_1 = 0;
+  int h_1 = 0;
+  int top = 0;
+  int stack[10] = (int[10])0;
+  int p = 0;
+  int param_4 = 0;
+  int param_5 = 0;
+  l_1 = 0;
+  h_1 = 9;
+  top = -1;
+  const int x_306 = (top + 1);
+  top = x_306;
+  stack[x_306] = l_1;
+  const int x_310 = (top + 1);
+  top = x_310;
+  stack[x_310] = h_1;
+  [loop] while (true) {
+    if ((top >= 0)) {
+    } else {
+      break;
+    }
+    const int x_320 = top;
+    top = (x_320 - 1);
+    const int x_323 = stack[x_320];
+    h_1 = x_323;
+    const int x_324 = top;
+    top = (x_324 - 1);
+    const int x_327 = stack[x_324];
+    l_1 = x_327;
+    param_4 = l_1;
+    param_5 = h_1;
+    const int x_330 = performPartition_i1_i1_(param_4, param_5);
+    p = x_330;
+    if (((p - 1) > l_1)) {
+      const int x_338 = (top + 1);
+      top = x_338;
+      stack[x_338] = l_1;
+      const int x_342 = (top + 1);
+      top = x_342;
+      stack[x_342] = (p - 1);
+    }
+    if (((p + 1) < h_1)) {
+      const int x_353 = (top + 1);
+      top = x_353;
+      stack[x_353] = (p + 1);
+      const int x_358 = (top + 1);
+      top = x_358;
+      stack[x_358] = h_1;
+    }
+  }
+  return;
+}
+
+void main_1() {
+  int i_2 = 0;
+  float2 uv = float2(0.0f, 0.0f);
+  float3 color = float3(0.0f, 0.0f, 0.0f);
+  x_GLF_FragCoord = ((x_GLF_pos + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
+  i_2 = 0;
+  {
+    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
+      obj.numbers[i_2] = (10 - i_2);
+      const int x_108 = i_2;
+      const int x_111 = obj.numbers[i_2];
+      const int x_114 = obj.numbers[i_2];
+      obj.numbers[x_108] = (x_111 * x_114);
+    }
+  }
+  quicksort_();
+  const float4 x_120 = x_GLF_FragCoord;
+  const float2 x_123 = asfloat(x_34[0].xy);
+  uv = (float2(x_120.x, x_120.y) / x_123);
+  color = float3(1.0f, 2.0f, 3.0f);
+  const int x_126 = obj.numbers[0];
+  const float x_129 = color.x;
+  color.x = (x_129 + float(x_126));
+  const float x_133 = uv.x;
+  if ((x_133 > 0.25f)) {
+    const int x_138 = obj.numbers[1];
+    const float x_141 = color.x;
+    color.x = (x_141 + float(x_138));
+  }
+  const float x_145 = uv.x;
+  if ((x_145 > 0.5f)) {
+    const float x_150 = asfloat(x_37[0].y);
+    const int x_155 = obj.numbers[max((2 * int(x_150)), 2)];
+    const float x_158 = asfloat(x_37[0].y);
+    const int x_163 = obj.numbers[max((2 * int(x_158)), 2)];
+    const float x_167 = color.y;
+    color.y = (x_167 + max(float(x_155), float(x_163)));
+  }
+  const float x_171 = uv.x;
+  if ((x_171 > 0.75f)) {
+    const int x_176 = obj.numbers[3];
+    const float x_179 = color.z;
+    color.z = (x_179 + float(x_176));
+  }
+  const int x_183 = obj.numbers[4];
+  const float x_186 = color.y;
+  color.y = (x_186 + float(x_183));
+  const float x_190 = uv.y;
+  if ((x_190 > 0.25f)) {
+    const int x_195 = obj.numbers[5];
+    const float x_198 = color.x;
+    color.x = (x_198 + float(x_195));
+  }
+  const float x_202 = uv.y;
+  if ((x_202 > 0.5f)) {
+    const int x_207 = obj.numbers[6];
+    const float x_210 = color.y;
+    color.y = (x_210 + float(x_207));
+  }
+  const float x_214 = uv.y;
+  if ((x_214 > 0.75f)) {
+    const int x_219 = obj.numbers[7];
+    const float x_222 = color.z;
+    color.z = (x_222 + float(x_219));
+  }
+  const int x_226 = obj.numbers[8];
+  const float x_229 = color.z;
+  color.z = (x_229 + float(x_226));
+  const float x_233 = uv.x;
+  const float x_235 = uv.y;
+  if ((abs((x_233 - x_235)) < 0.25f)) {
+    const int x_242 = obj.numbers[9];
+    const float x_245 = color.x;
+    color.x = (x_245 + float(x_242));
+  }
+  const float3 x_249 = normalize(color);
+  frag_color = float4(x_249.x, x_249.y, x_249.z, 1.0f);
+  gl_Position = x_GLF_pos;
+  return;
+}
+
+struct main_out {
+  float4 frag_color_1;
+  float4 gl_Position;
+};
+struct tint_symbol_1 {
+  float4 x_GLF_pos_param : TEXCOORD0;
+};
+struct tint_symbol_2 {
+  float4 frag_color_1 : TEXCOORD0;
+  float4 gl_Position : SV_Position;
+};
+
+main_out main_inner(float4 x_GLF_pos_param) {
+  x_GLF_pos = x_GLF_pos_param;
+  main_1();
+  const main_out tint_symbol_5 = {frag_color, gl_Position};
+  return tint_symbol_5;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.x_GLF_pos_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.frag_color_1 = inner_result.frag_color_1;
+  wrapper_result.gl_Position = inner_result.gl_Position;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000203506D3380(133,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x00000203506D3380(132,12-45): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..65bba35
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,86 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int i = 0;
+  const float x_51 = asfloat(x_6[0].x);
+  i = int(x_51);
+  switch(i) {
+    case 0: {
+      [loop] while (true) {
+        i = (i + 1);
+        switch(i) {
+          case 2: {
+            i = (i + 5);
+            break;
+          }
+          case 1: {
+            {
+              if ((i > 200)) {
+              } else {
+                break;
+              }
+            }
+            continue;
+            break;
+          }
+          default: {
+            i = (i + 7);
+            break;
+          }
+        }
+        {
+          if ((i > 200)) {
+          } else {
+            break;
+          }
+        }
+      }
+      if ((i > 100)) {
+        i = (i - 2);
+        break;
+      }
+      /* fallthrough */
+      {
+        i = (i - 3);
+      }
+      break;
+    }
+    default: {
+      i = (i - 3);
+      break;
+    }
+  }
+  if ((i == -2)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000013B8CBD6FE0(26,13-21): error X3708: continue cannot be used in a switch
+
diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..7516688
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,86 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_6 : register(b0, space0) {
+  uint4 x_6[1];
+};
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  int i = 0;
+  const float x_51 = asfloat(x_6[0].x);
+  i = int(x_51);
+  switch(i) {
+    case 0: {
+      [loop] while (true) {
+        i = (i + 1);
+        switch(i) {
+          case 2: {
+            i = (i + 5);
+            break;
+          }
+          case 1: {
+            {
+              if ((i > 200)) {
+              } else {
+                break;
+              }
+            }
+            continue;
+            break;
+          }
+          default: {
+            i = (i + 7);
+            break;
+          }
+        }
+        {
+          if ((i > 200)) {
+          } else {
+            break;
+          }
+        }
+      }
+      if ((i > 100)) {
+        i = (i - 2);
+        break;
+      }
+      /* fallthrough */
+      {
+        i = (i - 3);
+      }
+      break;
+    }
+    default: {
+      i = (i - 3);
+      break;
+    }
+  }
+  if ((i == -2)) {
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+  } else {
+    x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000019C85DE9DB0(26,13-21): error X3708: continue cannot be used in a switch
+
diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl
index 3679800..b7efb3d 100755
--- a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.spvasm.expected.hlsl
@@ -13,7 +13,7 @@
   GLF_dead6index = 0;
   const float x_34 = asfloat(x_6[0].y);
   if ((x_34 < 0.0f)) {
-    while (true) {
+    [loop] while (true) {
       if (true) {
       } else {
         break;
@@ -33,11 +33,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
-C:\src\tint\test\Shader@0x000001A8C062E2C0(14,12-15): error X3696: infinite loop detected - loop never exits
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000256420D6A10(14,19-22): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl
index af486af..318f425 100755
--- a/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/undefined-assign-in-infinite-loop/0.wgsl.expected.hlsl
@@ -13,7 +13,7 @@
   GLF_dead6index = 0;
   const float x_34 = asfloat(x_6[0].y);
   if ((x_34 < 0.0f)) {
-    while (true) {
+    [loop] while (true) {
       if (true) {
       } else {
         break;
@@ -33,11 +33,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
-C:\src\tint\test\Shader@0x000001FA30492000(14,12-15): error X3696: infinite loop detected - loop never exits
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001BA0B4E7BF0(14,19-22): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..1f1e152
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,64 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_7 : register(b0, space0) {
+  uint4 x_7[1];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+float3 computePoint_() {
+  if (true) {
+    const float x_48 = asfloat(x_7[0].x);
+    const float x_50 = asfloat(x_7[0].y);
+    if ((x_48 > x_50)) {
+      discard;
+    }
+    return float3(0.0f, 0.0f, 0.0f);
+  }
+  float3 unused;
+  return unused;
+}
+
+void main_1() {
+  bool x_34 = false;
+  [loop] while (true) {
+    const float3 x_36 = computePoint_();
+    const float x_41 = gl_FragCoord.x;
+    if ((x_41 < 0.0f)) {
+      x_34 = true;
+      break;
+    }
+    const float3 x_45 = computePoint_();
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+    x_34 = true;
+    break;
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000014F8C58FE70(22,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000014F8C58FE70(11,10-13): internal error: invalid access of unbound variable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..1bbf048
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/unreachable-discard-statement-in-if/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,64 @@
+SKIP: FAILED
+
+cbuffer cbuffer_x_7 : register(b0, space0) {
+  uint4 x_7[1];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+float3 computePoint_() {
+  if (true) {
+    const float x_48 = asfloat(x_7[0].x);
+    const float x_50 = asfloat(x_7[0].y);
+    if ((x_48 > x_50)) {
+      discard;
+    }
+    return float3(0.0f, 0.0f, 0.0f);
+  }
+  float3 unused;
+  return unused;
+}
+
+void main_1() {
+  bool x_34 = false;
+  [loop] while (true) {
+    const float3 x_36 = computePoint_();
+    const float x_41 = gl_FragCoord.x;
+    if ((x_41 < 0.0f)) {
+      x_34 = true;
+      break;
+    }
+    const float3 x_45 = computePoint_();
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+    x_34 = true;
+    break;
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000017E3AA920C0(22,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000017E3AA920C0(11,10-13): internal error: invalid access of unbound variable
+
diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl
index 7e1efdc..6947f93 100755
--- a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.spvasm.expected.hlsl
@@ -11,7 +11,7 @@
   const float x_30 = asfloat(x_5[0].x);
   const float x_32 = asfloat(x_5[0].y);
   if ((x_30 > x_32)) {
-    while (true) {
+    [loop] while (true) {
       {
         if (false) {
         } else {
@@ -20,7 +20,7 @@
       }
     }
     m = 1;
-    while (true) {
+    [loop] while (true) {
       if (true) {
       } else {
         break;
@@ -38,12 +38,19 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
-C:\src\tint\test\Shader@0x000002486363E830(12,5-16): warning X3557: loop only executes for 0 iteration(s), forcing loop to unroll
-C:\src\tint\test\Shader@0x000002486363E830(21,12-15): error X3696: infinite loop detected - loop never exits
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000252CFFF6880(12,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x00000252CFFF6880(12,12-23): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x00000252CFFF6880(21,19-22): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl
index 7c25c75..6c196a4 100755
--- a/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops/0-opt.wgsl.expected.hlsl
@@ -11,7 +11,7 @@
   const float x_30 = asfloat(x_5[0].x);
   const float x_32 = asfloat(x_5[0].y);
   if ((x_30 > x_32)) {
-    while (true) {
+    [loop] while (true) {
       {
         if (false) {
         } else {
@@ -20,7 +20,7 @@
       }
     }
     m = 1;
-    while (true) {
+    [loop] while (true) {
       if (true) {
       } else {
         break;
@@ -38,12 +38,19 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
-C:\src\tint\test\Shader@0x000001F6ABD30970(12,5-16): warning X3557: loop only executes for 0 iteration(s), forcing loop to unroll
-C:\src\tint\test\Shader@0x000001F6ABD30970(21,12-15): error X3696: infinite loop detected - loop never exits
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x00000229EC6CE4C0(12,12-23): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x00000229EC6CE4C0(12,12-23): warning X3557: loop doesn't seem to do anything, consider removing [loop]
+C:\src\tint\test\Shader@0x00000229EC6CE4C0(21,19-22): error X3696: infinite loop detected - loop never exits
 
diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl
index a81d458..7aaf54b 100755
--- a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.spvasm.expected.hlsl
@@ -5,12 +5,12 @@
 void main_1() {
   bool x_21_phi = false;
   x_21_phi = false;
-  while (true) {
+  [loop] while (true) {
     bool x_25 = false;
     bool x_25_phi = false;
     bool x_30_phi = false;
     x_25_phi = x_21_phi;
-    while (true) {
+    [loop] while (true) {
       x_25 = x_25_phi;
       x_30_phi = x_25;
       if ((1 < 0)) {
@@ -42,10 +42,15 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
   const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_2;
+  return tint_symbol_1;
 }
 
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl
index a81d458..7aaf54b 100755
--- a/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/unreachable-return-in-loop/0.wgsl.expected.hlsl
@@ -5,12 +5,12 @@
 void main_1() {
   bool x_21_phi = false;
   x_21_phi = false;
-  while (true) {
+  [loop] while (true) {
     bool x_25 = false;
     bool x_25_phi = false;
     bool x_30_phi = false;
     x_25_phi = x_21_phi;
-    while (true) {
+    [loop] while (true) {
       x_25 = x_25_phi;
       x_30_phi = x_25;
       if ((1 < 0)) {
@@ -42,10 +42,15 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
   const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_2 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_2;
+  return tint_symbol_1;
 }
 
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl
index 945035d..4cdacd9 100755
--- a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.spvasm.expected.hlsl
@@ -26,7 +26,7 @@
   m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f));
   ll_1 = 0;
   GLF_live6rows = 2;
-  while (true) {
+  [loop] while (true) {
     const int x_18 = ll_1;
     const int x_19 = asint(x_9[0].x);
     if ((x_18 >= x_19)) {
@@ -39,7 +39,7 @@
     ll_2 = 0;
     ctr = 0;
     {
-      for(; (ctr < 1); ctr = (ctr + 1)) {
+      [loop] for(; (ctr < 1); ctr = (ctr + 1)) {
         const int x_24 = ll_2;
         const int x_25 = asint(x_9[0].x);
         if ((x_24 >= x_25)) {
@@ -50,7 +50,7 @@
         ll_3 = 0;
         c = 0;
         {
-          for(; (1 < z); c = (c + 1)) {
+          [loop] for(; (1 < z); c = (c + 1)) {
             d = 0;
             set_float3(tempm43[(((c >= 0) & (c < 4)) ? c : 0)], (((d >= 0) & (d < 3)) ? d : 0), 1.0f);
           }
@@ -73,14 +73,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
-C:\src\tint\test\Shader@0x000001DB72E101B0(53,24-62): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
-C:\src\tint\test\Shader@0x000001DB72E101B0(51,11-37): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (1024 iterations)
-C:\src\tint\test\Shader@0x000001DB72E101B0(40,7-39): error X3511: forced to unroll loop, but unrolling failed.
-C:\src\tint\test\Shader@0x000001DB72E101B0(27,3-14): error X3511: forced to unroll loop, but unrolling failed.
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000027C57A9E460(51,18-44): error X3531: can't unroll loops marked with loop attribute
 
diff --git a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl
index c4f06be..da48cd9 100755
--- a/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/write-before-break/0-opt.wgsl.expected.hlsl
@@ -26,7 +26,7 @@
   m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f));
   ll_1 = 0;
   GLF_live6rows = 2;
-  while (true) {
+  [loop] while (true) {
     const int x_18 = ll_1;
     const int x_19 = asint(x_9[0].x);
     if ((x_18 >= x_19)) {
@@ -39,7 +39,7 @@
     ll_2 = 0;
     ctr = 0;
     {
-      for(; (ctr < 1); ctr = (ctr + 1)) {
+      [loop] for(; (ctr < 1); ctr = (ctr + 1)) {
         const int x_24 = ll_2;
         const int x_25 = asint(x_9[0].x);
         if ((x_24 >= x_25)) {
@@ -50,7 +50,7 @@
         ll_3 = 0;
         c = 0;
         {
-          for(; (1 < z); c = (c + 1)) {
+          [loop] for(; (1 < z); c = (c + 1)) {
             d = 0;
             bool tint_tmp = (c >= 0);
             if (tint_tmp) {
@@ -85,14 +85,17 @@
   float4 x_GLF_color_1 : SV_Target0;
 };
 
-tint_symbol main() {
+main_out main_inner() {
   main_1();
-  const main_out tint_symbol_1 = {x_GLF_color};
-  const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
-  return tint_symbol_3;
+  const main_out tint_symbol_2 = {x_GLF_color};
+  return tint_symbol_2;
 }
-C:\src\tint\test\Shader@0x00000232DC6E3D00(61,24-52): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
-C:\src\tint\test\Shader@0x00000232DC6E3D00(51,11-37): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (1024 iterations)
-C:\src\tint\test\Shader@0x00000232DC6E3D00(40,7-39): error X3511: forced to unroll loop, but unrolling failed.
-C:\src\tint\test\Shader@0x00000232DC6E3D00(27,3-14): error X3511: forced to unroll loop, but unrolling failed.
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000011E3650E4B0(51,18-44): error X3531: can't unroll loops marked with loop attribute
 
diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..2836952
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,363 @@
+SKIP: FAILED
+
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+struct Obj {
+  float odd_numbers[10];
+  float even_numbers[10];
+};
+
+static BST tree_1[10] = (BST[10])0;
+cbuffer cbuffer_x_27 : register(b0, space0) {
+  uint4 x_27[1];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) {
+  const int x_74 = data;
+  tree.data = x_74;
+  tree.leftIndex = -1;
+  tree.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  int GLF_live8i = 0;
+  float GLF_live8A[50] = (float[50])0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_75 = baseIndex;
+    const int x_76 = treeIndex;
+    if ((x_75 <= x_76)) {
+    } else {
+      break;
+    }
+    const int x_77 = data_1;
+    const int x_79 = tree_1[baseIndex].data;
+    if ((x_77 <= x_79)) {
+      const int x_81 = tree_1[baseIndex].leftIndex;
+      if ((x_81 == -1)) {
+        const int x_82 = baseIndex;
+        const int x_83 = treeIndex;
+        tree_1[x_82].leftIndex = x_83;
+        const int x_84 = treeIndex;
+        const BST x_350 = tree_1[x_84];
+        param = x_350;
+        const int x_85 = data_1;
+        param_1 = x_85;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree_1[x_84] = param;
+        return;
+      } else {
+        const int x_87 = tree_1[baseIndex].leftIndex;
+        baseIndex = x_87;
+        continue;
+      }
+    } else {
+      const int x_89 = tree_1[baseIndex].rightIndex;
+      if ((x_89 == -1)) {
+        const int x_90 = baseIndex;
+        const int x_91 = treeIndex;
+        tree_1[x_90].rightIndex = x_91;
+        const int x_92 = treeIndex;
+        const BST x_362 = tree_1[x_92];
+        param_2 = x_362;
+        const int x_93 = data_1;
+        param_3 = x_93;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree_1[x_92] = param_2;
+        return;
+      } else {
+        GLF_live8i = 1;
+        const int x_369 = (((GLF_live8i >= 0) & (GLF_live8i < 50)) ? GLF_live8i : 0);
+        const float x_371 = GLF_live8A[0];
+        const float x_373 = GLF_live8A[x_369];
+        GLF_live8A[x_369] = (x_373 + x_371);
+        [loop] while (true) {
+          const int x_98 = tree_1[baseIndex].rightIndex;
+          baseIndex = x_98;
+          {
+            const float x_382 = asfloat(x_27[0].x);
+            const float x_384 = asfloat(x_27[0].y);
+            if ((x_382 > x_384)) {
+            } else {
+              break;
+            }
+          }
+        }
+        continue;
+      }
+    }
+  }
+  return;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_387 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_395 = tree_1[index];
+    currentNode = x_395;
+    const int x_101 = currentNode.data;
+    const int x_102 = target;
+    if ((x_101 == x_102)) {
+      const int x_103 = target;
+      return x_103;
+    }
+    const int x_104 = target;
+    const int x_105 = currentNode.data;
+    if ((x_104 > x_105)) {
+      const int x_106 = currentNode.rightIndex;
+      x_387 = x_106;
+    } else {
+      const int x_107 = currentNode.leftIndex;
+      x_387 = x_107;
+    }
+    index = x_387;
+  }
+  return -1;
+}
+
+float makeFrame_f1_(inout float v) {
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  const float x_418 = v;
+  v = (x_418 * 6.5f);
+  const float x_420 = v;
+  if ((x_420 < 1.5f)) {
+    param_5 = 100;
+    const int x_110 = search_i1_(param_5);
+    return float(x_110);
+  }
+  const float x_425 = v;
+  if ((x_425 < 4.0f)) {
+    return 0.0f;
+  }
+  const float x_429 = v;
+  param_6 = 6;
+  const int x_111 = search_i1_(param_6);
+  if ((x_429 < float(x_111))) {
+    return 1.0f;
+  }
+  param_7 = 30;
+  const int x_112 = search_i1_(param_7);
+  return (10.0f + float(x_112));
+}
+
+float3 hueColor_f1_(inout float angle) {
+  float nodeData = 0.0f;
+  int param_4 = 0;
+  param_4 = 15;
+  const int x_109 = search_i1_(param_4);
+  nodeData = float(x_109);
+  const float x_409 = angle;
+  return ((float3(30.0f, 30.0f, 30.0f) + (float3(1.0f, 5.0f, nodeData) * x_409)) / float3(50.0f, 50.0f, 50.0f));
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_8 = (BST)0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int GLF_live1_looplimiter2 = 0;
+  int GLF_live1i = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int GLF_live4_looplimiter3 = 0;
+  int GLF_live4i = 0;
+  int GLF_live4index = 0;
+  Obj GLF_live4obj = (Obj)0;
+  int param_24 = 0;
+  int param_25 = 0;
+  int param_26 = 0;
+  int param_27 = 0;
+  float2 z = float2(0.0f, 0.0f);
+  float x_1 = 0.0f;
+  float param_28 = 0.0f;
+  float y_1 = 0.0f;
+  float param_29 = 0.0f;
+  int sum = 0;
+  int target_1 = 0;
+  int result = 0;
+  int param_30 = 0;
+  float a = 0.0f;
+  float3 x_235 = float3(0.0f, 0.0f, 0.0f);
+  float param_31 = 0.0f;
+  treeIndex_1 = 0;
+  const BST x_237 = tree_1[0];
+  param_8 = x_237;
+  param_9 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_8, param_9);
+  tree_1[0] = param_8;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 5;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  GLF_live1_looplimiter2 = 0;
+  GLF_live1i = 0;
+  {
+    [loop] for(; true; GLF_live1i = (GLF_live1i + 1)) {
+      if ((GLF_live1_looplimiter2 >= 7)) {
+        break;
+      }
+      GLF_live1_looplimiter2 = (GLF_live1_looplimiter2 + 1);
+    }
+  }
+  param_12 = treeIndex_1;
+  param_13 = 12;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 15;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 7;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 8;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 2;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 6;
+  insert_i1_i1_(param_22, param_23);
+  treeIndex_1 = (treeIndex_1 + 1);
+  GLF_live4_looplimiter3 = 0;
+  GLF_live4i = 0;
+  {
+    [loop] for(; true; GLF_live4i = (GLF_live4i + 1)) {
+      if ((GLF_live4_looplimiter3 >= 3)) {
+        break;
+      }
+      GLF_live4_looplimiter3 = (GLF_live4_looplimiter3 + 1);
+      GLF_live4index = 1;
+      const int x_144 = GLF_live4index;
+      const int x_145 = GLF_live4index;
+      const int x_146 = GLF_live4index;
+      const float x_269 = GLF_live4obj.even_numbers[1];
+      GLF_live4obj.even_numbers[(((x_144 >= 0) & (x_145 < 10)) ? x_146 : 0)] = x_269;
+      GLF_live4obj.even_numbers[(((GLF_live4i >= 0) & (GLF_live4i < 10)) ? GLF_live4i : 0)] = 1.0f;
+    }
+  }
+  param_24 = treeIndex_1;
+  param_25 = 17;
+  insert_i1_i1_(param_24, param_25);
+  const float x_278 = asfloat(x_27[0].x);
+  const float x_280 = asfloat(x_27[0].y);
+  if ((x_278 > x_280)) {
+    return;
+  }
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_26 = treeIndex_1;
+  param_27 = 13;
+  insert_i1_i1_(param_26, param_27);
+  const float4 x_285 = gl_FragCoord;
+  z = (float2(x_285.y, x_285.x) / float2(256.0f, 256.0f));
+  const float x_289 = z.x;
+  param_28 = x_289;
+  const float x_290 = makeFrame_f1_(param_28);
+  x_1 = x_290;
+  const float x_292 = z.y;
+  param_29 = x_292;
+  const float x_293 = makeFrame_f1_(param_29);
+  y_1 = x_293;
+  sum = -100;
+  target_1 = 0;
+  {
+    [loop] for(; (target_1 < 20); target_1 = (target_1 + 1)) {
+      param_30 = target_1;
+      const int x_158 = search_i1_(param_30);
+      result = x_158;
+      if ((result > 0)) {
+      } else {
+        switch(result) {
+          case 0: {
+            return;
+            break;
+          }
+          case -1: {
+            sum = (sum + 1);
+            break;
+          }
+          default: {
+            break;
+          }
+        }
+      }
+    }
+  }
+  a = (x_1 + (y_1 * float(sum)));
+  const float x_313 = asfloat(x_27[0].x);
+  const float x_315 = asfloat(x_27[0].y);
+  if ((x_313 < x_315)) {
+    x_235 = float3(1.0f, 0.0f, 0.0f);
+  } else {
+    param_31 = a;
+    const float3 x_321 = hueColor_f1_(param_31);
+    x_235 = x_321;
+  }
+  const float3 x_322 = x_235;
+  x_GLF_color = float4(x_322.x, x_322.y, x_322.z, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000028F1D72B060(35,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x0000028F1D72B060(270,7-91): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x0000028F1D72B060(259,12-53): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..dfa33a6
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,375 @@
+SKIP: FAILED
+
+struct BST {
+  int data;
+  int leftIndex;
+  int rightIndex;
+};
+struct Obj {
+  float odd_numbers[10];
+  float even_numbers[10];
+};
+
+static BST tree_1[10] = (BST[10])0;
+cbuffer cbuffer_x_27 : register(b0, space0) {
+  uint4 x_27[1];
+};
+static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void makeTreeNode_struct_BST_i1_i1_i11_i1_(inout BST tree, inout int data) {
+  const int x_74 = data;
+  tree.data = x_74;
+  tree.leftIndex = -1;
+  tree.rightIndex = -1;
+  return;
+}
+
+void insert_i1_i1_(inout int treeIndex, inout int data_1) {
+  int baseIndex = 0;
+  BST param = (BST)0;
+  int param_1 = 0;
+  BST param_2 = (BST)0;
+  int param_3 = 0;
+  int GLF_live8i = 0;
+  float GLF_live8A[50] = (float[50])0;
+  baseIndex = 0;
+  [loop] while (true) {
+    const int x_75 = baseIndex;
+    const int x_76 = treeIndex;
+    if ((x_75 <= x_76)) {
+    } else {
+      break;
+    }
+    const int x_77 = data_1;
+    const int x_79 = tree_1[baseIndex].data;
+    if ((x_77 <= x_79)) {
+      const int x_81 = tree_1[baseIndex].leftIndex;
+      if ((x_81 == -1)) {
+        const int x_82 = baseIndex;
+        const int x_83 = treeIndex;
+        tree_1[x_82].leftIndex = x_83;
+        const int x_84 = treeIndex;
+        const BST x_350 = tree_1[x_84];
+        param = x_350;
+        const int x_85 = data_1;
+        param_1 = x_85;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param, param_1);
+        tree_1[x_84] = param;
+        return;
+      } else {
+        const int x_87 = tree_1[baseIndex].leftIndex;
+        baseIndex = x_87;
+        continue;
+      }
+    } else {
+      const int x_89 = tree_1[baseIndex].rightIndex;
+      if ((x_89 == -1)) {
+        const int x_90 = baseIndex;
+        const int x_91 = treeIndex;
+        tree_1[x_90].rightIndex = x_91;
+        const int x_92 = treeIndex;
+        const BST x_362 = tree_1[x_92];
+        param_2 = x_362;
+        const int x_93 = data_1;
+        param_3 = x_93;
+        makeTreeNode_struct_BST_i1_i1_i11_i1_(param_2, param_3);
+        tree_1[x_92] = param_2;
+        return;
+      } else {
+        GLF_live8i = 1;
+        bool tint_tmp = (GLF_live8i >= 0);
+        if (tint_tmp) {
+          tint_tmp = (GLF_live8i < 50);
+        }
+        const int x_369 = ((tint_tmp) ? GLF_live8i : 0);
+        const float x_371 = GLF_live8A[0];
+        const float x_373 = GLF_live8A[x_369];
+        GLF_live8A[x_369] = (x_373 + x_371);
+        [loop] while (true) {
+          const int x_98 = tree_1[baseIndex].rightIndex;
+          baseIndex = x_98;
+          {
+            const float x_382 = asfloat(x_27[0].x);
+            const float x_384 = asfloat(x_27[0].y);
+            if ((x_382 > x_384)) {
+            } else {
+              break;
+            }
+          }
+        }
+        continue;
+      }
+    }
+  }
+  return;
+}
+
+int search_i1_(inout int target) {
+  int index = 0;
+  BST currentNode = (BST)0;
+  int x_387 = 0;
+  index = 0;
+  [loop] while (true) {
+    if ((index != -1)) {
+    } else {
+      break;
+    }
+    const BST x_395 = tree_1[index];
+    currentNode = x_395;
+    const int x_101 = currentNode.data;
+    const int x_102 = target;
+    if ((x_101 == x_102)) {
+      const int x_103 = target;
+      return x_103;
+    }
+    const int x_104 = target;
+    const int x_105 = currentNode.data;
+    if ((x_104 > x_105)) {
+      const int x_106 = currentNode.rightIndex;
+      x_387 = x_106;
+    } else {
+      const int x_107 = currentNode.leftIndex;
+      x_387 = x_107;
+    }
+    index = x_387;
+  }
+  return -1;
+}
+
+float makeFrame_f1_(inout float v) {
+  int param_5 = 0;
+  int param_6 = 0;
+  int param_7 = 0;
+  const float x_418 = v;
+  v = (x_418 * 6.5f);
+  const float x_420 = v;
+  if ((x_420 < 1.5f)) {
+    param_5 = 100;
+    const int x_110 = search_i1_(param_5);
+    return float(x_110);
+  }
+  const float x_425 = v;
+  if ((x_425 < 4.0f)) {
+    return 0.0f;
+  }
+  const float x_429 = v;
+  param_6 = 6;
+  const int x_111 = search_i1_(param_6);
+  if ((x_429 < float(x_111))) {
+    return 1.0f;
+  }
+  param_7 = 30;
+  const int x_112 = search_i1_(param_7);
+  return (10.0f + float(x_112));
+}
+
+float3 hueColor_f1_(inout float angle) {
+  float nodeData = 0.0f;
+  int param_4 = 0;
+  param_4 = 15;
+  const int x_109 = search_i1_(param_4);
+  nodeData = float(x_109);
+  const float x_409 = angle;
+  return ((float3(30.0f, 30.0f, 30.0f) + (float3(1.0f, 5.0f, nodeData) * x_409)) / float3(50.0f, 50.0f, 50.0f));
+}
+
+void main_1() {
+  int treeIndex_1 = 0;
+  BST param_8 = (BST)0;
+  int param_9 = 0;
+  int param_10 = 0;
+  int param_11 = 0;
+  int GLF_live1_looplimiter2 = 0;
+  int GLF_live1i = 0;
+  int param_12 = 0;
+  int param_13 = 0;
+  int param_14 = 0;
+  int param_15 = 0;
+  int param_16 = 0;
+  int param_17 = 0;
+  int param_18 = 0;
+  int param_19 = 0;
+  int param_20 = 0;
+  int param_21 = 0;
+  int param_22 = 0;
+  int param_23 = 0;
+  int GLF_live4_looplimiter3 = 0;
+  int GLF_live4i = 0;
+  int GLF_live4index = 0;
+  Obj GLF_live4obj = (Obj)0;
+  int param_24 = 0;
+  int param_25 = 0;
+  int param_26 = 0;
+  int param_27 = 0;
+  float2 z = float2(0.0f, 0.0f);
+  float x_1 = 0.0f;
+  float param_28 = 0.0f;
+  float y_1 = 0.0f;
+  float param_29 = 0.0f;
+  int sum = 0;
+  int target_1 = 0;
+  int result = 0;
+  int param_30 = 0;
+  float a = 0.0f;
+  float3 x_235 = float3(0.0f, 0.0f, 0.0f);
+  float param_31 = 0.0f;
+  treeIndex_1 = 0;
+  const BST x_237 = tree_1[0];
+  param_8 = x_237;
+  param_9 = 9;
+  makeTreeNode_struct_BST_i1_i1_i11_i1_(param_8, param_9);
+  tree_1[0] = param_8;
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_10 = treeIndex_1;
+  param_11 = 5;
+  insert_i1_i1_(param_10, param_11);
+  treeIndex_1 = (treeIndex_1 + 1);
+  GLF_live1_looplimiter2 = 0;
+  GLF_live1i = 0;
+  {
+    [loop] for(; true; GLF_live1i = (GLF_live1i + 1)) {
+      if ((GLF_live1_looplimiter2 >= 7)) {
+        break;
+      }
+      GLF_live1_looplimiter2 = (GLF_live1_looplimiter2 + 1);
+    }
+  }
+  param_12 = treeIndex_1;
+  param_13 = 12;
+  insert_i1_i1_(param_12, param_13);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_14 = treeIndex_1;
+  param_15 = 15;
+  insert_i1_i1_(param_14, param_15);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_16 = treeIndex_1;
+  param_17 = 7;
+  insert_i1_i1_(param_16, param_17);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_18 = treeIndex_1;
+  param_19 = 8;
+  insert_i1_i1_(param_18, param_19);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_20 = treeIndex_1;
+  param_21 = 2;
+  insert_i1_i1_(param_20, param_21);
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_22 = treeIndex_1;
+  param_23 = 6;
+  insert_i1_i1_(param_22, param_23);
+  treeIndex_1 = (treeIndex_1 + 1);
+  GLF_live4_looplimiter3 = 0;
+  GLF_live4i = 0;
+  {
+    [loop] for(; true; GLF_live4i = (GLF_live4i + 1)) {
+      if ((GLF_live4_looplimiter3 >= 3)) {
+        break;
+      }
+      GLF_live4_looplimiter3 = (GLF_live4_looplimiter3 + 1);
+      GLF_live4index = 1;
+      const int x_144 = GLF_live4index;
+      const int x_145 = GLF_live4index;
+      const int x_146 = GLF_live4index;
+      const float x_269 = GLF_live4obj.even_numbers[1];
+      bool tint_tmp_1 = (x_144 >= 0);
+      if (tint_tmp_1) {
+        tint_tmp_1 = (x_145 < 10);
+      }
+      GLF_live4obj.even_numbers[((tint_tmp_1) ? x_146 : 0)] = x_269;
+      bool tint_tmp_2 = (GLF_live4i >= 0);
+      if (tint_tmp_2) {
+        tint_tmp_2 = (GLF_live4i < 10);
+      }
+      GLF_live4obj.even_numbers[((tint_tmp_2) ? GLF_live4i : 0)] = 1.0f;
+    }
+  }
+  param_24 = treeIndex_1;
+  param_25 = 17;
+  insert_i1_i1_(param_24, param_25);
+  const float x_278 = asfloat(x_27[0].x);
+  const float x_280 = asfloat(x_27[0].y);
+  if ((x_278 > x_280)) {
+    return;
+  }
+  treeIndex_1 = (treeIndex_1 + 1);
+  param_26 = treeIndex_1;
+  param_27 = 13;
+  insert_i1_i1_(param_26, param_27);
+  const float4 x_285 = gl_FragCoord;
+  z = (float2(x_285.y, x_285.x) / float2(256.0f, 256.0f));
+  const float x_289 = z.x;
+  param_28 = x_289;
+  const float x_290 = makeFrame_f1_(param_28);
+  x_1 = x_290;
+  const float x_292 = z.y;
+  param_29 = x_292;
+  const float x_293 = makeFrame_f1_(param_29);
+  y_1 = x_293;
+  sum = -100;
+  target_1 = 0;
+  {
+    [loop] for(; (target_1 < 20); target_1 = (target_1 + 1)) {
+      param_30 = target_1;
+      const int x_158 = search_i1_(param_30);
+      result = x_158;
+      if ((result > 0)) {
+      } else {
+        switch(result) {
+          case 0: {
+            return;
+            break;
+          }
+          case -1: {
+            sum = (sum + 1);
+            break;
+          }
+          default: {
+            break;
+          }
+        }
+      }
+    }
+  }
+  a = (x_1 + (y_1 * float(sum)));
+  const float x_313 = asfloat(x_27[0].x);
+  const float x_315 = asfloat(x_27[0].y);
+  if ((x_313 < x_315)) {
+    x_235 = float3(1.0f, 0.0f, 0.0f);
+  } else {
+    param_31 = a;
+    const float3 x_321 = hueColor_f1_(param_31);
+    x_235 = x_321;
+  }
+  const float3 x_322 = x_235;
+  x_GLF_color = float4(x_322.x, x_322.y, x_322.z, 1.0f);
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol_1 {
+  float4 gl_FragCoord_param : SV_Position;
+};
+struct tint_symbol_2 {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner(float4 gl_FragCoord_param) {
+  gl_FragCoord = gl_FragCoord_param;
+  main_1();
+  const main_out tint_symbol_4 = {x_GLF_color};
+  return tint_symbol_4;
+}
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+  const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
+  tint_symbol_2 wrapper_result = (tint_symbol_2)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001C987F87080(35,10-21): warning X3557: loop only executes for 0 iteration(s), consider removing [loop]
+C:\src\tint\test\Shader@0x000001C987F87080(282,7-64): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
+C:\src\tint\test\Shader@0x000001C987F87080(263,12-53): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.hlsl
new file mode 100644
index 0000000..8a1a43a
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.spvasm.expected.hlsl
@@ -0,0 +1,83 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int ll1 = 0;
+  int rows = 0;
+  int ll4 = 0;
+  int ll2 = 0;
+  int c = 0;
+  float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int ll3 = 0;
+  int d = 0;
+  int r = 0;
+  float sums[9] = (float[9])0;
+  int idx = 0;
+  m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f));
+  ll1 = 0;
+  rows = 2;
+  [loop] while (true) {
+    if (true) {
+    } else {
+      break;
+    }
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+    if ((ll1 >= 5)) {
+      break;
+    }
+    ll1 = (ll1 + 1);
+    ll4 = 10;
+    ll2 = 0;
+    c = 0;
+    {
+      [loop] for(; (c < 1); c = (c + 1)) {
+        if ((ll2 >= 0)) {
+          break;
+        }
+        ll2 = (ll2 + 1);
+        tempm43 = m43;
+        ll3 = 0;
+        d = 0;
+        {
+          [loop] for(; (1 < ll4); d = (d + 1)) {
+            set_float3(tempm43[(((d >= 0) & (d < 4)) ? d : 0)], (((r >= 0) & (r < 3)) ? r : 0), 1.0f);
+          }
+        }
+        const int x_111 = (((idx >= 0) & (idx < 9)) ? idx : 0);
+        const float x_113 = m43[c].y;
+        const float x_115 = sums[x_111];
+        sums[x_111] = (x_115 + x_113);
+      }
+    }
+    idx = (idx + 1);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x000001DA1CD04F80(46,18-46): error X3531: can't unroll loops marked with loop attribute
+
diff --git a/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.hlsl
new file mode 100644
index 0000000..caf9354
--- /dev/null
+++ b/test/vk-gl-cts/graphicsfuzz/write-red-in-loop-nest/0-opt.wgsl.expected.hlsl
@@ -0,0 +1,95 @@
+SKIP: FAILED
+
+void set_float3(inout float3 vec, int idx, float val) {
+  vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
+}
+
+static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+  float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int ll1 = 0;
+  int rows = 0;
+  int ll4 = 0;
+  int ll2 = 0;
+  int c = 0;
+  float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+  int ll3 = 0;
+  int d = 0;
+  int r = 0;
+  float sums[9] = (float[9])0;
+  int idx = 0;
+  m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f));
+  ll1 = 0;
+  rows = 2;
+  [loop] while (true) {
+    if (true) {
+    } else {
+      break;
+    }
+    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
+    if ((ll1 >= 5)) {
+      break;
+    }
+    ll1 = (ll1 + 1);
+    ll4 = 10;
+    ll2 = 0;
+    c = 0;
+    {
+      [loop] for(; (c < 1); c = (c + 1)) {
+        if ((ll2 >= 0)) {
+          break;
+        }
+        ll2 = (ll2 + 1);
+        tempm43 = m43;
+        ll3 = 0;
+        d = 0;
+        {
+          [loop] for(; (1 < ll4); d = (d + 1)) {
+            bool tint_tmp = (d >= 0);
+            if (tint_tmp) {
+              tint_tmp = (d < 4);
+            }
+            bool tint_tmp_1 = (r >= 0);
+            if (tint_tmp_1) {
+              tint_tmp_1 = (r < 3);
+            }
+            set_float3(tempm43[((tint_tmp) ? d : 0)], ((tint_tmp_1) ? r : 0), 1.0f);
+          }
+        }
+        bool tint_tmp_2 = (idx >= 0);
+        if (tint_tmp_2) {
+          tint_tmp_2 = (idx < 9);
+        }
+        const int x_111 = ((tint_tmp_2) ? idx : 0);
+        const float x_113 = m43[c].y;
+        const float x_115 = sums[x_111];
+        sums[x_111] = (x_115 + x_113);
+      }
+    }
+    idx = (idx + 1);
+  }
+  return;
+}
+
+struct main_out {
+  float4 x_GLF_color_1;
+};
+struct tint_symbol {
+  float4 x_GLF_color_1 : SV_Target0;
+};
+
+main_out main_inner() {
+  main_1();
+  const main_out tint_symbol_1 = {x_GLF_color};
+  return tint_symbol_1;
+}
+
+tint_symbol main() {
+  const main_out inner_result = main_inner();
+  tint_symbol wrapper_result = (tint_symbol)0;
+  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
+  return wrapper_result;
+}
+C:\src\tint\test\Shader@0x0000026405D97AD0(46,18-46): error X3531: can't unroll loops marked with loop attribute
+