SPIR-V: Return undefined values from implicit returns instead of dummy

Previously if a non-void function implictly returned, a dummy variable
was created as return value. Now instead it returns the result of the
OpUndef instruction. This better conveys the presence of undefined
behavior to SPIR-V consuming tools (and humans).

It also saves one ID per occurrence...
This commit is contained in:
Miro Knejp
2015-08-11 02:45:24 +02:00
parent 65c78a0b62
commit 28f9b1c28d
4 changed files with 77 additions and 74 deletions

View File

@@ -218,6 +218,9 @@ public:
// Create a global or function local or IO variable.
Id createVariable(StorageClass, Id type, const char* name = 0);
// Create an imtermediate with an undefined value.
Id createUndefined(Id type);
// Store into an Id and return the l-value
void createStore(Id rValue, Id lValue);