From 760c399cfb1d541e5fb6ad1a7a72b715b8f09b9c Mon Sep 17 00:00:00 2001 From: David Neto Date: Wed, 6 Jul 2022 01:45:30 +0000 Subject: [PATCH] Delete tests with invalid SPIR-V inputs The structured CFG rule was revised/clarified in SPIR-V 1.6 Rev2 Validation now rejects a few cases. SpvParserTest, ValueFromBlockNotInBlockOrder SpvParserFunctionVarTest, EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored - Originally from crbug.com/tint/804 Invalid by SPIR-V 1.6 Rev2 update to validation rules: - Block 80 is a structurally reachable continue target - Block 25 is not structually reachable, and not part of the loop, but branches to 80. vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.* - The continue construct with the continue target 37[%37] is not structurally post dominated by the back-edge block 64[%64] - The SPIRV-Tools inliner no longer creates such cases. It splits the single-block loop and pushes the continue target down. vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm - The loop headed at block 46 does not structurally dominate its merge block 44. There is a continue-target edge from 41 to 44. SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm SpvParserCFGTest, ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader SpvParserCFGTest, EmitBody_Loop_MultiBlockContinueIsEntireLoop SpvParserCFGTest, LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue SpvParserCFGTest, SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop - Continue target 20 also its own loop header, but is not structurally post-dominated by the backedge block. - Delete the end-to-end test. - Keep the unit test because it's about classifying edges, but disable dumping into the end2end suites. Change-Id: I9ec2504aadd2fec9ea463901af7dc1b5f47481b5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95580 Kokoro: Kokoro Reviewed-by: Dan Sinclair Commit-Queue: David Neto --- src/tint/reader/spirv/function_cfg_test.cc | 17 ++ src/tint/reader/spirv/function_misc_test.cc | 45 ---- src/tint/reader/spirv/function_var_test.cc | 59 ----- ...kContinueConstruct_ContinueIsHeader.spvasm | 57 ----- ...Loop_MultiBlockContinueIsEntireLoop.spvasm | 57 ----- ...kContinueIsEntireLoop.spvasm.expected.hlsl | 29 --- ...cts_MultiBlockLoop_HeaderIsContinue.spvasm | 57 ----- ...truct_ContinueIsWholeMultiBlockLoop.spvasm | 53 ----- ...alueFromBlockNotInBlockOrderIgnored.spvasm | 63 ------ ...rTest_ValueFromBlockNotInBlockOrder.spvasm | 43 ---- .../0-opt.spvasm | 214 ------------------ .../0-opt.wgsl | 159 ------------- .../nested-for-loops-with-return/0-opt.spvasm | 86 ------- .../nested-for-loops-with-return/0-opt.wgsl | 42 ---- 14 files changed, 17 insertions(+), 964 deletions(-) delete mode 100644 test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm delete mode 100644 test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm delete mode 100644 test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl delete mode 100644 test/tint/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm delete mode 100644 test/tint/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm delete mode 100644 test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm delete mode 100644 test/tint/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm delete mode 100644 test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm delete mode 100644 test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl delete mode 100644 test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm delete mode 100644 test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl diff --git a/src/tint/reader/spirv/function_cfg_test.cc b/src/tint/reader/spirv/function_cfg_test.cc index edeea55271..efeeee8d27 100644 --- a/src/tint/reader/spirv/function_cfg_test.cc +++ b/src/tint/reader/spirv/function_cfg_test.cc @@ -3188,6 +3188,9 @@ TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_MultiBlockLoop_HeaderIsConti EXPECT_EQ(fe.GetBlockInfo(40)->construct, constructs[1].get()); EXPECT_EQ(fe.GetBlockInfo(50)->construct, constructs[1].get()); EXPECT_EQ(fe.GetBlockInfo(99)->construct, constructs[0].get()); + + // SPIR-V 1.6 Rev 2 made this invalid SPIR-V. + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserCFGTest, LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop) { @@ -4726,6 +4729,12 @@ TEST_F( ASSERT_NE(bi50, nullptr); EXPECT_EQ(bi50->succ_edge.count(20), 1u); EXPECT_EQ(bi50->succ_edge[20], EdgeKind::kBack); + + // SPIR-V 1.6 Rev 2 made this invalid SPIR-V. + // The continue target also has the LoopMerge in it, but the continue + // target 20 is not structurally post-dominated by the back-edge block 50. + // Don't dump this as an end-to-end test. + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserCFGTest, ClassifyCFGEdges_PrematureExitFromContinueConstruct) { @@ -8640,6 +8649,9 @@ var_1 = 3u; return; )"; ASSERT_EQ(expect, got); + + // Continue target does not structurally dominate the backedge block. + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserCFGTest, EmitBody_Loop_Never) { @@ -12608,6 +12620,11 @@ TEST_F(SpvParserCFGTest, SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop) { const Construct* c = fe.GetBlockInfo(20)->construct; EXPECT_EQ(c->kind, Construct::kContinue); EXPECT_EQ(fe.SiblingLoopConstruct(c), nullptr); + + // SPIR-V 1.6 Rev 2 made this invalid SPIR-V. + // Continue target is not structurally post dominated by the backedge block. + // Don't dump this as an end-to-end test. + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserCFGTest, SiblingLoopConstruct_HasSiblingLoop) { diff --git a/src/tint/reader/spirv/function_misc_test.cc b/src/tint/reader/spirv/function_misc_test.cc index 3f9c3985c6..5054c670bd 100644 --- a/src/tint/reader/spirv/function_misc_test.cc +++ b/src/tint/reader/spirv/function_misc_test.cc @@ -290,51 +290,6 @@ INSTANTIATE_TEST_SUITE_P(ValidIndex, {4, "", "vector component index is larger than 3: 4"}, {99999, "", "vector component index is larger than 3: 99999"}})); -TEST_F(SpvParserTest, ValueFromBlockNotInBlockOrder) { - // crbug.com/tint/804 - const auto assembly = Preamble() + CommonTypes() + R"( - %float_42 = OpConstant %float 42.0 - %cond = OpUndef %bool - - %100 = OpFunction %void None %voidfn - %10 = OpLabel - OpBranch %30 - - ; unreachable - %20 = OpLabel - %499 = OpFAdd %float %float_42 %float_42 - %500 = OpFAdd %float %499 %float_42 - OpBranch %25 - - %25 = OpLabel - OpBranch %80 - - - %30 = OpLabel - OpLoopMerge %90 %80 None - OpBranchConditional %cond %90 %40 - - %40 = OpLabel - OpBranch %90 - - %80 = OpLabel ; unreachable continue target - ; but "dominated" by %20 and %25 - %81 = OpFMul %float %500 %float_42 ; %500 is defined in %20 - OpBranch %30 ; backedge - - %90 = OpLabel - OpReturn - OpFunctionEnd -)"; - auto p = parser(test::Assemble(assembly)); - ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); - auto fe = p->function_emitter(100); - EXPECT_TRUE(fe.EmitBody()) << p->error(); - auto ast_body = fe.ast_body(); - const auto got = test::ToString(p->program(), ast_body); - EXPECT_THAT(got, HasSubstr("let x_81 : f32 = (0.0f * 42.0f);")); -} - // TODO(dneto): OpSizeof : requires Kernel (OpenCL) } // namespace diff --git a/src/tint/reader/spirv/function_var_test.cc b/src/tint/reader/spirv/function_var_test.cc index 6371234588..ff282990df 100644 --- a/src/tint/reader/spirv/function_var_test.cc +++ b/src/tint/reader/spirv/function_var_test.cc @@ -1418,65 +1418,6 @@ return; EXPECT_EQ(expect, got); } -TEST_F(SpvParserFunctionVarTest, EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored) { - // From crbug.com/tint/804 - const auto assembly = Preamble() + R"( - %float_42 = OpConstant %float 42.0 - %cond = OpUndef %bool - - %100 = OpFunction %void None %voidfn - %10 = OpLabel - OpBranch %30 - - ; unreachable - %20 = OpLabel - %499 = OpFAdd %float %float_42 %float_42 - %500 = OpFAdd %float %499 %float_42 - OpBranch %25 - - %25 = OpLabel - OpBranch %80 - - - %30 = OpLabel - OpLoopMerge %90 %80 None - OpBranchConditional %cond %90 %40 - - %40 = OpLabel - OpBranch %90 - - %80 = OpLabel ; unreachable continue target - ; but "dominated" by %20 and %25 - %81 = OpPhi %float %500 %25 - OpBranch %30 ; backedge - - %90 = OpLabel - OpReturn - OpFunctionEnd -)"; - auto p = parser(test::Assemble(assembly)); - ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly; - auto fe = p->function_emitter(100); - EXPECT_TRUE(fe.EmitBody()) << p->error(); - - const auto* expected = R"(loop { - if (false) { - break; - } - break; - - continuing { - var x_81_phi_1 : f32; - let x_81 : f32 = x_81_phi_1; - } -} -return; -)"; - auto ast_body = fe.ast_body(); - const auto got = test::ToString(p->program(), ast_body); - EXPECT_EQ(got, expected); -} - TEST_F(SpvParserFunctionVarTest, EmitStatement_Hoist_CompositeInsert) { // From crbug.com/tint/804 const auto assembly = Preamble() + R"( diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm b/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm deleted file mode 100644 index 52f74d5b73..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm +++ /dev/null @@ -1,57 +0,0 @@ -; Test: SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 1000 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -OpName %var "var" -%void = OpTypeVoid -%3 = OpTypeFunction %void -%bool = OpTypeBool -%5 = OpConstantNull %bool -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%uint_42 = OpConstant %uint 42 -%int_42 = OpConstant %int 42 -%13 = OpTypeFunction %uint -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%uint_6 = OpConstant %uint 6 -%uint_7 = OpConstant %uint 7 -%uint_8 = OpConstant %uint 8 -%uint_10 = OpConstant %uint 10 -%uint_20 = OpConstant %uint 20 -%uint_30 = OpConstant %uint 30 -%uint_40 = OpConstant %uint 40 -%uint_50 = OpConstant %uint 50 -%uint_90 = OpConstant %uint 90 -%uint_99 = OpConstant %uint 99 -%_ptr_Private_uint = OpTypePointer Private %uint -%var = OpVariable %_ptr_Private_uint Private -%uint_999 = OpConstant %uint 999 -%100 = OpFunction %void None %3 -%10 = OpLabel -OpBranch %20 -%20 = OpLabel -OpLoopMerge %99 %20 None -OpBranch %30 -%30 = OpLabel -OpBranch %40 -%40 = OpLabel -OpBranch %50 -%50 = OpLabel -OpBranchConditional %5 %20 %99 -%99 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm deleted file mode 100644 index 36d7fd68d2..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm +++ /dev/null @@ -1,57 +0,0 @@ -; Test: SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 1000 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -OpName %var "var" -%void = OpTypeVoid -%3 = OpTypeFunction %void -%bool = OpTypeBool -%5 = OpConstantNull %bool -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%uint_42 = OpConstant %uint 42 -%int_42 = OpConstant %int 42 -%13 = OpTypeFunction %uint -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%uint_6 = OpConstant %uint 6 -%uint_7 = OpConstant %uint 7 -%uint_8 = OpConstant %uint 8 -%uint_10 = OpConstant %uint 10 -%uint_20 = OpConstant %uint 20 -%uint_30 = OpConstant %uint 30 -%uint_40 = OpConstant %uint 40 -%uint_50 = OpConstant %uint 50 -%uint_90 = OpConstant %uint 90 -%uint_99 = OpConstant %uint 99 -%_ptr_Private_uint = OpTypePointer Private %uint -%var = OpVariable %_ptr_Private_uint Private -%uint_999 = OpConstant %uint 999 -%100 = OpFunction %void None %3 -%10 = OpLabel -OpStore %var %uint_0 -OpBranch %20 -%20 = OpLabel -OpStore %var %uint_1 -OpLoopMerge %99 %20 None -OpBranch %80 -%80 = OpLabel -OpStore %var %uint_2 -OpBranchConditional %5 %99 %20 -%99 = OpLabel -OpStore %var %uint_3 -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl b/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl deleted file mode 100644 index 4ffe39dbd3..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl +++ /dev/null @@ -1,29 +0,0 @@ -SKIP: FAILED - -static uint var_1 = 0u; - -void main_1() { - var_1 = 0u; - [loop] while (true) { - var_1 = 1u; - var_1 = 2u; - if (false) { - break; - } - } - var_1 = 3u; - return; -} - -void main() { - main_1(); - return; -} -warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. - -error: validation errors -/tmp/tint_cS4x46:16: error: Loop must have break. -Validation failed. - - - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm b/test/tint/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm deleted file mode 100644 index 762da210e7..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm +++ /dev/null @@ -1,57 +0,0 @@ -; Test: SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 1000 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -OpName %var "var" -%void = OpTypeVoid -%3 = OpTypeFunction %void -%bool = OpTypeBool -%5 = OpConstantNull %bool -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%uint_42 = OpConstant %uint 42 -%int_42 = OpConstant %int 42 -%13 = OpTypeFunction %uint -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%uint_6 = OpConstant %uint 6 -%uint_7 = OpConstant %uint 7 -%uint_8 = OpConstant %uint 8 -%uint_10 = OpConstant %uint 10 -%uint_20 = OpConstant %uint 20 -%uint_30 = OpConstant %uint 30 -%uint_40 = OpConstant %uint 40 -%uint_50 = OpConstant %uint 50 -%uint_90 = OpConstant %uint 90 -%uint_99 = OpConstant %uint 99 -%_ptr_Private_uint = OpTypePointer Private %uint -%var = OpVariable %_ptr_Private_uint Private -%uint_999 = OpConstant %uint 999 -%100 = OpFunction %void None %3 -%10 = OpLabel -OpBranch %20 -%20 = OpLabel -OpLoopMerge %99 %20 None -OpBranch %30 -%30 = OpLabel -OpBranch %40 -%40 = OpLabel -OpBranch %50 -%50 = OpLabel -OpBranchConditional %5 %20 %99 -%99 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm b/test/tint/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm deleted file mode 100644 index 00c32d6475..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm +++ /dev/null @@ -1,53 +0,0 @@ -; Test: SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 1000 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -OpName %var "var" -%void = OpTypeVoid -%3 = OpTypeFunction %void -%bool = OpTypeBool -%5 = OpConstantNull %bool -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%uint_42 = OpConstant %uint 42 -%int_42 = OpConstant %int 42 -%13 = OpTypeFunction %uint -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%uint_6 = OpConstant %uint 6 -%uint_7 = OpConstant %uint 7 -%uint_8 = OpConstant %uint 8 -%uint_10 = OpConstant %uint 10 -%uint_20 = OpConstant %uint 20 -%uint_30 = OpConstant %uint 30 -%uint_40 = OpConstant %uint 40 -%uint_50 = OpConstant %uint 50 -%uint_90 = OpConstant %uint 90 -%uint_99 = OpConstant %uint 99 -%_ptr_Private_uint = OpTypePointer Private %uint -%var = OpVariable %_ptr_Private_uint Private -%uint_999 = OpConstant %uint 999 -%100 = OpFunction %void None %3 -%10 = OpLabel -OpBranch %20 -%20 = OpLabel -OpLoopMerge %99 %20 None -OpBranch %30 -%30 = OpLabel -OpBranchConditional %5 %20 %99 -%99 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm b/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm deleted file mode 100644 index 300c05a9a4..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm +++ /dev/null @@ -1,63 +0,0 @@ -; Test: SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 501 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -%void = OpTypeVoid -%2 = OpTypeFunction %void -%bool = OpTypeBool -%float = OpTypeFloat 32 -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%_ptr_Function_bool = OpTypePointer Function %bool -%_ptr_Function_float = OpTypePointer Function %float -%_ptr_Function_uint = OpTypePointer Function %uint -%_ptr_Function_int = OpTypePointer Function %int -%true = OpConstantTrue %bool -%false = OpConstantFalse %bool -%float_0 = OpConstant %float 0 -%float_1_5 = OpConstant %float 1.5 -%uint_0 = OpConstant %uint 0 -%uint_1 = OpConstant %uint 1 -%int_n1 = OpConstant %int -1 -%int_0 = OpConstant %int 0 -%int_1 = OpConstant %int 1 -%int_3 = OpConstant %int 3 -%uint_2 = OpConstant %uint 2 -%uint_3 = OpConstant %uint 3 -%uint_4 = OpConstant %uint 4 -%uint_5 = OpConstant %uint 5 -%v2int = OpTypeVector %int 2 -%v2float = OpTypeVector %float 2 -%mat3v2float = OpTypeMatrix %v2float 3 -%32 = OpConstantNull %v2int -%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 -%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2 -%float_42 = OpConstant %float 42 -%36 = OpUndef %bool -%100 = OpFunction %void None %2 -%10 = OpLabel -OpBranch %30 -%20 = OpLabel -%499 = OpFAdd %float %float_42 %float_42 -%500 = OpFAdd %float %499 %float_42 -OpBranch %25 -%25 = OpLabel -OpBranch %80 -%30 = OpLabel -OpLoopMerge %90 %80 None -OpBranchConditional %36 %90 %40 -%40 = OpLabel -OpBranch %90 -%80 = OpLabel -%81 = OpPhi %float %500 %25 -OpBranch %30 -%90 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm b/test/tint/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm deleted file mode 100644 index 89d5db4e0a..0000000000 --- a/test/tint/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm +++ /dev/null @@ -1,43 +0,0 @@ -; Test: SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 501 -; Schema: 0 -OpCapability Shader -OpMemoryModel Logical Simple -OpEntryPoint Fragment %100 "main" -OpExecutionMode %100 OriginUpperLeft -%void = OpTypeVoid -%2 = OpTypeFunction %void -%bool = OpTypeBool -%uint = OpTypeInt 32 0 -%int = OpTypeInt 32 1 -%float = OpTypeFloat 32 -%v2bool = OpTypeVector %bool 2 -%v2uint = OpTypeVector %uint 2 -%v2int = OpTypeVector %int 2 -%v2float = OpTypeVector %float 2 -%float_42 = OpConstant %float 42 -%13 = OpUndef %bool -%100 = OpFunction %void None %2 -%10 = OpLabel -OpBranch %30 -%20 = OpLabel -%499 = OpFAdd %float %float_42 %float_42 -%500 = OpFAdd %float %499 %float_42 -OpBranch %25 -%25 = OpLabel -OpBranch %80 -%30 = OpLabel -OpLoopMerge %90 %80 None -OpBranchConditional %13 %90 %40 -%40 = OpLabel -OpBranch %90 -%80 = OpLabel -%81 = OpFMul %float %500 %float_42 -OpBranch %30 -%90 = OpLabel -OpReturn -OpFunctionEnd - diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm deleted file mode 100644 index 294733e908..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.spvasm +++ /dev/null @@ -1,214 +0,0 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %func_f1_ "func(f1;" - OpName %x "x" - OpName %a "a" - OpName %f "f" - OpName %i "i" - OpName %param "param" - OpName %param_0 "param" - OpName %_GLF_color "_GLF_color" - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %12 = OpTypeFunction %void - %float = OpTypeFloat 32 -%_ptr_Function_float = OpTypePointer Function %float - %15 = OpTypeFunction %float %_ptr_Function_float - %bool = OpTypeBool - %float_1 = OpConstant %float 1 - %float_0 = OpConstant %float 0 - %float_6 = OpConstant %float 6 - %float_5 = OpConstant %float 5 - %v4float = OpTypeVector %float 4 -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %23 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 - %false = OpConstantFalse %bool -%_ptr_Function_bool = OpTypePointer Function %bool - %true = OpConstantTrue %bool - %main = OpFunction %void None %12 - %28 = OpLabel - %29 = OpVariable %_ptr_Function_bool Function %false - %30 = OpVariable %_ptr_Function_float Function - %31 = OpVariable %_ptr_Function_float Function - %32 = OpVariable %_ptr_Function_float Function - %33 = OpVariable %_ptr_Function_bool Function %false - %34 = OpVariable %_ptr_Function_float Function - %35 = OpVariable %_ptr_Function_float Function - %36 = OpVariable %_ptr_Function_float Function - %f = OpVariable %_ptr_Function_float Function - %i = OpVariable %_ptr_Function_float Function - %param = OpVariable %_ptr_Function_float Function - %param_0 = OpVariable %_ptr_Function_float Function - OpStore %f %float_0 - OpStore %i %float_0 - OpBranch %37 - %37 = OpLabel - %38 = OpLoad %float %i - OpStore %param %38 - OpStore %33 %false - OpLoopMerge %39 %37 None - OpBranch %40 - %40 = OpLabel - %41 = OpLoad %float %param - OpStore %35 %41 - OpLoopMerge %42 %43 None - OpBranch %44 - %44 = OpLabel - OpLoopMerge %45 %46 None - OpBranch %47 - %47 = OpLabel - %48 = OpLoad %float %35 - %49 = OpLoad %float %param - %50 = OpFOrdEqual %bool %48 %49 - OpSelectionMerge %51 None - OpBranchConditional %50 %52 %51 - %52 = OpLabel - %53 = OpLoad %float %35 - OpStore %33 %true - OpStore %34 %53 - OpBranch %45 - %51 = OpLabel - %54 = OpLoad %float %35 - %55 = OpFAdd %float %54 %float_1 - OpStore %35 %55 - OpBranch %46 - %46 = OpLabel - %56 = OpLoad %float %35 - %57 = OpLoad %float %param - %58 = OpFOrdLessThan %bool %56 %57 - OpBranchConditional %58 %44 %45 - %45 = OpLabel - %59 = OpLoad %bool %33 - OpSelectionMerge %60 None - OpBranchConditional %59 %42 %60 - %60 = OpLabel - OpStore %33 %true - OpStore %34 %float_0 - OpBranch %42 - %43 = OpLabel - OpBranch %40 - %42 = OpLabel - %61 = OpLoad %float %34 - OpStore %36 %61 - OpStore %f %61 - OpStore %param_0 %float_1 - OpStore %29 %false - OpBranch %62 - %62 = OpLabel - %63 = OpLoad %float %param_0 - OpStore %31 %63 - OpLoopMerge %64 %65 None - OpBranch %66 - %66 = OpLabel - OpLoopMerge %67 %68 None - OpBranch %69 - %69 = OpLabel - %70 = OpLoad %float %31 - %71 = OpLoad %float %param_0 - %72 = OpFOrdEqual %bool %70 %71 - OpSelectionMerge %73 None - OpBranchConditional %72 %74 %73 - %74 = OpLabel - %75 = OpLoad %float %31 - OpStore %29 %true - OpStore %30 %75 - OpBranch %67 - %73 = OpLabel - %76 = OpLoad %float %31 - %77 = OpFAdd %float %76 %float_1 - OpStore %31 %77 - OpBranch %68 - %68 = OpLabel - %78 = OpLoad %float %31 - %79 = OpLoad %float %param_0 - %80 = OpFOrdLessThan %bool %78 %79 - OpBranchConditional %80 %66 %67 - %67 = OpLabel - %81 = OpLoad %bool %29 - OpSelectionMerge %82 None - OpBranchConditional %81 %64 %82 - %82 = OpLabel - OpStore %29 %true - OpStore %30 %float_0 - OpBranch %64 - %65 = OpLabel - OpBranch %62 - %64 = OpLabel - %83 = OpLoad %float %30 - OpStore %32 %83 - %84 = OpLoad %float %i - %85 = OpFAdd %float %84 %83 - OpStore %i %85 - %86 = OpFOrdLessThan %bool %85 %float_6 - OpBranchConditional %86 %37 %39 - %39 = OpLabel - %87 = OpLoad %float %f - %88 = OpFOrdEqual %bool %87 %float_5 - OpSelectionMerge %89 None - OpBranchConditional %88 %90 %91 - %90 = OpLabel - OpStore %_GLF_color %23 - OpBranch %89 - %91 = OpLabel - OpStore %_GLF_color %24 - OpBranch %89 - %89 = OpLabel - OpReturn - OpFunctionEnd - %func_f1_ = OpFunction %float None %15 - %x = OpFunctionParameter %_ptr_Function_float - %92 = OpLabel - %93 = OpVariable %_ptr_Function_bool Function %false - %94 = OpVariable %_ptr_Function_float Function - %a = OpVariable %_ptr_Function_float Function - OpBranch %95 - %95 = OpLabel - %96 = OpLoad %float %x - OpStore %a %96 - OpLoopMerge %97 %98 None - OpBranch %99 - %99 = OpLabel - OpLoopMerge %100 %101 None - OpBranch %102 - %102 = OpLabel - %103 = OpLoad %float %a - %104 = OpLoad %float %x - %105 = OpFOrdEqual %bool %103 %104 - OpSelectionMerge %106 None - OpBranchConditional %105 %107 %106 - %107 = OpLabel - %108 = OpLoad %float %a - OpStore %93 %true - OpStore %94 %108 - OpBranch %100 - %106 = OpLabel - %109 = OpLoad %float %a - %110 = OpFAdd %float %109 %float_1 - OpStore %a %110 - OpBranch %101 - %101 = OpLabel - %111 = OpLoad %float %a - %112 = OpLoad %float %x - %113 = OpFOrdLessThan %bool %111 %112 - OpBranchConditional %113 %99 %100 - %100 = OpLabel - %114 = OpLoad %bool %93 - OpSelectionMerge %115 None - OpBranchConditional %114 %97 %115 - %115 = OpLabel - OpStore %93 %true - OpStore %94 %float_0 - OpBranch %97 - %98 = OpLabel - OpBranch %95 - %97 = OpLabel - %116 = OpLoad %float %94 - OpReturnValue %116 - OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl deleted file mode 100644 index 2a6af9ca70..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.wgsl +++ /dev/null @@ -1,159 +0,0 @@ -var x_GLF_color : vec4; - -fn main_1() { - var x_29 : bool = false; - var x_30 : f32; - var x_31 : f32; - var x_32 : f32; - var x_33 : bool = false; - var x_34 : f32; - var x_35 : f32; - var x_36 : f32; - var f : f32; - var i : f32; - var param : f32; - var param_1 : f32; - f = 0.0; - i = 0.0; - loop { - let x_38 : f32 = i; - param = x_38; - x_33 = false; - loop { - let x_41 : f32 = param; - x_35 = x_41; - loop { - let x_48 : f32 = x_35; - let x_49 : f32 = param; - if ((x_48 == x_49)) { - let x_53 : f32 = x_35; - x_33 = true; - x_34 = x_53; - break; - } - let x_54 : f32 = x_35; - x_35 = (x_54 + 1.0); - - continuing { - let x_56 : f32 = x_35; - let x_57 : f32 = param; - if ((x_56 < x_57)) { - } else { - break; - } - } - } - let x_59 : bool = x_33; - if (x_59) { - break; - } - x_33 = true; - x_34 = 0.0; - break; - } - let x_61 : f32 = x_34; - x_36 = x_61; - f = x_61; - param_1 = 1.0; - x_29 = false; - loop { - let x_63 : f32 = param_1; - x_31 = x_63; - loop { - let x_70 : f32 = x_31; - let x_71 : f32 = param_1; - if ((x_70 == x_71)) { - let x_75 : f32 = x_31; - x_29 = true; - x_30 = x_75; - break; - } - let x_76 : f32 = x_31; - x_31 = (x_76 + 1.0); - - continuing { - let x_78 : f32 = x_31; - let x_79 : f32 = param_1; - if ((x_78 < x_79)) { - } else { - break; - } - } - } - let x_81 : bool = x_29; - if (x_81) { - break; - } - x_29 = true; - x_30 = 0.0; - break; - } - let x_83 : f32 = x_30; - x_32 = x_83; - let x_84 : f32 = i; - let x_85 : f32 = (x_84 + x_83); - i = x_85; - if ((x_85 < 6.0)) { - } else { - break; - } - } - let x_87 : f32 = f; - if ((x_87 == 5.0)) { - x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); - } else { - x_GLF_color = vec4(0.0, 0.0, 0.0, 0.0); - } - return; -} - -struct main_out { - @location(0) - x_GLF_color_1 : vec4, -} - -@fragment -fn main() -> main_out { - main_1(); - return main_out(x_GLF_color); -} - -fn func_f1_(x : ptr) -> f32 { - var x_93 : bool = false; - var x_94 : f32; - var a : f32; - loop { - let x_96 : f32 = *(x); - a = x_96; - loop { - let x_103 : f32 = a; - let x_104 : f32 = *(x); - if ((x_103 == x_104)) { - let x_108 : f32 = a; - x_93 = true; - x_94 = x_108; - break; - } - let x_109 : f32 = a; - a = (x_109 + 1.0); - - continuing { - let x_111 : f32 = a; - let x_112 : f32 = *(x); - if ((x_111 < x_112)) { - } else { - break; - } - } - } - let x_114 : bool = x_93; - if (x_114) { - break; - } - x_93 = true; - x_94 = 0.0; - break; - } - let x_116 : f32 = x_94; - return x_116; -} diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm b/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm deleted file mode 100644 index f854eb0011..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm +++ /dev/null @@ -1,86 +0,0 @@ - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color - OpExecutionMode %main OriginUpperLeft - OpSource ESSL 310 - OpName %main "main" - OpName %nb_mod_f1_ "nb_mod(f1;" - OpName %limit "limit" - OpName %_injected_loop_counter "_injected_loop_counter" - OpName %_injected_loop_counter_0 "_injected_loop_counter" - OpName %gl_FragCoord "gl_FragCoord" - OpName %param "param" - OpName %_GLF_color "_GLF_color" - OpDecorate %_injected_loop_counter RelaxedPrecision - OpDecorate %_injected_loop_counter_0 RelaxedPrecision - OpDecorate %gl_FragCoord BuiltIn FragCoord - OpDecorate %_GLF_color Location 0 - %void = OpTypeVoid - %11 = OpTypeFunction %void - %float = OpTypeFloat 32 -%_ptr_Function_float = OpTypePointer Function %float - %14 = OpTypeFunction %float %_ptr_Function_float - %float_1 = OpConstant %float 1 - %bool = OpTypeBool - %int = OpTypeInt 32 1 -%_ptr_Function_int = OpTypePointer Function %int - %int_0 = OpConstant %int 0 - %int_2 = OpConstant %int 2 - %int_1 = OpConstant %int 1 - %v4float = OpTypeVector %float 4 -%_ptr_Input_v4float = OpTypePointer Input %v4float -%gl_FragCoord = OpVariable %_ptr_Input_v4float Input - %uint = OpTypeInt 32 0 - %uint_0 = OpConstant %uint 0 -%_ptr_Input_float = OpTypePointer Input %float -%_ptr_Output_v4float = OpTypePointer Output %v4float - %_GLF_color = OpVariable %_ptr_Output_v4float Output - %float_0 = OpConstant %float 0 - %29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 - %30 = OpUndef %int - %true = OpConstantTrue %bool - %main = OpFunction %void None %11 - %32 = OpLabel - %param = OpVariable %_ptr_Function_float Function - %33 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 - %34 = OpLoad %float %33 - OpStore %param %34 - %35 = OpFunctionCall %float %nb_mod_f1_ %param - OpStore %_GLF_color %29 - OpReturn - OpFunctionEnd - %nb_mod_f1_ = OpFunction %float None %14 - %limit = OpFunctionParameter %_ptr_Function_float - %36 = OpLabel -%_injected_loop_counter = OpVariable %_ptr_Function_int Function -%_injected_loop_counter_0 = OpVariable %_ptr_Function_int Function - %37 = OpLoad %float %limit - %38 = OpFOrdGreaterThanEqual %bool %float_1 %37 - OpSelectionMerge %39 None - OpBranchConditional %38 %40 %39 - %40 = OpLabel - OpReturnValue %float_1 - %39 = OpLabel - OpStore %_injected_loop_counter %int_0 - OpBranch %41 - %41 = OpLabel - %42 = OpSLessThan %bool %int_0 %int_2 - OpLoopMerge %43 %44 None - OpBranch %45 - %45 = OpLabel - OpStore %_injected_loop_counter_0 %int_0 - OpBranch %46 - %46 = OpLabel - %47 = OpSLessThan %bool %int_0 %int_1 - OpLoopMerge %44 %48 None - OpBranch %49 - %49 = OpLabel - OpReturnValue %float_1 - %48 = OpLabel - OpBranch %46 - %44 = OpLabel - OpBranch %41 - %43 = OpLabel - OpUnreachable - OpFunctionEnd diff --git a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl b/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl deleted file mode 100644 index 93a0a9b360..0000000000 --- a/test/tint/vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.wgsl +++ /dev/null @@ -1,42 +0,0 @@ -var gl_FragCoord : vec4; - -var x_GLF_color : vec4; - -fn nb_mod_f1_(limit : ptr) -> f32 { - var x_injected_loop_counter : i32; - var x_injected_loop_counter_1 : i32; - let x_37 : f32 = *(limit); - if ((1.0 >= x_37)) { - return 1.0; - } - x_injected_loop_counter = 0; - loop { - let x_42 : bool = (0 < 2); - x_injected_loop_counter_1 = 0; - loop { - let x_47 : bool = (0 < 1); - return 1.0; - } - } -} - -fn main_1() { - var param : f32; - let x_34 : f32 = gl_FragCoord.x; - param = x_34; - let x_35 : f32 = nb_mod_f1_(&(param)); - x_GLF_color = vec4(1.0, 0.0, 0.0, 1.0); - return; -} - -struct main_out { - @location(0) - x_GLF_color_1 : vec4, -} - -@fragment -fn main(@builtin(position) gl_FragCoord_param : vec4) -> main_out { - gl_FragCoord = gl_FragCoord_param; - main_1(); - return main_out(x_GLF_color); -}