Commit 5d143aa0 by Ben Clayton

SpirvShader: Ignore unreachable inputs for Phis.

Bug: b/128527271 Change-Id: I4bf01e7915735d7fd3dc827fd67873fff75a756f Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28354 Presubmit-Ready: Ben Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 37401472
...@@ -1373,6 +1373,12 @@ namespace sw ...@@ -1373,6 +1373,12 @@ namespace sw
{ {
auto varId = Object::ID(insn.word(w + 0)); auto varId = Object::ID(insn.word(w + 0));
auto blockId = Block::ID(insn.word(w + 1)); auto blockId = Block::ID(insn.word(w + 1));
if (block.ins.count(blockId) == 0)
{
continue; // In is unreachable. Ignore.
}
if (existsPath(state->currentBlock, blockId, block.mergeBlock)) if (existsPath(state->currentBlock, blockId, block.mergeBlock))
{ {
// This source is from a loop back-edge. // This source is from a loop back-edge.
...@@ -3028,6 +3034,7 @@ namespace sw ...@@ -3028,6 +3034,7 @@ namespace sw
auto typeId = Type::ID(insn.word(1)); auto typeId = Type::ID(insn.word(1));
auto type = getType(typeId); auto type = getType(typeId);
auto objectId = Object::ID(insn.word(2)); auto objectId = Object::ID(insn.word(2));
auto currentBlock = getBlock(state->currentBlock);
auto tmp = std::unique_ptr<SIMD::Int[]>(new SIMD::Int[type.sizeInComponents]); auto tmp = std::unique_ptr<SIMD::Int[]>(new SIMD::Int[type.sizeInComponents]);
...@@ -3037,6 +3044,11 @@ namespace sw ...@@ -3037,6 +3044,11 @@ namespace sw
auto varId = Object::ID(insn.word(w + 0)); auto varId = Object::ID(insn.word(w + 0));
auto blockId = Block::ID(insn.word(w + 1)); auto blockId = Block::ID(insn.word(w + 1));
if (currentBlock.ins.count(blockId) == 0)
{
continue; // In is unreachable. Ignore.
}
auto in = GenericValue(this, routine, varId); auto in = GenericValue(this, routine, varId);
auto mask = GetActiveLaneMaskEdge(state, blockId, state->currentBlock); auto mask = GetActiveLaneMaskEdge(state, blockId, state->currentBlock);
......
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