diff options
| author | Matt Turner <mattst88@gmail.com> | 2016-08-17 11:41:03 -0700 |
|---|---|---|
| committer | Matt Turner <mattst88@gmail.com> | 2016-08-18 10:19:09 -0700 |
| commit | 3ac3bea476205b45e5625b5170b0b78b419363a9 (patch) | |
| tree | 32c168230626dc5fcb8adb5de6e78589c5630024 | |
| parent | dea08d95c24ea35474b5b2f40539037363b0af41 (diff) | |
i965/cfg: Ignore non-CF instructions in unreachable blocks.wip/nir-gvn
The basic block following a control flow structure like an infinite loop
will be unreachable. Ignore any non-control-flow instructions in it
since they can have no effect on the program.
Avoids a segmentation fault in cfg_t::intersect(a, b) when called on an
unreachable block. By avoiding ever putting code in an unreachable
block, we never attempt to optimize code in an unreachable block.
| -rw-r--r-- | src/mesa/drivers/dri/i965/brw_cfg.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp index 53b32be510a..2fa4e3d4852 100644 --- a/src/mesa/drivers/dri/i965/brw_cfg.cpp +++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp @@ -312,6 +312,11 @@ cfg_t::cfg_t(exec_list *instructions) break; default: + if (cur->num != 0 && cur->parents.is_empty()) { + ip--; + continue; + } + cur->instructions.push_tail(inst); break; } @@ -319,6 +324,12 @@ cfg_t::cfg_t(exec_list *instructions) cur->end_ip = ip - 1; + /* If the last block was empty (because it was unreachable) drop it. */ + if (cur->instructions.is_empty()) { + cur->link.remove(); + num_blocks--; + } + make_block_array(); } |
