summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-11-18 10:44:34 +0800
committerEric Anholt <[email protected]>2010-11-18 11:16:14 +0800
commit50b4508319cc5277d51a38065850eaa092afc0d4 (patch)
treecbedd85f35b5de1d05a6d480b2ca58c45f3fe7dc /src/mesa
parent48af60b46540a30c3754f0e59801a62dfb1a146d (diff)
i965: Eliminate dead code more aggressively.
If an instruction writes reg but nothing later uses it, then we don't need to bother doing it. Before, we were just killing code that was never read after it was ever written. This removes many interpolation instructions for attributes with only a few comopnents used. Improves nexuiz high-settings performance .46% +/- .12% (n=3) on my Ironlake.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index b12a4800410..ac795e0bda1 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2801,26 +2801,17 @@ bool
fs_visitor::dead_code_eliminate()
{
bool progress = false;
- int num_vars = this->virtual_grf_next;
- bool dead[num_vars];
-
- for (int i = 0; i < num_vars; i++) {
- dead[i] = this->virtual_grf_def[i] >= this->virtual_grf_use[i];
-
- if (dead[i]) {
- /* Mark off its interval so it won't interfere with anything. */
- this->virtual_grf_def[i] = -1;
- this->virtual_grf_use[i] = -1;
- }
- }
+ int pc = 0;
foreach_iter(exec_list_iterator, iter, this->instructions) {
fs_inst *inst = (fs_inst *)iter.get();
- if (inst->dst.file == GRF && dead[inst->dst.reg]) {
+ if (inst->dst.file == GRF && this->virtual_grf_use[inst->dst.reg] <= pc) {
inst->remove();
progress = true;
}
+
+ pc++;
}
return progress;