intel/fs: Simplify compute_start_end().
authorEmma Anholt <emma@anholt.net>
Wed, 14 Jun 2023 17:46:44 +0000 (10:46 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Aug 2023 23:34:30 +0000 (23:34 +0000)
Now that we have moved the screening up, we can simplify the code.  No
change in shader-db steam performance, n=10.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24702>

src/intel/compiler/brw_fs_live_variables.cpp

index c8f8f8cd98982034205fcd383751c3f31d13fe5f..f56692214da24bd6067f192726d9835b1dbdcc3c 100644 (file)
@@ -236,23 +236,16 @@ fs_live_variables::compute_start_end()
 {
    foreach_block (block, cfg) {
       struct block_data *bd = &block_data[block->num];
+      unsigned i;
 
-      for (int w = 0; w < bitset_words; w++) {
-         BITSET_WORD livedefin = bd->livein[w];
-         BITSET_WORD livedefout = bd->liveout[w];
-         BITSET_WORD livedefinout = livedefin | livedefout;
-         while (livedefinout) {
-            unsigned b = u_bit_scan(&livedefinout);
-            unsigned i = w * BITSET_WORDBITS + b;
-            if (livedefin & (1u << b)) {
-               start[i] = MIN2(start[i], block->start_ip);
-               end[i] = MAX2(end[i], block->start_ip);
-            }
-            if (livedefout & (1u << b)) {
-               start[i] = MIN2(start[i], block->end_ip);
-               end[i] = MAX2(end[i], block->end_ip);
-            }
-         }
+      BITSET_FOREACH_SET(i, bd->livein, (unsigned)num_vars) {
+         start[i] = MIN2(start[i], block->start_ip);
+         end[i] = MAX2(end[i], block->start_ip);
+      }
+
+      BITSET_FOREACH_SET(i, bd->liveout, (unsigned)num_vars) {
+         start[i] = MIN2(start[i], block->end_ip);
+         end[i] = MAX2(end[i], block->end_ip);
       }
    }
 }