Don't assert on void function parameters. (#2047)

The type manager in spirv-opt currently asserts if a function parameter
has type void.  It is not exactly clear from the spec that this is
disallowed, even if it probably will be disallowed.  In either case,
asserts should be used to verify assumptions that will actually make a
difference to the code.  As far as the optimizer is concerned, a void
parameter does not matter.  I don't see the point of the assert.  I'll
just remove it and let the validator decide whether to accept it or not.

No test was added because it is not clear that it is legal, and should
not force us to accept it in the future unless the spec make it clear
that it is legal.

Fixes crbug.com/903088.
This commit is contained in:
Steven Perron 2018-11-14 12:43:43 -05:00 committed by GitHub
parent ec5574a9c6
commit a6150a3fe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -548,20 +548,10 @@ void Pointer::GetExtraHashWords(std::vector<uint32_t>* words,
void Pointer::SetPointeeType(const Type* type) { pointee_type_ = type; }
Function::Function(Type* ret_type, const std::vector<const Type*>& params)
: Type(kFunction), return_type_(ret_type), param_types_(params) {
for (auto* t : params) {
(void)t;
assert(!t->AsVoid());
}
}
: Type(kFunction), return_type_(ret_type), param_types_(params) {}
Function::Function(Type* ret_type, std::vector<const Type*>& params)
: Type(kFunction), return_type_(ret_type), param_types_(params) {
for (auto* t : params) {
(void)t;
assert(!t->AsVoid());
}
}
: Type(kFunction), return_type_(ret_type), param_types_(params) {}
bool Function::IsSameImpl(const Type* that, IsSameCache* seen) const {
const Function* ft = that->AsFunction();