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

Iago Toral Quiroga itoral at igalia.com
Tue Oct 13 04:00:13 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_fs_live_variables.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
index ce066a9..ce99bd3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
@@ -255,6 +255,13 @@ fs_live_variables::compute_live_variables()
 void
 fs_live_variables::compute_start_end()
 {
+   /* 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 = &block_data[block->num];
 
-- 
1.9.1



More information about the mesa-dev mailing list