[spirv-reader] Update test to show error caught

This is the case where a block can't be a "continue block"
for more than one header.  It can only be a continue block for
the innermost loop it's inside of.

Bug: tint:3
Change-Id: Ic19ca544ab8a30cb1ff16d2c828abb260facba90
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22601
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto 2020-06-04 15:27:05 +00:00 committed by dan sinclair
parent 90d6b2d94f
commit 3bbc45ded3
1 changed files with 13 additions and 4 deletions

View File

@ -6714,10 +6714,10 @@ TEST_F(SpvParserTest, DISABLED_Codegen_IfBreak_FromElse_ForwardWithinElse) {
)";
}
TEST_F(SpvParserTest, DISABLED_BlockIsContinueForMoreThanOneHeader) {
// This is valid SPIR-V for Vulkan, but breaks my assumption that a block
// could only be a continue target for at most one header. Block 50
// is a single block loop but also the continue target for the outer loop.
TEST_F(SpvParserTest, BlockIsContinueForMoreThanOneHeader) {
// This is disallowed by the rule:
// "a continue block is valid only for the innermost loop it is nested
// inside of"
auto assembly = CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -6739,6 +6739,15 @@ TEST_F(SpvParserTest, DISABLED_BlockIsContinueForMoreThanOneHeader) {
OpReturn
OpFunctionEnd
)";
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());
EXPECT_FALSE(fe.RegisterMerges());
EXPECT_THAT(p->error(), Eq("Block 50 declared as continue target for more "
"than one header: 20, 50"));
}
TEST_F(SpvParserTest, EmitBody_If_Empty) {