Accept OpBitCast in fix storage class. (#2505)

Fixes http://crbug.com/950889.
This commit is contained in:
Steven Perron 2019-04-09 14:10:35 -04:00 committed by GitHub
parent d90aae9a5a
commit 9047de51cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -68,6 +68,7 @@ bool FixStorageClass::PropagateStorageClass(Instruction* inst,
case SpvOpCopyMemory:
case SpvOpCopyMemorySized:
case SpvOpVariable:
case SpvOpBitcast:
// Nothing to change for these opcode. The result type is the same
// regardless of the storage class of the operand.
return false;

View File

@ -440,6 +440,25 @@ TEST_F(FixStorageClassTest, FixSelect) {
SinglePassRunAndMatch<FixStorageClass>(text, false);
}
TEST_F(FixStorageClassTest, BitCast) {
const std::string text = R"(OpCapability VariablePointersStorageBuffer
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %1 "main"
%void = OpTypeVoid
%3 = OpTypeFunction %void
%_ptr_Output_void = OpTypePointer Output %void
%_ptr_Private__ptr_Output_void = OpTypePointer Private %_ptr_Output_void
%6 = OpVariable %_ptr_Private__ptr_Output_void Private
%1 = OpFunction %void Inline %3
%7 = OpLabel
%8 = OpBitcast %_ptr_Output_void %6
OpReturn
OpFunctionEnd
)";
SinglePassRunAndCheck<FixStorageClass>(text, text, false);
}
} // namespace
} // namespace opt
} // namespace spvtools