r600g/sb: relax some restrictions for FETCH instructions
authorVadim Girlin <vadimgirlin@gmail.com>
Fri, 24 May 2013 14:15:57 +0000 (18:15 +0400)
committerVadim Girlin <vadimgirlin@gmail.com>
Fri, 24 May 2013 17:00:54 +0000 (21:00 +0400)
This allows GVN rewrite pass to propagate non-const (register)
values to FETCH source operands, helping to eliminate unnecessary
copies in some cases.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
src/gallium/drivers/r600/sb/sb_gvn.cpp

index 12cdb1c024077a027d45c2fd15d9b9cc1ecd5356..caea4ec66607b04301571787fad264067a8af495 100644 (file)
@@ -194,16 +194,15 @@ void gvn::process_op(node& n, bool rewrite) {
                                process_src(v->rel, rewrite);
                        }
 
-                       if (rewrite && v->gvn_source && v->gvn_source->is_readonly()
-                                       && n.is_any_alu()) {
+                       if (rewrite && v->gvn_source && v->gvn_source->is_readonly() &&
+                                       n.is_any_alu()) {
                                process_alu_src_constants(n, v);
-                       } else {
-                               if (rewrite && (n.is_fetch_op(FETCH_OP_VFETCH) ||
-                                               n.is_fetch_op(FETCH_OP_SEMFETCH)))
-                                       process_src(v, false);
-                               else
-                                       process_src(v, rewrite);
-                       }
+                       } else if (rewrite && v->gvn_source && v->gvn_source->is_const() &&
+                                       (n.is_fetch_op(FETCH_OP_VFETCH) ||
+                                                       n.is_fetch_op(FETCH_OP_SEMFETCH)))
+                               process_src(v, false);
+                       else
+                               process_src(v, rewrite);
                }
        }
        if (n.pred)