Mesa (glsl2): ir_constant_expression: Remove pointless use of variable_referenced.

Ian Romanick idr at kemper.freedesktop.org
Wed Jul 21 00:14:40 UTC 2010


Module: Mesa
Branch: glsl2
Commit: e4768eecd5da6f9e955aa7c3892810813623f0dc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4768eecd5da6f9e955aa7c3892810813623f0dc

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Jul 15 10:27:53 2010 -0700

ir_constant_expression: Remove pointless use of variable_referenced.

ir_dereference_variable always references an ir_variable, so there's no
point in calling a function and NULL-checking the result.

---

 src/glsl/ir_constant_expression.cpp |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index 186d0c4..cb07f38 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -695,10 +695,7 @@ ir_swizzle::constant_expression_value()
 ir_constant *
 ir_dereference_variable::constant_expression_value()
 {
-   ir_variable *var = this->variable_referenced();
-   if (var && var->constant_value)
-      return var->constant_value->clone(NULL);
-   return NULL;
+   return var->constant_value ? var->constant_value->clone(NULL) : NULL;
 }
 
 




More information about the mesa-commit mailing list