i965/fs: Simplify liveout calculation.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 10 Aug 2013 01:27:22 +0000 (18:27 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 19 Aug 2013 18:29:24 +0000 (11:29 -0700)
Excluding the existing liveout bits is a deviation from the textbook
algorithm.  The reason for doing so was to determine if the value
changed, which means the fixed-point algorithm needs to run for another
iteration.

The simpler way to do that is to save the value from step (N-1) and
compare it to the new value at step N.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp

index 424d7b52dcc73a9e9df793680d4d38439466d386..0078c871c5d6ae3fa60230188b814b7251252352 100644 (file)
@@ -186,13 +186,12 @@ fs_copy_prop_dataflow::run()
       /* Update liveout for all blocks. */
       for (int b = 0; b < cfg->num_blocks; b++) {
          for (int i = 0; i < bitset_words; i++) {
-            BITSET_WORD new_liveout = (bd[b].livein[i] &
-                                       ~bd[b].kill[i] &
-                                       ~bd[b].liveout[i]);
-            if (new_liveout) {
-               bd[b].liveout[i] |= new_liveout;
+            const BITSET_WORD old_liveout = bd[b].liveout[i];
+
+            bd[b].liveout[i] |= bd[b].livein[i] & ~bd[b].kill[i];
+
+            if (old_liveout != bd[b].liveout[i])
                progress = true;
-            }
          }
       }