From: Kenneth Graunke Date: Sat, 10 Aug 2013 01:34:11 +0000 (-0700) Subject: i965/fs: Properly initialize the livein/liveout sets. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d40c784f22dcbe814e7915d1fae45774a264526;p=mesa.git i965/fs: Properly initialize the livein/liveout sets. 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 Reviewed-by: Paul Berry --- 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 9ffb64deb85..81e3693286a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -151,6 +151,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]; @@ -169,6 +170,26 @@ fs_copy_prop_dataflow::setup_initial_values() } } } + + /* 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; + } + } + } } /**