This function only exists in builds with assertions, so it only matters
there.
On my Ice Lake laptop (using a locked CPU speed and other measures to
prevent thermal throttling, etc.) using a debugoptimized build, improves
performance of Vulkan CTS "deqp-vk --deqp-case='dEQP-VK.*spir*'" by
-5.2% ± 0.16% (n = 5, pooled s = 0.657887).
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22299>
static bool
inst_is_in_block(const bblock_t *block, const backend_instruction *inst)
{
- foreach_inst_in_block (backend_instruction, i, block) {
- if (inst == i)
- return true;
- }
- return false;
+ const exec_node *n = inst;
+
+ /* Find the tail sentinel. If the tail sentinel is the sentinel from the
+ * list header in the bblock_t, then this instruction is in that basic
+ * block.
+ */
+ while (!n->is_tail_sentinel())
+ n = n->get_next();
+
+ return n == &block->instructions.tail_sentinel;
}
#endif