From: Francisco Jerez Date: Sun, 13 Mar 2016 23:37:03 +0000 (-0700) Subject: intel/compiler: Calculate num_instructions in O(1) during register pressure calculation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=70349a2252a95f181de519be61ea84bd22381e4b;p=mesa.git intel/compiler: Calculate num_instructions in O(1) during register pressure calculation And mark the variable declaration as const. Reviewed-by: Matt Turner Tested-by: Marge Bot Part-of: --- diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 704088ab588..0a6537478e0 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -7362,9 +7362,8 @@ fs_visitor::setup_cs_payload() brw::register_pressure::register_pressure(const fs_visitor *v) { const fs_live_variables &live = v->live_analysis.require(); - unsigned num_instructions = 0; - foreach_block(block, v->cfg) - num_instructions += block->instructions.length(); + const unsigned num_instructions = v->cfg->num_blocks ? + v->cfg->blocks[v->cfg->num_blocks - 1]->end_ip + 1 : 0; regs_live_at_ip = new unsigned[num_instructions]();