From 90d6b2d94fd0f681b56fe8ae67bc0f3a4fceae3e Mon Sep 17 00:00:00 2001 From: David Neto Date: Thu, 4 Jun 2020 15:26:31 +0000 Subject: [PATCH] [spirv-reader] Update test to show error is caught In this example, a branch escapes an if-selection. This is caught by ClassifyCFGEdges Bug: tint:3 Change-Id: I5586e8bb5f9de0cdf57ad46708fcee12cd31f6aa Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22600 Reviewed-by: dan sinclair --- src/reader/spirv/function_cfg_test.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/reader/spirv/function_cfg_test.cc b/src/reader/spirv/function_cfg_test.cc index 4a710508a3..02e434460e 100644 --- a/src/reader/spirv/function_cfg_test.cc +++ b/src/reader/spirv/function_cfg_test.cc @@ -4152,7 +4152,7 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_ManyValuesWithSameCase) { EXPECT_THAT(*(bi20->case_values.get()), UnorderedElementsAre(200, 300)); } -TEST_F(SpvParserTest, DISABLED_BranchEscapesIfConstruct) { +TEST_F(SpvParserTest, ClassifyCFGEdges_BranchEscapesIfConstruct) { auto assembly = CommonTypes() + R"( %100 = OpFunction %void None %voidfn @@ -4179,14 +4179,9 @@ TEST_F(SpvParserTest, DISABLED_BranchEscapesIfConstruct) { auto* p = parser(test::Assemble(assembly)); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); FunctionEmitter fe(p, *spirv_function(100)); - fe.RegisterBasicBlocks(); - fe.ComputeBlockOrderAndPositions(); - EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder()); - fe.RegisterMerges(); - fe.LabelControlFlowConstructs(); - fe.FindSwitchCaseHeaders(); + EXPECT_FALSE(FlowClassifyCFGEdges(&fe)) << p->error(); // Some further processing - EXPECT_THAT(p->error(), Eq("something")); + EXPECT_THAT(p->error(), Eq("Branch from block 30 to block 80 is an invalid exit from construct starting at block 20; branch bypasses merge block 50")); } TEST_F(SpvParserTest, ClassifyCFGEdges_ReturnInContinueConstruct) {