[Mesa-dev] [PATCH 4/4] i965/vec4: skip control-flow aware liveness analysis if we only have 1 block

Iago Toral Quiroga itoral at igalia.com
Tue Oct 13 04:00:15 PDT 2015


Otherwise, what this is going to do is mark every variable alive in the
single block we have, and thus, alive since its definition until the
program ends, which is really bad in situations where register pressure
is high.

Of course, this does not address the real problem: that our liveness
analysis is not good enough, but it helps some simple cases with no
effort.
---
 src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
index 6782379..afdecc2 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
@@ -287,6 +287,13 @@ vec4_visitor::calculate_live_intervals()
     */
    this->live_intervals = new(mem_ctx) vec4_live_variables(alloc, cfg);
 
+   /* If we only have one block this pass would only mark all used variables
+    * as alive in the block, and thus, alive in the entire program. We don't
+    * want that.
+    */
+   if (cfg->block_list.length() <= 1)
+      return;
+
    foreach_block (block, cfg) {
       struct block_data *bd = &live_intervals->block_data[block->num];
 
-- 
1.9.1



More information about the mesa-dev mailing list