brw: Avoid unnecessary calls to size_read() in flags_read()

Only ARF sources are relevant in this case, so check the file
before calling size_read().

Below are fossil compilation times in a MTL machine compiling shaders
for a BMG GPU:

```
// Differences at 95.0% confidence.

// Rise of the Tomb Raider (n=20)
   No difference proven

// Alan Wake (n=20)
   -0.0725 +/- 0.0139437
   -2.30965276% +/- 0.438787%

// Borderlands 3 (n=14)
   -0.248571429 +/- 0.135107
   -1.76946153% +/- 0.954171%

// Oblivion Remastered (n=14)
   -0.0735714286 +/- 0.0235712
   -1.54770849% +/- 0.492117%

// Baldur's Gate 3 (n=14)
   -0.832142857 +/- 0.23095
   -1.98028217% +/- 0.545648%
```

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41496>
This commit is contained in:
Caio Oliveira 2026-05-08 12:58:56 -07:00 committed by Marge Bot
parent bb8d8a2141
commit 9975a35f43

View file

@ -707,7 +707,8 @@ brw_inst::flags_read(const intel_device_info *devinfo) const
} else {
unsigned mask = 0;
for (int i = 0; i < sources; i++) {
mask |= brw_flag_mask(src[i], size_read(devinfo, i));
if (src[i].file == ARF)
mask |= brw_flag_mask(src[i], size_read(devinfo, i));
}
return mask;
}