From 9faf64bc32cf7c1a06a302fff9f80d7e2e2685d5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 3 Oct 2010 15:01:20 -0700 Subject: i965: Be more conservative on live interval calculation. This also means that our intervals now highlight dead code. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 5ebf9063df2..6106445fbb7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2471,7 +2471,7 @@ fs_visitor::calculate_live_intervals() for (int i = 0; i < num_vars; i++) { def[i] = 1 << 30; - use[i] = 0; + use[i] = -1; } int ip = 0; @@ -2506,13 +2506,11 @@ fs_visitor::calculate_live_intervals() for (unsigned int i = 0; i < 3; i++) { if (inst->src[i].file == GRF && inst->src[i].reg != 0) { - def[inst->src[i].reg] = MIN2(def[inst->src[i].reg], eip); use[inst->src[i].reg] = MAX2(use[inst->src[i].reg], eip); } } if (inst->dst.file == GRF && inst->dst.reg != 0) { def[inst->dst.reg] = MIN2(def[inst->dst.reg], eip); - use[inst->dst.reg] = MAX2(use[inst->dst.reg], eip); } } @@ -2529,6 +2527,16 @@ fs_visitor::virtual_grf_interferes(int a, int b) int start = MAX2(this->virtual_grf_def[a], this->virtual_grf_def[b]); int end = MIN2(this->virtual_grf_use[a], this->virtual_grf_use[b]); + /* For dead code, just check if the def interferes with the other range. */ + if (this->virtual_grf_use[a] == -1) { + return (this->virtual_grf_def[a] >= this->virtual_grf_def[b] && + this->virtual_grf_def[a] < this->virtual_grf_use[b]); + } + if (this->virtual_grf_use[b] == -1) { + return (this->virtual_grf_def[b] >= this->virtual_grf_def[a] && + this->virtual_grf_def[b] < this->virtual_grf_use[a]); + } + return start <= end; } -- cgit v1.2.3