aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
Commit message (Collapse)AuthorAgeFilesLines
* i965: Move the back-end compiler to src/intel/compilerJason Ekstrand2017-03-131-119/+0
| | | | | | | | | | | | | | | | | | | | | | Mostly a dummy git mv with a couple of noticable parts: - With the earlier header cleanups, nothing in src/intel depends files from src/mesa/drivers/dri/i965/ - Both Autoconf and Android builds are addressed. Thanks to Mauro and Tapani for the fixups in the latter - brw_util.[ch] is not really compiler specific, so it's moved to i965. v2: - move brw_eu_defines.h instead of brw_defines.h - remove no-longer applicable includes - add missing vulkan/ prefix in the Android build (thanks Tapani) v3: - don't list brw_defines.h in src/intel/Makefile.sources (Jason) - rebase on top of the oa patches [Emil Velikov: commit message, various small fixes througout] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Fix invalid pointer read in dead_control_flow_eliminate().Kenneth Graunke2016-04-041-0/+4
| | | | | | | | | | | There may not be a previous block. In this case, there's no real work to do, so just continue on to the next one. v2: Update for bblock->prev() API change. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* i965/cfg: Fix comment list punctuationIan Romanick2016-02-261-1/+1
| | | | | | Trivial Signed-off-by: Ian Romanick <[email protected]>
* i965/cfg: Split out dead control flow paths to simplify both pathsIan Romanick2016-02-261-55/+38
| | | | | | | v2: Fix some bad indentation. Suggested by Curro. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* i965/cfg: Don't handle fully empty if/else/endifIan Romanick2016-02-261-10/+4
| | | | | | | | | | This will now never occur. The empty if-else part would have already been removed leaving an empty if-endif part. No shader-db changes. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* i965/cfg: Eliminate an empty then-branch of an if/else/endifIan Romanick2016-02-261-0/+14
| | | | | | | | | | | | | | | | On BDW, total instructions in shared programs: 8448571 -> 8448367 (-0.00%) instructions in affected programs: 21000 -> 20796 (-0.97%) helped: 116 HURT: 0 v2: Remove spurious attempt to combine the if_block with the (removed!) else_block. Suggested by Matt and Curro. Correct the comment describing what the new pass does. Suggested by Matt. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* i965/cfg: Track prev_block and prev_inst explicitly in the whole functionIan Romanick2016-02-261-5/+7
| | | | | | | | This provides a trivial simplification now, and it makes some future changes more straight forward. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* i965/cfg: Slightly rearrange dead_control_flow_eliminateIan Romanick2016-02-261-56/+57
| | | | | | | | | 'git diff -w' is a bit more illustrative. A couple declarations were moved, the continue was removed, and the code was reindented. This will simplify future changes. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* i965: Rename backend_visitor to backend_shaderJason Ekstrand2015-05-281-3/+3
| | | | | | | | The backend_shader class really is a representation of a shader. The fact that it inherits from ir_visitor is somewhat immaterial. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/cfg: Remove if_block/else_block.Matt Turner2014-11-111-8/+0
| | | | | | | | I used these in the SEL peephole, but they require extra tracking and fix ups. The SEL peephole can pretty easily find the blocks it needs without these. Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Add and use functions to get next/prev blocks.Matt Turner2014-09-241-8/+8
| | | | Reviewed-by: Topi Pohjolainen <[email protected]>
* i965: Make instruction lists local to the bblocks.Matt Turner2014-09-241-3/+3
| | | | Reviewed-by: Topi Pohjolainen <[email protected]>
* i965/fs: Don't iterate between blocks with inst->next/prev.Matt Turner2014-09-241-2/+3
| | | | | | When instruction lists are per-basic block, this won't work. Reviewed-by: Topi Pohjolainen <[email protected]>
* i965: Remove now unneeded calls to calculate_cfg().Matt Turner2014-09-241-2/+0
| | | | | | | Now that nothing invalidates the CFG, we can calculate_cfg() immediately after emit_fb_writes()/emit_thread_end() and never again. Reviewed-by: Topi Pohjolainen <[email protected]>
* i965: Remove cfg-invalidating parameter from invalidate_live_intervals.Matt Turner2014-09-241-1/+1
| | | | | | Everything has been converted to preserve the CFG. Reviewed-by: Topi Pohjolainen <[email protected]>
* i965: Update if_block/else_block in the dead control flow pass.Matt Turner2014-09-051-0/+7
| | | | | | I think this bug crept in only recently. Reviewed-by: Kenneth Graunke <[email protected]>
* i965: Preserve CFG when deleting dead control flow.Matt Turner2014-08-221-9/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This pass deletes an IF/ELSE/ENDIF or IF/ENDIF sequence, or the ELSE in an ELSE/ENDIF sequence. In the typical case (where IF and ENDIF) aren't the only instructions in their basic blocks, we can simply remove the instructions (implicitly deleting the block containing only the ELSE), and attempt to merge blocks B0 and B2 together. B0: ... (+f0) if(8) B1: else(8) B2: endif(8) ... If the IF or ENDIF instructions are the only instructions in their respective basic blocks (which are deleted by the removal of the instructions), we'll want to instead merge the next blocks. Both B0 and B2 are possibly removed by the removal of if & endif. Same situation for if/endif. E.g., in the following example we'd remove blocks B1 and B2, and then attempt to combine B0 and B3. B0: ... B1: (+f0) if(8) B2: endif(8) B3: ... Reviewed-by: Topi Pohjolainen <[email protected]>
* i965: Add and use foreach_block macro.Matt Turner2014-08-181-2/+1
| | | | | Use this as an opportunity to rename 'block_num' to 'num'. block->num is clear, and block->block_num has always been redundant.
* i965: Improve dead control flow elimination.Matt Turner2014-07-241-10/+15
| | | | | | | | ... to eliminate an ELSE instruction followed immediately by an ENDIF. instructions in affected programs: 704 -> 700 (-0.57%) Reviewed-by: Kenneth Graunke <[email protected]>
* i965: Add cfg to backend_visitor.Matt Turner2014-07-211-3/+3
| | | | Reviewed-by: Topi Pohjolainen <[email protected]>
* i965/cfg: Clean up cfg_t constructors.Matt Turner2013-12-041-1/+1
| | | | | | | parent_mem_ctx was unused since db47074a, so remove the two wrappers around create() and make create() the constructor. Reviewed-by: Eric Anholt <[email protected]>
* i965/cfg: Rework to make IF & ELSE blocks flow into ENDIF.Matt Turner2013-12-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we made the basic block following an ENDIF instruction a successor of the basic blocks ending with IF and ELSE. The PRM says that IF and ELSE instructions jump *to* the ENDIF, rather than over it. This should be immaterial to dataflow analysis, except for if, break, endif sequences: START B1 <-B0 <-B9 0x00000100: cmp.g.f0(8) null g15<8,8,1>F g4<0,1,0>F 0x00000110: (+f0) if(8) 0 0 null 0x00000000UD END B1 ->B2 ->B4 START B2 <-B1 break 0x00000120: break(8) 0 0 null 0D END B2 ->B10 START B3 0x00000130: endif(8) 2 null 0x00000002UD END B3 ->B4 The ENDIF block would have no parents, so dataflow analysis would generate incorrect results, preventing copy propagation from eliminating some instructions. This patch changes the CFG to make ENDIF start rather than end basic blocks, so that it can be the jump target of the IF and ELSE instructions. It helps three programs (including two fs8/fs16 pairs). total instructions in shared programs: 1561126 -> 1561060 (-0.00%) instructions in affected programs: 837 -> 771 (-7.89%) More importantly, it allows copy propagation to handle more cases. Disabling the register_coalesce() pass before this patch hurts 58 programs, while afterward it only hurts 11 programs. Reviewed-by: Eric Anholt <[email protected]>
* i965: Add a pass to remove dead control flow.Matt Turner2013-11-201-0/+83
Removes IF/ENDIF and IF/ELSE/ENDIF with no intervening instructions. total instructions in shared programs: 1360393 -> 1360387 (-0.00%) instructions in affected programs: 157 -> 151 (-3.82%) (no change in vertex shaders) Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>