mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
nir/copy_propagate: do not copy-propagate MOV srcs with source modifiers
If a source operand in a MOV has source modifiers, then we cannot copy-propagate it from the parent instruction and remove the MOV. v2: remove the check for source source modifiers from is_move() (Jason) Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
parent
5f43e074d4
commit
8610cd6b8c
1 changed files with 10 additions and 7 deletions
|
|
@ -41,11 +41,6 @@ static bool is_move(nir_alu_instr *instr)
|
|||
if (instr->dest.saturate)
|
||||
return false;
|
||||
|
||||
/* we handle modifiers in a separate pass */
|
||||
|
||||
if (instr->src[0].abs || instr->src[0].negate)
|
||||
return false;
|
||||
|
||||
if (!instr->src[0].src.is_ssa)
|
||||
return false;
|
||||
|
||||
|
|
@ -65,9 +60,13 @@ static bool is_vec(nir_alu_instr *instr)
|
|||
}
|
||||
|
||||
static bool
|
||||
is_swizzleless_move(nir_alu_instr *instr)
|
||||
is_simple_move(nir_alu_instr *instr)
|
||||
{
|
||||
if (is_move(instr)) {
|
||||
/* We handle modifiers in a separate pass */
|
||||
if (instr->src[0].negate || instr->src[0].abs)
|
||||
return false;
|
||||
|
||||
for (unsigned i = 0; i < 4; i++) {
|
||||
if (!((instr->dest.write_mask >> i) & 1))
|
||||
break;
|
||||
|
|
@ -81,6 +80,10 @@ is_swizzleless_move(nir_alu_instr *instr)
|
|||
if (instr->src[i].swizzle[0] != i)
|
||||
return false;
|
||||
|
||||
/* We handle modifiers in a separate pass */
|
||||
if (instr->src[i].negate || instr->src[i].abs)
|
||||
return false;
|
||||
|
||||
if (def == NULL) {
|
||||
def = instr->src[i].src.ssa;
|
||||
} else if (instr->src[i].src.ssa != def) {
|
||||
|
|
@ -107,7 +110,7 @@ copy_prop_src(nir_src *src, nir_instr *parent_instr, nir_if *parent_if)
|
|||
return false;
|
||||
|
||||
nir_alu_instr *alu_instr = nir_instr_as_alu(src_instr);
|
||||
if (!is_swizzleless_move(alu_instr))
|
||||
if (!is_simple_move(alu_instr))
|
||||
return false;
|
||||
|
||||
/* Don't let copy propagation land us with a phi that has more
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue