writer/hlsl: Inline fallthrough case statements

FXC does not support fallthrough case statements (DXC does).

Fixed: tint:1082
Change-Id: I82e1add5455e438056259f773f34bf9db05970b4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60480
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc
index 1616e65..aa14cc1 100644
--- a/src/writer/hlsl/generator_impl.cc
+++ b/src/writer/hlsl/generator_impl.cc
@@ -58,15 +58,6 @@
 const char kTempNamePrefix[] = "tint_tmp";
 const char kSpecConstantPrefix[] = "WGSL_SPEC_CONSTANT_";
 
-bool last_is_break_or_fallthrough(const ast::BlockStatement* stmts) {
-  if (stmts->empty()) {
-    return false;
-  }
-
-  return stmts->last()->Is<ast::BreakStatement>() ||
-         stmts->last()->Is<ast::FallthroughStatement>();
-}
-
 const char* image_format_to_rwtexture_type(ast::ImageFormat image_format) {
   switch (image_format) {
     case ast::ImageFormat::kRgba8Unorm:
@@ -2019,7 +2010,8 @@
   return "";
 }
 
-bool GeneratorImpl::EmitCase(ast::CaseStatement* stmt) {
+bool GeneratorImpl::EmitCase(ast::SwitchStatement* s, size_t case_idx) {
+  auto* stmt = s->body()[case_idx];
   if (stmt->IsDefault()) {
     line() << "default: {";
   } else {
@@ -2036,17 +2028,32 @@
     }
   }
 
-  {
-    ScopedIndent si(this);
-    if (!EmitStatements(stmt->body()->statements())) {
+  increment_indent();
+  TINT_DEFER({
+    decrement_indent();
+    line() << "}";
+  });
+
+  // Emit the case statement
+  if (!EmitStatements(stmt->body()->statements())) {
+    return false;
+  }
+
+  // Inline all fallthrough case statements. FXC cannot handle fallthroughs.
+  while (tint::Is<ast::FallthroughStatement>(stmt->body()->last())) {
+    case_idx++;
+    stmt = s->body()[case_idx];
+    // Generate each fallthrough case statement in a new block. This is done to
+    // prevent symbol collision of variables declared in these cases statements.
+    if (!EmitBlock(stmt->body())) {
       return false;
     }
-    if (!last_is_break_or_fallthrough(stmt->body())) {
-      line() << "break;";
-    }
   }
 
-  line() << "}";
+  if (!tint::IsAnyOf<ast::BreakStatement, ast::FallthroughStatement>(
+          stmt->body()->last())) {
+    line() << "break;";
+  }
 
   return true;
 }
@@ -2900,8 +2907,8 @@
 
   {
     ScopedIndent si(this);
-    for (auto* s : stmt->body()) {
-      if (!EmitCase(s)) {
+    for (size_t i = 0; i < stmt->body().size(); i++) {
+      if (!EmitCase(stmt, i)) {
         return false;
       }
     }
diff --git a/src/writer/hlsl/generator_impl.h b/src/writer/hlsl/generator_impl.h
index 8874b2d..7ec64ff 100644
--- a/src/writer/hlsl/generator_impl.h
+++ b/src/writer/hlsl/generator_impl.h
@@ -196,9 +196,10 @@
                              ast::CallExpression* expr,
                              const sem::Intrinsic* intrinsic);
   /// Handles a case statement
-  /// @param stmt the statement
+  /// @param s the switch statement
+  /// @param case_idx the index of the switch case in the switch statement
   /// @returns true if the statement was emitted successfully
-  bool EmitCase(ast::CaseStatement* stmt);
+  bool EmitCase(ast::SwitchStatement* s, size_t case_idx);
   /// Handles generating constructor expressions
   /// @param out the output of the expression stream
   /// @param expr the constructor expression
diff --git a/src/writer/hlsl/generator_impl_case_test.cc b/src/writer/hlsl/generator_impl_case_test.cc
index 6ecd755..7fe6e31 100644
--- a/src/writer/hlsl/generator_impl_case_test.cc
+++ b/src/writer/hlsl/generator_impl_case_test.cc
@@ -31,7 +31,7 @@
 
   gen.increment_indent();
 
-  ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error();
+  ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error();
   EXPECT_EQ(gen.result(), R"(  case 5: {
     break;
   }
@@ -46,7 +46,7 @@
 
   gen.increment_indent();
 
-  ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error();
+  ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error();
   EXPECT_EQ(gen.result(), R"(  case 5: {
     break;
   }
@@ -55,7 +55,9 @@
 
 TEST_F(HlslGeneratorImplTest_Case, Emit_Case_WithFallthrough) {
   auto* s =
-      Switch(1, Case(Literal(5), Block(create<ast::FallthroughStatement>())),
+      Switch(1,                                                             //
+             Case(Literal(4), Block(create<ast::FallthroughStatement>())),  //
+             Case(Literal(5), Block(create<ast::ReturnStatement>())),       //
              DefaultCase());
   WrapInFunction(s);
 
@@ -63,9 +65,13 @@
 
   gen.increment_indent();
 
-  ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error();
-  EXPECT_EQ(gen.result(), R"(  case 5: {
+  ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error();
+  EXPECT_EQ(gen.result(), R"(  case 4: {
     /* fallthrough */
+    {
+      return;
+    }
+    break;
   }
 )");
 }
@@ -80,7 +86,7 @@
 
   gen.increment_indent();
 
-  ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error();
+  ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error();
   EXPECT_EQ(gen.result(), R"(  case 5:
   case 6: {
     break;
@@ -96,7 +102,7 @@
 
   gen.increment_indent();
 
-  ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error();
+  ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error();
   EXPECT_EQ(gen.result(), R"(  default: {
     break;
   }
diff --git a/test/switch/fallthrough.wgsl.expected.hlsl b/test/switch/fallthrough.wgsl.expected.hlsl
index 21a359b..dc4b920 100644
--- a/test/switch/fallthrough.wgsl.expected.hlsl
+++ b/test/switch/fallthrough.wgsl.expected.hlsl
@@ -1,11 +1,12 @@
-SKIP: FAILED
-
 [numthreads(1, 1, 1)]
 void f() {
   int i = 0;
   switch(i) {
     case 0: {
       /* fallthrough */
+      {
+        break;
+      }
     }
     default: {
       break;
@@ -13,5 +14,3 @@
   }
   return;
 }
-C:\src\tint\test\Shader@0x000001AF1A4F6940(5,5): error X3533: non-empty case statements must have break or return
-
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl
index 7abd8f9..4db0e46 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl
@@ -4,6 +4,9 @@
   switch(42u) {
     case 20u: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 40u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl
index bd88cfc..debf902 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl
@@ -4,6 +4,9 @@
   switch(42u) {
     case 20u: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     default: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl
index bb3c3e0..9513a68 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl
@@ -4,6 +4,9 @@
   switch(42u) {
     default: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 40u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl
index b6dc560..2c99195 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl
@@ -10,6 +10,13 @@
     }
     default: {
       /* fallthrough */
+      {
+        if (false) {
+        } else {
+          break;
+        }
+      }
+      break;
     }
     case 50u: {
       if (false) {
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl
index bf4b8f3..7f1c3f1 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl
@@ -9,9 +9,22 @@
         break;
       }
       /* fallthrough */
+      {
+        /* fallthrough */
+      }
+      {
+        if (false) {
+        }
+      }
+      break;
     }
     default: {
       /* fallthrough */
+      {
+        if (false) {
+        }
+      }
+      break;
     }
     case 50u: {
       if (false) {
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl
index 9bc5b7f..58535aa 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl
@@ -9,6 +9,11 @@
     }
     default: {
       /* fallthrough */
+      {
+        if (false) {
+        }
+      }
+      break;
     }
     case 50u: {
       if (false) {
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl
index 790a128..2577571 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl
@@ -4,12 +4,18 @@
   switch(42u) {
     case 30u: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 50u: {
       break;
     }
     case 20u: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 40u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl
index 1d87573..1f6f81b 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl
@@ -4,9 +4,18 @@
   switch(42u) {
     case 20u: {
       /* fallthrough */
+      {
+        /* fallthrough */
+      }
+      {
+      }
+      break;
     }
     default: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 30u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl
index 1a011d0..945e968 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl
@@ -7,9 +7,18 @@
     }
     default: {
       /* fallthrough */
+      {
+        /* fallthrough */
+      }
+      {
+      }
+      break;
     }
     case 30u: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 40u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl
index 790a128..2577571 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl
@@ -4,12 +4,18 @@
   switch(42u) {
     case 30u: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 50u: {
       break;
     }
     case 20u: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 40u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl
index 3e5b1e2..07fe5eb 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl
@@ -10,6 +10,9 @@
     }
     default: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 30u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl
index e0369bc..1a65f4d 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl
@@ -6,6 +6,10 @@
     case 20u: {
       var_1 = 20u;
       /* fallthrough */
+      {
+        var_1 = 30u;
+      }
+      break;
     }
     case 30u: {
       var_1 = 30u;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl
index 6096ec8..e91d419 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl
@@ -9,6 +9,10 @@
         break;
       }
       /* fallthrough */
+      {
+        var_1 = 30u;
+      }
+      break;
     }
     case 30u: {
       var_1 = 30u;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl
index 9233203..046b1e6 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl
@@ -10,6 +10,10 @@
         break;
       }
       /* fallthrough */
+      {
+        var_1 = 30u;
+      }
+      break;
     }
     case 30u: {
       var_1 = 30u;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl
index e0369bc..1a65f4d 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl
@@ -6,6 +6,10 @@
     case 20u: {
       var_1 = 20u;
       /* fallthrough */
+      {
+        var_1 = 30u;
+      }
+      break;
     }
     case 30u: {
       var_1 = 30u;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl
index 41e966a..66c5986 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl
@@ -13,6 +13,10 @@
     }
     default: {
       /* fallthrough */
+      {
+        var_1 = 30u;
+      }
+      break;
     }
     case 30u: {
       var_1 = 30u;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl
index a018399..f8e1ca9 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl
@@ -4,6 +4,9 @@
   switch(42u) {
     default: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 200u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl
index 08cf13f..05eab6e 100644
--- a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl
@@ -4,6 +4,9 @@
   switch(42u) {
     case 20u: {
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 30u: {
       break;
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl
index 8d07dd4..a9c80ae 100644
--- a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl
@@ -7,9 +7,30 @@
   switch(1u) {
     default: {
       /* fallthrough */
+      {
+        /* fallthrough */
+      }
+      {
+        if (true) {
+        } else {
+          x_41_phi = 0u;
+          break;
+        }
+        x_41_phi = 1u;
+      }
+      break;
     }
     case 0u: {
       /* fallthrough */
+      {
+        if (true) {
+        } else {
+          x_41_phi = 0u;
+          break;
+        }
+        x_41_phi = 1u;
+      }
+      break;
     }
     case 1u: {
       if (true) {
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 4ab54a0..336b952 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: FAILED
+SKIP: https://github.com/microsoft/DirectXShaderCompiler/issues/3894
 
 static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
 static float array0[3] = (float[3])0;
@@ -31,6 +31,11 @@
           }
           array0[c] = 1.0f;
           /* fallthrough */
+          {
+            array1[0] = 1.0f;
+            array1[c] = 1.0f;
+          }
+          break;
         }
         case 61: {
           array1[0] = 1.0f;
@@ -72,13 +77,3 @@
   const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
   return tint_symbol_5;
 }
-C:\src\tint\test\Shader@0x0000019491823870(15,8-20): warning X3556: integer modulus may be much slower, try using uints if possible.
-C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000019491823870(23,9): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-
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 1a4ffc5..336b952 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: FAILED
+SKIP: https://github.com/microsoft/DirectXShaderCompiler/issues/3894
 
 static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
 static float array0[3] = (float[3])0;
@@ -31,6 +31,11 @@
           }
           array0[c] = 1.0f;
           /* fallthrough */
+          {
+            array1[0] = 1.0f;
+            array1[c] = 1.0f;
+          }
+          break;
         }
         case 61: {
           array1[0] = 1.0f;
@@ -72,13 +77,3 @@
   const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
   return tint_symbol_5;
 }
-C:\src\tint\test\Shader@0x0000026803D7D2F0(15,8-20): warning X3556: integer modulus may be much slower, try using uints if possible.
-C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-C:\src\tint\test\Shader@0x0000026803D7D2F0(23,9): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl
index edf514e..01a9ed0 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[5];
 };
@@ -27,6 +25,10 @@
       case 1: {
         count0 = (count0 + 1);
         /* fallthrough */
+        {
+          count1 = (count1 + 1);
+        }
+        break;
       }
       case 2:
       case 3: {
@@ -78,6 +80,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x000001CD53C8DD00(24,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000001CD53C8DD00(28,7): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl
index cea07e1..01a9ed0 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[5];
 };
@@ -27,6 +25,10 @@
       case 1: {
         count0 = (count0 + 1);
         /* fallthrough */
+        {
+          count1 = (count1 + 1);
+        }
+        break;
       }
       case 2:
       case 3: {
@@ -78,6 +80,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x000001A41A83AF00(24,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000001A41A83AF00(28,7): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl
index f8db992..d153ad0 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl
@@ -17,19 +17,52 @@
         return;
       }
       /* fallthrough */
+      {
+        if (true) {
+          const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+          const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+          const int x_43 = asint(x_6[1].x);
+          const int x_46 = asint(x_6[1].x);
+          const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+          const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+          x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49));
+          if (false) {
+            const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+            const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+            const float x_56 = float(x_55);
+            x_GLF_color = float4(x_56, x_56, x_56, x_56);
+            while (true) {
+              x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
+              if (false) {
+                return;
+              }
+              if (true) {
+                return;
+              }
+              {
+                if ((x_GLF_global_loop_count < 100)) {
+                } else {
+                  break;
+                }
+              }
+            }
+          }
+        }
+      }
+      break;
     }
     case 1: {
       if (true) {
-        const uint scalar_offset_1 = ((16u * uint(0))) / 4;
-        const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+        const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+        const int x_40 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
         const int x_43 = asint(x_6[1].x);
         const int x_46 = asint(x_6[1].x);
-        const uint scalar_offset_2 = ((16u * uint(0))) / 4;
-        const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+        const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+        const int x_49 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]);
         x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49));
         if (false) {
-          const uint scalar_offset_3 = ((16u * uint(0))) / 4;
-          const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+          const uint scalar_offset_6 = ((16u * uint(0))) / 4;
+          const int x_55 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]);
           const float x_56 = float(x_55);
           x_GLF_color = float4(x_56, x_56, x_56, x_56);
           while (true) {
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl
index f8db992..d153ad0 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl
@@ -17,19 +17,52 @@
         return;
       }
       /* fallthrough */
+      {
+        if (true) {
+          const uint scalar_offset_1 = ((16u * uint(0))) / 4;
+          const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+          const int x_43 = asint(x_6[1].x);
+          const int x_46 = asint(x_6[1].x);
+          const uint scalar_offset_2 = ((16u * uint(0))) / 4;
+          const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+          x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49));
+          if (false) {
+            const uint scalar_offset_3 = ((16u * uint(0))) / 4;
+            const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+            const float x_56 = float(x_55);
+            x_GLF_color = float4(x_56, x_56, x_56, x_56);
+            while (true) {
+              x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
+              if (false) {
+                return;
+              }
+              if (true) {
+                return;
+              }
+              {
+                if ((x_GLF_global_loop_count < 100)) {
+                } else {
+                  break;
+                }
+              }
+            }
+          }
+        }
+      }
+      break;
     }
     case 1: {
       if (true) {
-        const uint scalar_offset_1 = ((16u * uint(0))) / 4;
-        const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
+        const uint scalar_offset_4 = ((16u * uint(0))) / 4;
+        const int x_40 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
         const int x_43 = asint(x_6[1].x);
         const int x_46 = asint(x_6[1].x);
-        const uint scalar_offset_2 = ((16u * uint(0))) / 4;
-        const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
+        const uint scalar_offset_5 = ((16u * uint(0))) / 4;
+        const int x_49 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]);
         x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49));
         if (false) {
-          const uint scalar_offset_3 = ((16u * uint(0))) / 4;
-          const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
+          const uint scalar_offset_6 = ((16u * uint(0))) / 4;
+          const int x_55 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]);
           const float x_56 = float(x_55);
           x_GLF_color = float4(x_56, x_56, x_56, x_56);
           while (true) {
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl
index cb6868a..47c3b72 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
 };
@@ -31,9 +29,20 @@
         const float4 x_43 = func_();
         x_GLF_color = x_43;
         /* fallthrough */
+        {
+          /* fallthrough */
+        }
+        {
+          x_GLF_color.y = 0.0f;
+        }
+        break;
       }
       default: {
         /* fallthrough */
+        {
+          x_GLF_color.y = 0.0f;
+        }
+        break;
       }
       case 0: {
         x_GLF_color.y = 0.0f;
@@ -60,8 +69,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x00000183AD3AB240(28,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x00000183AD3AB240(33,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x00000183AD3AB240(32,7): error X3537: Fall-throughs in switch statements are not allowed.
-C:\src\tint\test\Shader@0x00000183AD3AB240(35,7): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl
index e4348c5..47c3b72 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
 };
@@ -31,9 +29,20 @@
         const float4 x_43 = func_();
         x_GLF_color = x_43;
         /* fallthrough */
+        {
+          /* fallthrough */
+        }
+        {
+          x_GLF_color.y = 0.0f;
+        }
+        break;
       }
       default: {
         /* fallthrough */
+        {
+          x_GLF_color.y = 0.0f;
+        }
+        break;
       }
       case 0: {
         x_GLF_color.y = 0.0f;
@@ -60,8 +69,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x0000021C30D8F880(28,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x0000021C30D8F880(33,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x0000021C30D8F880(32,7): error X3537: Fall-throughs in switch statements are not allowed.
-C:\src\tint\test\Shader@0x0000021C30D8F880(35,7): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl
index 80249a8..6b8df2b 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
 };
@@ -14,6 +12,9 @@
     case 3: {
       a = 1;
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 4: {
       break;
@@ -44,6 +45,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x0000025EFE826FC0(11,5): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x0000025EFE826FC0(15,5): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl
index d7b3211..6b8df2b 100644
--- a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
 };
@@ -14,6 +12,9 @@
     case 3: {
       a = 1;
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 4: {
       break;
@@ -44,6 +45,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x000001FDE7828C30(11,5): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000001FDE7828C30(15,5): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl
index 06a8495..9cdb063 100644
--- a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
 };
@@ -21,6 +19,11 @@
       case 0: {
         x_43_phi = 1.0f;
         /* fallthrough */
+        {
+          data[x_39] = x_43_phi;
+          x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+        }
+        break;
       }
       case 1: {
         data[x_39] = x_43_phi;
@@ -48,6 +51,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x0000027AB59F7F40(19,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x0000027AB59F7F40(22,7): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl
index 0910790..9cdb063 100644
--- a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
 };
@@ -21,6 +19,11 @@
       case 0: {
         x_43_phi = 1.0f;
         /* fallthrough */
+        {
+          data[x_39] = x_43_phi;
+          x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
+        }
+        break;
       }
       case 1: {
         data[x_39] = x_43_phi;
@@ -48,6 +51,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x0000020777179050(19,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x0000020777179050(22,7): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl
index 75f1ec9..17a9f12 100644
--- a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
@@ -26,6 +24,9 @@
         }
       }
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 42: {
       break;
@@ -55,6 +56,3 @@
   const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
   return tint_symbol_5;
 }
-C:\src\tint\test\Shader@0x000001A268ED57F0(11,5): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000001A268ED57F0(27,5): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl
index 734bbd1..17a9f12 100644
--- a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
@@ -26,6 +24,9 @@
         }
       }
       /* fallthrough */
+      {
+      }
+      break;
     }
     case 42: {
       break;
@@ -55,6 +56,3 @@
   const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
   return tint_symbol_5;
 }
-C:\src\tint\test\Shader@0x00000267DEB27120(11,5): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x00000267DEB27120(27,5): error X3537: Fall-throughs in switch statements are not allowed.
-
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
index a432855..5c6be43 100644
--- 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
@@ -45,6 +45,10 @@
         break;
       }
       /* fallthrough */
+      {
+        i = (i - 3);
+      }
+      break;
     }
     default: {
       i = (i - 3);
@@ -72,6 +76,5 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x00000259291CFD70(11,5): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x00000259291CFD70(26,13-21): error X3708: continue cannot be used in a switch
+O:\src\chrome\src\third_party\dawn\third_party\tint\test\Shader@0x0000028C1CDAABD0(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
index 17e7f25..5f8be8e 100644
--- 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
@@ -45,6 +45,10 @@
         break;
       }
       /* fallthrough */
+      {
+        i = (i - 3);
+      }
+      break;
     }
     default: {
       i = (i - 3);
@@ -72,6 +76,5 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x000001E28E944DC0(11,5): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000001E28E944DC0(26,13-21): error X3708: continue cannot be used in a switch
+O:\src\chrome\src\third_party\dawn\third_party\tint\test\Shader@0x0000015D2C356900(26,13-21): error X3708: continue cannot be used in a switch
 
diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl
index 70d1d9c..2e3da9b 100644
--- a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
 };
@@ -31,15 +29,48 @@
         y = x_54;
         x_55_phi = x_54;
         /* fallthrough */
+        {
+          const float x_47 = clamp(1.0f, 0.5f, x_55_phi);
+          y = x_47;
+          x_46_phi = x_47;
+          /* fallthrough */
+        }
+        {
+          /* fallthrough */
+        }
+        {
+          if ((x_46_phi == 1.0f)) {
+            x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f);
+            return;
+          }
+        }
+        break;
       }
       case 1: {
         const float x_47 = clamp(1.0f, 0.5f, x_55_phi);
         y = x_47;
         x_46_phi = x_47;
         /* fallthrough */
+        {
+          /* fallthrough */
+        }
+        {
+          if ((x_46_phi == 1.0f)) {
+            x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f);
+            return;
+          }
+        }
+        break;
       }
       default: {
         /* fallthrough */
+        {
+          if ((x_46_phi == 1.0f)) {
+            x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f);
+            return;
+          }
+        }
+        break;
       }
       case 2: {
         if ((x_46_phi == 1.0f)) {
@@ -71,10 +102,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x000002EAE8878270(27,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000002EAE8878270(33,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000002EAE8878270(39,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000002EAE8878270(32,7): error X3537: Fall-throughs in switch statements are not allowed.
-C:\src\tint\test\Shader@0x000002EAE8878270(38,7): error X3537: Fall-throughs in switch statements are not allowed.
-C:\src\tint\test\Shader@0x000002EAE8878270(41,7): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl
index dbcd029..2e3da9b 100644
--- a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 cbuffer cbuffer_x_6 : register(b0, space0) {
   uint4 x_6[1];
 };
@@ -31,15 +29,48 @@
         y = x_54;
         x_55_phi = x_54;
         /* fallthrough */
+        {
+          const float x_47 = clamp(1.0f, 0.5f, x_55_phi);
+          y = x_47;
+          x_46_phi = x_47;
+          /* fallthrough */
+        }
+        {
+          /* fallthrough */
+        }
+        {
+          if ((x_46_phi == 1.0f)) {
+            x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f);
+            return;
+          }
+        }
+        break;
       }
       case 1: {
         const float x_47 = clamp(1.0f, 0.5f, x_55_phi);
         y = x_47;
         x_46_phi = x_47;
         /* fallthrough */
+        {
+          /* fallthrough */
+        }
+        {
+          if ((x_46_phi == 1.0f)) {
+            x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f);
+            return;
+          }
+        }
+        break;
       }
       default: {
         /* fallthrough */
+        {
+          if ((x_46_phi == 1.0f)) {
+            x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f);
+            return;
+          }
+        }
+        break;
       }
       case 2: {
         if ((x_46_phi == 1.0f)) {
@@ -71,10 +102,3 @@
   const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
   return tint_symbol_3;
 }
-C:\src\tint\test\Shader@0x000001B3F8915FF0(27,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000001B3F8915FF0(33,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000001B3F8915FF0(39,7): error X3533: non-empty case statements must have break or return
-C:\src\tint\test\Shader@0x000001B3F8915FF0(32,7): error X3537: Fall-throughs in switch statements are not allowed.
-C:\src\tint\test\Shader@0x000001B3F8915FF0(38,7): error X3537: Fall-throughs in switch statements are not allowed.
-C:\src\tint\test\Shader@0x000001B3F8915FF0(41,7): error X3537: Fall-throughs in switch statements are not allowed.
-
diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl
index 49336f5..e10a3b8 100644
--- a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl
@@ -25,6 +25,10 @@
             while (true) {
             }
             /* fallthrough */
+            {
+              data[0] = 2.0f;
+            }
+            break;
           }
           case 0: {
             data[0] = 2.0f;
diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl
index 49336f5..e10a3b8 100644
--- a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl
+++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl
@@ -25,6 +25,10 @@
             while (true) {
             }
             /* fallthrough */
+            {
+              data[0] = 2.0f;
+            }
+            break;
           }
           case 0: {
             data[0] = 2.0f;