Mesa (master): i965/vec4: Add parameter to skip doing constant propagation.

Matt Turner mattst88 at kemper.freedesktop.org
Mon Dec 29 20:15:45 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Sat Dec 20 17:37:09 2014 -0800

i965/vec4: Add parameter to skip doing constant propagation.

After CSEing some MOV ..., VF instructions we have code like

   mov tmp, [1F, 2F, 3F, 4F]VF
   mov r10, tmp
   mov r11, tmp
   ...
   use r10
   use r11

We want to copy propagate tmp into the uses of r10 and r11, but *not*
constant propagate the VF immediate into the uses of tmp.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/drivers/dri/i965/brw_vec4.h                    |    2 +-
 src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 4a8a467..75ecaf1 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -369,7 +369,7 @@ public:
    bool opt_reduce_swizzle();
    bool dead_code_eliminate();
    bool virtual_grf_interferes(int a, int b);
-   bool opt_copy_propagation();
+   bool opt_copy_propagation(bool do_constant_prop = true);
    bool opt_cse_local(bblock_t *block);
    bool opt_cse();
    bool opt_algebraic();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index 65564c9..9deaffa 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -330,7 +330,7 @@ try_copy_propagate(struct brw_context *brw, vec4_instruction *inst,
 }
 
 bool
-vec4_visitor::opt_copy_propagation()
+vec4_visitor::opt_copy_propagation(bool do_constant_prop)
 {
    bool progress = false;
    struct copy_entry entries[virtual_grf_reg_count];
@@ -395,7 +395,7 @@ vec4_visitor::opt_copy_propagation()
 	 if (c != 4)
 	    continue;
 
-	 if (try_constant_propagate(brw, inst, i, &entry))
+         if (do_constant_prop && try_constant_propagate(brw, inst, i, &entry))
             progress = true;
 
 	 if (try_copy_propagate(brw, inst, i, &entry, reg))




More information about the mesa-commit mailing list