[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 <dsinclair@google.com>
This commit is contained in:
David Neto 2020-06-04 15:26:31 +00:00 committed by dan sinclair
parent 7d60a4c544
commit 90d6b2d94f
1 changed files with 3 additions and 8 deletions

View File

@ -4152,7 +4152,7 @@ TEST_F(SpvParserTest, FindSwitchCaseHeaders_ManyValuesWithSameCase) {
EXPECT_THAT(*(bi20->case_values.get()), UnorderedElementsAre(200, 300)); EXPECT_THAT(*(bi20->case_values.get()), UnorderedElementsAre(200, 300));
} }
TEST_F(SpvParserTest, DISABLED_BranchEscapesIfConstruct) { TEST_F(SpvParserTest, ClassifyCFGEdges_BranchEscapesIfConstruct) {
auto assembly = CommonTypes() + R"( auto assembly = CommonTypes() + R"(
%100 = OpFunction %void None %voidfn %100 = OpFunction %void None %voidfn
@ -4179,14 +4179,9 @@ TEST_F(SpvParserTest, DISABLED_BranchEscapesIfConstruct) {
auto* p = parser(test::Assemble(assembly)); auto* p = parser(test::Assemble(assembly));
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error(); ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks(); EXPECT_FALSE(FlowClassifyCFGEdges(&fe)) << p->error();
fe.ComputeBlockOrderAndPositions();
EXPECT_TRUE(fe.VerifyHeaderContinueMergeOrder());
fe.RegisterMerges();
fe.LabelControlFlowConstructs();
fe.FindSwitchCaseHeaders();
// Some further processing // 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) { TEST_F(SpvParserTest, ClassifyCFGEdges_ReturnInContinueConstruct) {