Mesa (master): i965/fs: don' t read from uninitialized memory while assigning registers

Matt Turner mattst88 at kemper.freedesktop.org
Sun Aug 10 22:00:12 UTC 2014


Module: Mesa
Branch: master
Commit: 58007aec4193e3bdb38cafcfb2188dcbd8f18def
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=58007aec4193e3bdb38cafcfb2188dcbd8f18def

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Fri Aug  8 14:57:27 2014 -0700

i965/fs: don't read from uninitialized memory while assigning registers

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Connor Abbott <connor.abbott at intel.com>

---

 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index 3f27364..2233621 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -56,9 +56,9 @@ fs_visitor::assign_regs_trivial()
 
    foreach_in_list(fs_inst, inst, &instructions) {
       assign_reg(hw_reg_mapping, &inst->dst, reg_width);
-      assign_reg(hw_reg_mapping, &inst->src[0], reg_width);
-      assign_reg(hw_reg_mapping, &inst->src[1], reg_width);
-      assign_reg(hw_reg_mapping, &inst->src[2], reg_width);
+      for (i = 0; i < inst->sources; i++) {
+         assign_reg(hw_reg_mapping, &inst->src[i], reg_width);
+      }
    }
 
    if (this->grf_used >= max_grf) {
@@ -518,9 +518,9 @@ fs_visitor::assign_regs(bool allow_spilling)
 
    foreach_in_list(fs_inst, inst, &instructions) {
       assign_reg(hw_reg_mapping, &inst->dst, reg_width);
-      assign_reg(hw_reg_mapping, &inst->src[0], reg_width);
-      assign_reg(hw_reg_mapping, &inst->src[1], reg_width);
-      assign_reg(hw_reg_mapping, &inst->src[2], reg_width);
+      for (int i = 0; i < inst->sources; i++) {
+         assign_reg(hw_reg_mapping, &inst->src[i], reg_width);
+      }
    }
 
    ralloc_free(g);




More information about the mesa-commit mailing list