mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-26 21:30:07 +00:00
parent
cd1d3b6e0c
commit
5d7893b376
@ -117,7 +117,7 @@ void TransformationReplaceBranchFromDeadBlockWithExit::Apply(
|
|||||||
opt::Instruction::OperandList new_terminator_in_operands;
|
opt::Instruction::OperandList new_terminator_in_operands;
|
||||||
if (message_.opcode() == SpvOpReturnValue) {
|
if (message_.opcode() == SpvOpReturnValue) {
|
||||||
new_terminator_in_operands.push_back(
|
new_terminator_in_operands.push_back(
|
||||||
{SPV_OPERAND_TYPE_TYPE_ID, {message_.return_value_id()}});
|
{SPV_OPERAND_TYPE_ID, {message_.return_value_id()}});
|
||||||
}
|
}
|
||||||
auto terminator = block->terminator();
|
auto terminator = block->terminator();
|
||||||
terminator->SetOpcode(static_cast<SpvOp>(message_.opcode()));
|
terminator->SetOpcode(static_cast<SpvOp>(message_.opcode()));
|
||||||
|
@ -337,6 +337,12 @@ TEST(TransformationReplaceBranchFromDeadBlockWithExitTest,
|
|||||||
ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
|
ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
|
||||||
kConsoleMessageConsumer));
|
kConsoleMessageConsumer));
|
||||||
|
|
||||||
|
opt::Instruction* return_value_inst =
|
||||||
|
context->get_instr_block(201)->terminator();
|
||||||
|
ASSERT_EQ(SpvOpReturnValue, return_value_inst->opcode());
|
||||||
|
ASSERT_EQ(SPV_OPERAND_TYPE_ID, return_value_inst->GetInOperand(0).type);
|
||||||
|
ASSERT_EQ(400, return_value_inst->GetSingleWordInOperand(0));
|
||||||
|
|
||||||
std::string after_transformation = R"(
|
std::string after_transformation = R"(
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
%1 = OpExtInstImport "GLSL.std.450"
|
%1 = OpExtInstImport "GLSL.std.450"
|
||||||
|
Loading…
Reference in New Issue
Block a user