Fix variable scoping when dest block only uses OpPhi to read variable.

This commit is contained in:
Hans-Kristian Arntzen 2017-08-21 09:36:53 +02:00
parent 6b7b76a63f
commit a1c0ab67eb

View File

@ -3019,8 +3019,14 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry)
const auto test_phi = [this, &block](uint32_t to) {
auto &next = compiler.get<SPIRBlock>(to);
for (auto &phi : next.phi_variables)
{
if (phi.parent == block.self)
{
accessed_variables_to_block[phi.function_variable].insert(block.self);
// Phi variables are also accessed in our target branch block.
accessed_variables_to_block[phi.function_variable].insert(next.self);
}
}
};
switch (block.terminator)