diff options
author | Eric Anholt <[email protected]> | 2012-05-08 10:36:18 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-05-14 16:53:19 -0700 |
commit | f42cdc7984cb1db4a13f87daf60d374d19eb9b0a (patch) | |
tree | a0a496625bee8d989d802de5c65c69c9432c20b8 /src/mesa/drivers | |
parent | d7787adda8006506545256547d8d590a282487af (diff) |
i965/fs: Remove the requirement of no dead code for interference checks.
This will be convenient when I want to comment out optimization code
to see the raw program being optimized, but more importantly will let
the interference check be used during optimization.
Acked-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
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 c7ee582c283..46408da7b79 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp @@ -226,19 +226,19 @@ fs_visitor::calculate_live_intervals() bool 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]); - - /* We can't handle dead register writes here, without iterating - * over the whole instruction stream to find every single dead - * write to that register to compare to the live interval of the - * other register. Just assert that dead_code_eliminate() has been - * called. + int a_def = this->virtual_grf_def[a], a_use = this->virtual_grf_use[a]; + int b_def = this->virtual_grf_def[b], b_use = this->virtual_grf_use[b]; + + /* If there's dead code (def but not use), it would break our test + * unless we consider it used. */ - assert((this->virtual_grf_use[a] != -1 || - this->virtual_grf_def[a] == MAX_INSTRUCTION) && - (this->virtual_grf_use[b] != -1 || - this->virtual_grf_def[b] == MAX_INSTRUCTION)); + if ((a_use == -1 && a_def != MAX_INSTRUCTION) || + (b_use == -1 && b_def != MAX_INSTRUCTION)) { + return true; + } + + int start = MAX2(a_def, b_def); + int end = MIN2(a_use, b_use); /* If the register is used to store 16 values of less than float * size (only the case for pixel_[xy]), then we can't allocate |