intel/compiler: Micro optimize inst_is_in_block

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>
This commit is contained in:
Ian Romanick 2023-03-13 19:46:46 -07:00 committed by Marge Bot
parent d47f521ee4
commit 43cb42df7c

View file

@ -1153,11 +1153,16 @@ backend_instruction::is_volatile() const
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