diff --git a/src/intel/compiler/brw_def_analysis.cpp b/src/intel/compiler/brw_def_analysis.cpp index e8c877d2669..60074c69ad6 100644 --- a/src/intel/compiler/brw_def_analysis.cpp +++ b/src/intel/compiler/brw_def_analysis.cpp @@ -73,6 +73,8 @@ def_analysis::update_for_reads(const idom_tree &idom, continue; } + def_use_counts[nr]++; + if (def_insts[nr]) { /* Mark the source def invalid in two cases: * @@ -130,8 +132,9 @@ def_analysis::def_analysis(const fs_visitor *v) def_count = v->alloc.count; - def_insts = new fs_inst*[def_count](); - def_blocks = new bblock_t*[def_count](); + def_insts = new fs_inst*[def_count](); + def_blocks = new bblock_t*[def_count](); + def_use_counts = new uint32_t[def_count](); for (unsigned i = 0; i < def_count; i++) def_insts[i] = UNSEEN; @@ -177,6 +180,7 @@ def_analysis::~def_analysis() { delete[] def_insts; delete[] def_blocks; + delete[] def_use_counts; } bool diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h index a5150192204..7d4e0019cb2 100644 --- a/src/intel/compiler/brw_fs.h +++ b/src/intel/compiler/brw_fs.h @@ -89,6 +89,13 @@ namespace brw { def_blocks[reg.nr] : NULL; } + uint32_t + get_use_count(const fs_reg ®) const + { + return reg.file == VGRF && reg.nr < def_count ? + def_use_counts[reg.nr] : 0; + } + unsigned count() const { return def_count; } void print_stats(const fs_visitor *) const; @@ -112,6 +119,7 @@ namespace brw { fs_inst **def_insts; bblock_t **def_blocks; + uint32_t *def_use_counts; unsigned def_count; }; }