Commit 7d09824f by Ben Clayton

SpirvShader: Silence warnings of unexpected opcodes

... between the `OpFunction` and `OpLabel`. It is legal to have `OpLine`s between here, which we were incorrectly warning about. The `OpenCL.Debug.Info` opcodes can also sit here, which are numerous. Just silence the warning, we're only scanning forward for the `OpLabel` here. Bug: b/148401179 Change-Id: Ia9b8b024a1a15bbf431abec8f8ec47e2b735ed1b Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42328Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 8f2d48f9
...@@ -400,18 +400,12 @@ SpirvShader::SpirvShader( ...@@ -400,18 +400,12 @@ SpirvShader::SpirvShader(
function.result = Type::ID(insn.word(1)); function.result = Type::ID(insn.word(1));
function.type = Type::ID(insn.word(4)); function.type = Type::ID(insn.word(4));
// Scan forward to find the function's label. // Scan forward to find the function's label.
for(auto it = insn; it != end() && function.entry == 0; it++) for(auto it = insn; it != end(); it++)
{ {
switch(it.opcode()) if(it.opcode() == spv::OpLabel)
{ {
case spv::OpFunction:
case spv::OpFunctionParameter:
break;
case spv::OpLabel:
function.entry = Block::ID(it.word(1)); function.entry = Block::ID(it.word(1));
break; break;
default:
WARN("Unexpected opcode '%s' following OpFunction", OpcodeName(it.opcode()).c_str());
} }
} }
ASSERT_MSG(function.entry != 0, "Function<%d> has no label", currentFunction.value()); ASSERT_MSG(function.entry != 0, "Function<%d> has no label", currentFunction.value());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment