From: Vadim Girlin Date: Fri, 24 May 2013 14:15:57 +0000 (+0400) Subject: r600g/sb: relax some restrictions for FETCH instructions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9aa46e66502248c4b266cb6c4a88851832982d8;p=mesa.git r600g/sb: relax some restrictions for FETCH instructions 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 --- diff --git a/src/gallium/drivers/r600/sb/sb_gvn.cpp b/src/gallium/drivers/r600/sb/sb_gvn.cpp index 12cdb1c0240..caea4ec6660 100644 --- a/src/gallium/drivers/r600/sb/sb_gvn.cpp +++ b/src/gallium/drivers/r600/sb/sb_gvn.cpp @@ -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)