{
public:
fs_copy_prop_dataflow(void *mem_ctx, cfg_t *cfg,
- const fs_live_variables *live,
+ const fs_live_variables &live,
exec_list *out_acp[ACP_HASH_SIZE]);
void setup_initial_values();
void *mem_ctx;
cfg_t *cfg;
- const fs_live_variables *live;
+ const fs_live_variables &live;
acp_entry **acp;
int num_acp;
} /* anonymous namespace */
fs_copy_prop_dataflow::fs_copy_prop_dataflow(void *mem_ctx, cfg_t *cfg,
- const fs_live_variables *live,
+ const fs_live_variables &live,
exec_list *out_acp[ACP_HASH_SIZE])
: mem_ctx(mem_ctx), cfg(cfg), live(live)
{
for (int i = 0; i < num_acp; i++) {
BITSET_SET(bd[block->num].undef, i);
for (unsigned off = 0; off < acp[i]->size_written; off += REG_SIZE) {
- if (BITSET_TEST(live->block_data[block->num].defout,
- live->var_from_reg(byte_offset(acp[i]->dst, off))))
+ if (BITSET_TEST(live.block_data[block->num].defout,
+ live.var_from_reg(byte_offset(acp[i]->dst, off))))
BITSET_CLEAR(bd[block->num].undef, i);
}
}
if (i == 1) {
inst->src[i] = val;
progress = true;
- } else if (i == 0 && inst->src[1].file != IMM) {
+ } else if (i == 0 && inst->src[1].file != IMM &&
+ (inst->conditional_mod == BRW_CONDITIONAL_NONE ||
+ /* Only GE and L are commutative. */
+ inst->conditional_mod == BRW_CONDITIONAL_GE ||
+ inst->conditional_mod == BRW_CONDITIONAL_L)) {
inst->src[0] = inst->src[1];
inst->src[1] = val;
for (int i = 0; i < cfg->num_blocks; i++)
out_acp[i] = new exec_list [ACP_HASH_SIZE];
- calculate_live_intervals();
+ const fs_live_variables &live = live_analysis.require();
/* First, walk through each block doing local copy propagation and getting
* the set of copies available at the end of the block.
for (unsigned a = 0; a < ACP_HASH_SIZE; a++) {
foreach_in_list_safe(acp_entry, entry, &out_acp[block->num][a]) {
assert(entry->dst.file == VGRF);
- if (block->start_ip <= virtual_grf_start[entry->dst.nr] &&
- virtual_grf_end[entry->dst.nr] <= block->end_ip)
+ if (block->start_ip <= live.vgrf_start[entry->dst.nr] &&
+ live.vgrf_end[entry->dst.nr] <= block->end_ip)
entry->remove();
}
}
}
/* Do dataflow analysis for those available copies. */
- fs_copy_prop_dataflow dataflow(copy_prop_ctx, cfg, live_intervals, out_acp);
+ fs_copy_prop_dataflow dataflow(copy_prop_ctx, cfg, live, out_acp);
/* Next, re-run local copy propagation, this time with the set of copies
* provided by the dataflow analysis available at the start of a block.
ralloc_free(copy_prop_ctx);
if (progress)
- invalidate_analysis(DEPENDENCY_EVERYTHING);
+ invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW |
+ DEPENDENCY_INSTRUCTION_DETAIL);
return progress;
}