From a6150a3fe778f62ac85b9fc8a2547c69e7607337 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 14 Nov 2018 12:43:43 -0500 Subject: [PATCH] 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. --- source/opt/types.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/source/opt/types.cpp b/source/opt/types.cpp index 0cbe5c8bb..96644c5d8 100644 --- a/source/opt/types.cpp +++ b/source/opt/types.cpp @@ -548,20 +548,10 @@ void Pointer::GetExtraHashWords(std::vector* words, void Pointer::SetPointeeType(const Type* type) { pointee_type_ = type; } Function::Function(Type* ret_type, const std::vector& 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& 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();