Previously, livein was initialized to 0 for all blocks. According to the textbook, it should be the universal set (~0) for all blocks except the one representing the start of the program (which should be 0).
liveout also needs to be initialized to COPY for the initial block. Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> --- .../drivers/dri/i965/brw_fs_copy_propagation.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp index fd726e0..3344f89 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -147,6 +147,7 @@ fs_copy_prop_dataflow::fs_copy_prop_dataflow(void *mem_ctx, cfg_t *cfg, void fs_copy_prop_dataflow::setup_initial_values() { + /* Initialize the COPY and KILL sets. */ for (int b = 0; b < cfg->num_blocks; b++) { bblock_t *block = cfg->blocks[b]; @@ -177,6 +178,26 @@ fs_copy_prop_dataflow::setup_initial_values() bd[b].copy[i] &= ~bd[b].kill[i]; } } + + /* Populate the initial values for the livein and liveout sets. For the + * block at the start of the program, livein = 0 and liveout = copy. + * For the others, set liveout to 0 (the empty set) and livein to ~0 + * (the universal set). + */ + for (int b = 0; b < cfg->num_blocks; b++) { + bblock_t *block = cfg->blocks[b]; + if (block->parents.is_empty()) { + for (int i = 0; i < bitset_words; i++) { + bd[b].livein[i] = 0u; + bd[b].liveout[i] = bd[b].copy[i]; + } + } else { + for (int i = 0; i < bitset_words; i++) { + bd[b].liveout[i] = 0u; + bd[b].livein[i] = ~0u; + } + } + } } /** -- 1.8.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev