From 6b6166652d83813de13e387b8425eb98351b90a8 Mon Sep 17 00:00:00 2001 From: Andy Clayton Date: Tue, 3 Jan 2012 23:14:53 -0600 Subject: [PATCH] glsl: fix glsl optimization infinite loop from copy_propagation_elements Fixes a possible infinite loop in glsl optimization due to interaction between copy_propagation_elements and swizzle_swizzle. This approach is based on handle_rvalue appearing to already handle a swizzle's referenced value. As a result it does not seem correct to also call handle_rvalue with the referenced value, which this patch fixes. --- src/glsl/opt_copy_propagation_elements.cpp | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/glsl/opt_copy_propagation_elements.cpp b/src/glsl/opt_copy_propagation_elements.cpp index a91e624..901701b 100644 --- a/src/glsl/opt_copy_propagation_elements.cpp +++ b/src/glsl/opt_copy_propagation_elements.cpp @@ -108,6 +108,7 @@ public: virtual ir_visitor_status visit_leave(class ir_assignment *); virtual ir_visitor_status visit_enter(class ir_call *); virtual ir_visitor_status visit_enter(class ir_if *); + virtual ir_visitor_status visit_leave(class ir_swizzle *); void handle_rvalue(ir_rvalue **rvalue); @@ -179,6 +180,15 @@ ir_copy_propagation_elements_visitor::visit_leave(ir_assignment *ir) return visit_continue; } +ir_visitor_status +ir_copy_propagation_elements_visitor::visit_leave(ir_swizzle *ir) +{ + /* Skip visiting the values of swizzles. Avoids a possible infinite + * loop with opt_swizzle_swizzle. + */ + return visit_continue; +} + /** * Replaces dereferences of ACP RHS variables with ACP LHS variables. * -- 1.7.5.4