Mesa (master): glsl: Optimize lrp(x, x, coefficient) --> x.
Eric Anholt
anholt at kemper.freedesktop.org
Fri Feb 7 20:49:52 UTC 2014
Module: Mesa
Branch: master
Commit: 44577c48573acdbc8a708e6613f367507e9eafc5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=44577c48573acdbc8a708e6613f367507e9eafc5
Author: Eric Anholt <eric at anholt.net>
Date: Sat Jan 18 11:00:51 2014 -0800
glsl: Optimize lrp(x, x, coefficient) --> x.
total instructions in shared programs: 1627754 -> 1624534 (-0.20%)
instructions in affected programs: 45748 -> 42528 (-7.04%)
GAINED: 3
LOST: 0
(serious sam, humus domino demo)
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
src/glsl/opt_algebraic.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 953b03c..392051f 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -553,6 +553,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
return ir->operands[0];
} else if (is_vec_one(op_const[2])) {
return ir->operands[1];
+ } else if (ir->operands[0]->equals(ir->operands[1])) {
+ return ir->operands[0];
}
break;
More information about the mesa-commit
mailing list