[Mesa-dev] [PATCH] i965/vec4: dead_code_eliminate: update writemask on null_regs based on flag_live
Alejandro PiƱeiro
apinheiro at igalia.com
Wed Oct 14 14:08:36 PDT 2015
---
This patch implements the idea proposed by Francisco Jerez. With this
change, even adding the new condition pointed by Matt Turner on the
"2/5 i965/vec4: adding vec4_cmod_propagation optimization", the shader-db
numbers remain the same. So this patch would go before the optimization
(so in this series it would be the patch 1.5).
Note: Im not resending the patch 2/5, as Matt pointed that he granted
the reviewed status with his suggested change. I can send it if needed
in any case.
.../drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
index 8fc7a36..31ea128 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
@@ -78,13 +78,19 @@ vec4_visitor::dead_code_eliminate()
sizeof(BITSET_WORD));
foreach_inst_in_block_reverse(vec4_instruction, inst, block) {
- if (inst->dst.file == GRF && !inst->has_side_effects()) {
+ if ((inst->dst.file == GRF && !inst->has_side_effects()) ||
+ (inst->dst.is_null() && inst->writes_flag())){
bool result_live[4] = { false };
- for (unsigned i = 0; i < inst->regs_written; i++) {
- for (int c = 0; c < 4; c++)
- result_live[c] |= BITSET_TEST(
- live, var_from_reg(alloc, offset(inst->dst, i), c));
+ if (inst->dst.file == GRF) {
+ for (unsigned i = 0; i < inst->regs_written; i++) {
+ for (int c = 0; c < 4; c++)
+ result_live[c] |= BITSET_TEST(
+ live, var_from_reg(alloc, offset(inst->dst, i), c));
+ }
+ } else {
+ for (unsigned c = 0; c < 4; c++)
+ result_live[c] |= BITSET_TEST(flag_live, c);
}
/* If the instruction can't do writemasking, then it's all or
--
2.1.4
More information about the mesa-dev
mailing list