[Mesa-dev] [PATCH] glsl: Avoid combining statements from different basic blocks.
Matt Turner
mattst88 at gmail.com
Mon Jan 27 10:56:23 PST 2014
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74113
---
src/glsl/opt_vectorize.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/glsl/opt_vectorize.cpp b/src/glsl/opt_vectorize.cpp
index 9ca811a..6d2bd13 100644
--- a/src/glsl/opt_vectorize.cpp
+++ b/src/glsl/opt_vectorize.cpp
@@ -82,6 +82,7 @@ public:
virtual ir_visitor_status visit_enter(ir_assignment *);
virtual ir_visitor_status visit_enter(ir_swizzle *);
+ virtual ir_visitor_status visit_enter(ir_if *);
virtual ir_visitor_status visit_leave(ir_assignment *);
@@ -276,6 +277,24 @@ ir_vectorize_visitor::visit_enter(ir_swizzle *ir)
return visit_continue;
}
+/* Since there is no statement to visit between the "then" and "else"
+ * instructions try to vectorize before, in between, and after them to avoid
+ * combining statements from different basic blocks.
+ */
+ir_visitor_status
+ir_vectorize_visitor::visit_enter(ir_if *ir)
+{
+ try_vectorize();
+
+ visit_list_elements(this, &ir->then_instructions);
+ try_vectorize();
+
+ visit_list_elements(this, &ir->else_instructions);
+ try_vectorize();
+
+ return visit_continue_with_parent;
+}
+
/**
* Upon leaving an ir_assignment, save a pointer to it in ::assignment[] if
* the swizzle mask(s) found were appropriate. Also save a pointer in
--
1.8.3.2
More information about the mesa-dev
mailing list