[Mesa-dev] [PATCH] glsl: replace null check with assert

Timothy Arceri timothy.arceri at collabora.com
Wed Jan 6 15:55:49 PST 2016


Ping.

Just looking over some older patches of mine. I made this change both
as a clean up but also because the constant expression evaluation code
is some of the most expensive in the compiler and this was right in the
hot path for some of the AoA tests until I improved some other
optimisation to avoid calling it so much.

It's not going to make much of a difference but with enhanced layouts
also now making use of the constant expression path it would still be
good to land this.

On Tue, 2015-07-14 at 23:30 +1000, Timothy Arceri wrote:
> This was added in 54f583a20 since then error handling has improved.
> 
> The test this was added to fix now fails earlier since 01822706ec
> ---
>  src/glsl/ir_constant_expression.cpp | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/glsl/ir_constant_expression.cpp
> b/src/glsl/ir_constant_expression.cpp
> index 171b8e9..5732867 100644
> --- a/src/glsl/ir_constant_expression.cpp
> +++ b/src/glsl/ir_constant_expression.cpp
> @@ -1857,9 +1857,7 @@ ir_swizzle::constant_expression_value(struct
> hash_table *variable_context)
>  ir_constant *
>  ir_dereference_variable::constant_expression_value(struct hash_table
> *variable_context)
>  {
> -   /* This may occur during compile and var->type is
> glsl_type::error_type */
> -   if (!var)
> -      return NULL;
> +   assert(var);
>  
>     /* Give priority to the context hashtable, if it exists */
>     if (variable_context) {


More information about the mesa-dev mailing list