pan/bi: Assume SSA in CSE

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>
This commit is contained in:
Alyssa Rosenzweig 2022-07-25 15:03:36 -04:00 committed by Marge Bot
parent 0e456da750
commit efee0ddd91

View file

@ -47,7 +47,6 @@ hash_index(uint32_t hash, bi_index index)
hash = HASH(hash, index.neg);
hash = HASH(hash, index.swizzle);
hash = HASH(hash, index.offset);
hash = HASH(hash, index.reg);
hash = HASH(hash, index.type);
return hash;
}
@ -140,22 +139,6 @@ instr_can_cse(const bi_instr *I)
if (I->branch_target)
return false;
/* Refuse to CSE non-SSA destinations since the data flow analysis
* required is nontrivial */
bi_foreach_dest(I, d) {
if (!bi_is_null(I->dest[d]) && !bi_is_ssa(I->dest[d]))
return false;
}
/* Similar refuse to CSE non-SSA sources. We allow machine registers,
* since CSE runs before register allocation which means any registers
* encountered are preloaded and hence assumed constant.
*/
bi_foreach_src(I, s) {
if (I->src[s].reg)
return false;
}
return true;
}
@ -193,8 +176,7 @@ bi_opt_cse(bi_context *ctx)
const bi_instr *match = entry->key;
bi_foreach_dest(instr, d) {
if (!bi_is_null(instr->dest[d]))
replacement[instr->dest[d].value] = match->dest[d];
replacement[instr->dest[d].value] = match->dest[d];
}
}
}