SPIRV-Tools/source/opt
Steven Perron 7075c49923
Add dummy loop in merge-return. (#1896)
The current implementation of merge return can create bad, but correct,
code.  When it is not in a loop construct, it will insert a lot of
extra branch around code.  The potentially large number of branches are
bad.  At the same time, it can separate code store to variables from
its uses hiding the fact that the store dominates the load.

This hurts the later analysis because the compiler thinks that multiple
values can reach a load, when there is really only 1.  This poorer
analysis leads to missed optimizations.

The solution is to create a dummy loop around the entire body of the
function, then we can break from that loop with a single branch.  Also
only new merge nodes would be those at the end of loops meaning that
most analysies will not be hurt.

Remove dead code for cases that are no longer possible.

It seems like some drivers expect there the be an OpSelectionMerge
before conditional branches, even if they are not strictly needed.
So we add them.
2018-09-18 08:52:47 -04:00
..
aggressive_dead_code_elim_pass.cpp Handle breaks from structured-ifs in DCE. (#1848) 2018-08-21 11:54:44 -04:00
aggressive_dead_code_elim_pass.h Handle breaks from structured-ifs in DCE. (#1848) 2018-08-21 11:54:44 -04:00
basic_block.cpp Add dummy loop in merge-return. (#1896) 2018-09-18 08:52:47 -04:00
basic_block.h Add dummy loop in merge-return. (#1896) 2018-09-18 08:52:47 -04:00
block_merge_pass.cpp Allow merge blocks to merge two header blocks in some cases. (#1890) 2018-09-14 13:37:18 -04:00
block_merge_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
build_module.cpp Move make_unique to source/util. (#1836) 2018-08-14 12:44:54 -04:00
build_module.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
ccp_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
ccp_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
cfg_cleanup_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
cfg_cleanup_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
cfg.cpp Add dummy loop in merge-return. (#1896) 2018-09-18 08:52:47 -04:00
cfg.h Add dummy loop in merge-return. (#1896) 2018-09-18 08:52:47 -04:00
CMakeLists.txt Fix infinite loop in dead-branch-elimination (#1891) 2018-09-17 13:00:24 -04:00
combine_access_chains.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
combine_access_chains.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
common_uniform_elim_pass.cpp Fix readbility/braces warnings (#1804) 2018-08-07 09:09:47 -04:00
common_uniform_elim_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
compact_ids_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
compact_ids_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
composite.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
composite.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
const_folding_rules.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
const_folding_rules.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
constants.cpp Have the constant manager take ownership of constants. (#1866) 2018-08-27 09:53:47 -04:00
constants.h Have the constant manager take ownership of constants. (#1866) 2018-08-27 09:53:47 -04:00
copy_prop_arrays.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
copy_prop_arrays.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
dead_branch_elim_pass.cpp Fix infinite loop in dead-branch-elimination (#1891) 2018-09-17 13:00:24 -04:00
dead_branch_elim_pass.h Fix infinite loop in dead-branch-elimination (#1891) 2018-09-17 13:00:24 -04:00
dead_insert_elim_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
dead_insert_elim_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
dead_variable_elimination.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
dead_variable_elimination.h Add testing framework for tools. 2018-08-17 15:03:14 -04:00
decoration_manager.cpp Copy decorations when creating new ids. (#1843) 2018-08-24 11:55:39 -04:00
decoration_manager.h Copy decorations when creating new ids. (#1843) 2018-08-24 11:55:39 -04:00
def_use_manager.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
def_use_manager.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
dominator_analysis.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
dominator_analysis.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
dominator_tree.cpp Fix readbility/braces warnings (#1804) 2018-08-07 09:09:47 -04:00
dominator_tree.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
eliminate_dead_constant_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
eliminate_dead_constant_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
eliminate_dead_functions_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
eliminate_dead_functions_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
feature_manager.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
feature_manager.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
flatten_decoration_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
flatten_decoration_pass.h Add testing framework for tools. 2018-08-17 15:03:14 -04:00
fold_spec_constant_op_and_composite_pass.cpp Have the constant manager take ownership of constants. (#1866) 2018-08-27 09:53:47 -04:00
fold_spec_constant_op_and_composite_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
fold.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
fold.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
folding_rules.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
folding_rules.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
freeze_spec_constant_value_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
freeze_spec_constant_value_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
function.cpp Add IR dumping functions to use during debugging. 2018-09-14 14:28:34 -04:00
function.h Add IR dumping functions to use during debugging. 2018-09-14 14:28:34 -04:00
if_conversion.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
if_conversion.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
inline_exhaustive_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
inline_exhaustive_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
inline_opaque_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
inline_opaque_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
inline_pass.cpp Use MakeUnique. (#1837) 2018-08-14 15:01:50 -04:00
inline_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
instruction_list.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
instruction_list.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
instruction.cpp Add IR dumping functions to use during debugging. 2018-09-14 14:28:34 -04:00
instruction.h Add IR dumping functions to use during debugging. 2018-09-14 14:28:34 -04:00
ir_builder.h Add dummy loop in merge-return. (#1896) 2018-09-18 08:52:47 -04:00
ir_context.cpp Fix readbility/braces warnings (#1804) 2018-08-07 09:09:47 -04:00
ir_context.h Add option for the max id bound. (#1870) 2018-09-10 11:49:41 -04:00
ir_loader.cpp Use MakeUnique. (#1837) 2018-08-14 15:01:50 -04:00
ir_loader.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
iterator.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
licm_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
licm_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
local_access_chain_convert_pass.cpp Copy decorations when creating new ids. (#1843) 2018-08-24 11:55:39 -04:00
local_access_chain_convert_pass.h Keep decorations when replacing loads in access-chain-convert. (#1829) 2018-08-15 09:14:21 -04:00
local_redundancy_elimination.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
local_redundancy_elimination.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
local_single_block_elim_pass.cpp Keep decorations when replacing loads in access-chain-convert. (#1829) 2018-08-15 09:14:21 -04:00
local_single_block_elim_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
local_single_store_elim_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
local_single_store_elim_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
local_ssa_elim_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
local_ssa_elim_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
log.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
loop_dependence_helpers.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_dependence.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_dependence.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_descriptor.cpp Move make_unique to source/util. (#1836) 2018-08-14 12:44:54 -04:00
loop_descriptor.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_fission.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_fission.h Add testing framework for tools. 2018-08-17 15:03:14 -04:00
loop_fusion_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_fusion_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_fusion.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_fusion.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_peeling.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_peeling.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_unroller.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_unroller.h Add testing framework for tools. 2018-08-17 15:03:14 -04:00
loop_unswitch_pass.cpp Fix readbility/braces warnings (#1804) 2018-08-07 09:09:47 -04:00
loop_unswitch_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_utils.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
loop_utils.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
mem_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
mem_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
merge_return_pass.cpp Add dummy loop in merge-return. (#1896) 2018-09-18 08:52:47 -04:00
merge_return_pass.h Add dummy loop in merge-return. (#1896) 2018-09-18 08:52:47 -04:00
module.cpp Add option for the max id bound. (#1870) 2018-09-10 11:49:41 -04:00
module.h Add option for the max id bound. (#1870) 2018-09-10 11:49:41 -04:00
null_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
optimizer.cpp Add option for the max id bound. (#1870) 2018-09-10 11:49:41 -04:00
pass_manager.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
pass_manager.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
passes.h Add option for the max id bound. (#1870) 2018-09-10 11:49:41 -04:00
private_to_local_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
private_to_local_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
propagator.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
propagator.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
reduce_load_size.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
reduce_load_size.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
redundancy_elimination.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
redundancy_elimination.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
reflect.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
register_pressure.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
register_pressure.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
remove_duplicates_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
remove_duplicates_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
replace_invalid_opc.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
replace_invalid_opc.h Add testing framework for tools. 2018-08-17 15:03:14 -04:00
scalar_analysis_nodes.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
scalar_analysis_simplification.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
scalar_analysis.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
scalar_analysis.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
scalar_replacement_pass.cpp Move make_unique to source/util. (#1836) 2018-08-14 12:44:54 -04:00
scalar_replacement_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
set_spec_constant_default_value_pass.cpp Move make_unique to source/util. (#1836) 2018-08-14 12:44:54 -04:00
set_spec_constant_default_value_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
simplification_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
simplification_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
ssa_rewrite_pass.cpp Copy decorations when creating new ids. (#1843) 2018-08-24 11:55:39 -04:00
ssa_rewrite_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
strength_reduction_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
strength_reduction_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
strip_debug_info_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
strip_debug_info_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
strip_reflect_info_pass.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
strip_reflect_info_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
struct_cfg_analysis.cpp Fix infinite loop in dead-branch-elimination (#1891) 2018-09-17 13:00:24 -04:00
struct_cfg_analysis.h Fix infinite loop in dead-branch-elimination (#1891) 2018-09-17 13:00:24 -04:00
tree_iterator.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
type_manager.cpp Use MakeUnique. (#1837) 2018-08-14 15:01:50 -04:00
type_manager.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
types.cpp Use MakeUnique. (#1837) 2018-08-14 15:01:50 -04:00
types.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
unify_const_pass.cpp Move make_unique to source/util. (#1836) 2018-08-14 12:44:54 -04:00
unify_const_pass.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
value_number_table.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
value_number_table.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
vector_dce.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
vector_dce.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
workaround1209.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
workaround1209.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00