SPIRV-Tools/test/opt
Steven Perron 93c4c184d5 Handle types with self references.
By using forward pointers, we are able to define a struct that has a
pointer to itself.  This could be directly or indirectly.  The current
implementation of the type manager did not handle this case.  There are
three changes that are made in this commit inorder to handle this case:

1) Change the handling of OpTypeForwardPointer

The current handling of OpTypeForwardsPointer is broken if there is a
reference to the pointer before the real definition.  When build the
type that contain the forward delared pointer, the type manager will ask
for the type for that ID, and will get a nullptr because it does not
exists.  This nullptr is not handleded very well.

The change is to keep track of the incomplete types the first time
through all of the types.  An incomplete type is a ForwardPointer or any
type that references an incomplete type.

Then we implement a second pass through the incomplete types that will
complete them.

2) Hashing types.

When hashing a type, we want to uses all of the subtypes as part of the
hash.  However, with types that reference them selves, this creates an
infinite recursion.  To get around this, we keep track of which types
have been seen on the path from the root type.  If we have see the
current type already then we can stop the recursion.

3) Comparing types.

In order to check if two types are the same, we must check that all of
their subtypes are the same as well.  This also causes an infinit
recursion.  The solution is to stop comparing the subtypes if we are
trying to compare two pointer types that we are already in the middle of
comparing.  The ideas is that if the two pointer are different, then in
progress compare will return false itself.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1578.
2018-05-30 15:48:38 -04:00
..
dominator_tree Dominator analysis interface clean. 2018-04-20 15:41:59 -04:00
loop_optimizations Fixing MacOS compiler error 2018-05-15 12:23:27 -04:00
aggressive_dead_code_elim_test.cpp Get ADCE to handle OpCopyMemory 2018-05-16 13:50:47 -04:00
assembly_builder_test.cpp hex_float: Use max_digits10 for the float precision 2018-04-03 12:53:10 -04:00
assembly_builder.h Adding additional functionality to ADCE. 2018-01-10 08:35:48 -05:00
block_merge_test.cpp Fixes #1402. Don't merge non-branch terminators into loop header. 2018-03-13 22:16:17 -04:00
ccp_test.cpp Fixes #1361. Mark all non-constant global values as varying in CCP 2018-03-01 15:24:41 -05:00
cfg_cleanup_test.cpp Adding OpPhi validation rules. 2018-03-27 17:26:26 -04:00
CMakeLists.txt Add pass to fold a load feeding an extract. 2018-05-14 15:40:34 -04:00
common_uniform_elim_test.cpp Fix broken pointer of CommonUniformElimPass 2018-04-19 09:36:10 -04:00
compact_ids_test.cpp Re-format source tree - NFC. 2017-11-27 14:31:49 -05:00
copy_prop_array_test.cpp Add pass to fold a load feeding an extract. 2018-05-14 15:40:34 -04:00
dead_branch_elim_test.cpp hex_float: Use max_digits10 for the float precision 2018-04-03 12:53:10 -04:00
dead_insert_elim_test.cpp Improve Vector DCE 2018-04-30 11:55:50 -04:00
dead_variable_elim_test.cpp Add pass to remove dead variables at the module level. 2017-10-23 13:57:05 -04:00
decoration_manager_test.cpp Teach DecorationManager about OpDecorateStringGOOGLE 2018-03-13 22:18:33 -04:00
def_use_test.cpp Preserve analysies in the simplification pass 2018-02-22 16:06:30 -05:00
eliminate_dead_const_test.cpp hex_float: Use max_digits10 for the float precision 2018-04-03 12:53:10 -04:00
eliminate_dead_functions_test.cpp Add scalar replacement 2017-12-11 10:51:13 -05:00
feature_manager_test.cpp Store all enabled capabilities in the feature manger. 2017-12-21 11:14:53 -05:00
flatten_decoration_test.cpp Add FlattenDecoration transform 2017-04-06 11:19:56 -04:00
fold_spec_const_op_composite_test.cpp Implement SSA CCP (SSA Conditional Constant Propagation). 2017-12-21 14:29:45 -05:00
fold_test.cpp Fold FMix feeding Extract, and use the simplification pass. 2018-05-25 14:42:59 -04:00
freeze_spec_const_test.cpp hex_float: Use max_digits10 for the float precision 2018-04-03 12:53:10 -04:00
function_utils.h Dominator Tree Analysis (#3) 2017-12-05 22:59:43 -05:00
if_conversion_test.cpp Allow hoisting code in if-conversion. 2018-05-04 12:56:29 -04:00
inline_opaque_test.cpp Re-format source tree - NFC. 2017-11-27 14:31:49 -05:00
inline_test.cpp Fixes handling of kill and unreachable ops in inlining. 2018-04-27 09:42:37 -04:00
insert_extract_elim_test.cpp InsertExtractElim: Split out DeadInsertElim as separate pass 2018-01-30 08:52:14 -05:00
instruction_list_test.cpp Change the sections in the module to use the InstructionList class. 2017-10-25 15:52:06 -04:00
instruction_test.cpp Allow getting the base pointer of an image load/store. 2018-01-05 13:26:10 -05:00
ir_builder.cpp Make IR builder use the type manager for constants 2018-02-27 12:59:26 -05:00
ir_context_test.cpp Store all enabled capabilities in the feature manger. 2017-12-21 11:14:53 -05:00
ir_loader_test.cpp Re-format source tree - NFC. 2017-11-27 14:31:49 -05:00
iterator_test.cpp Add register liveness analysis. 2018-04-20 09:45:15 -04:00
line_debug_info_test.cpp Add the IRContext (part 1) 2017-10-31 13:46:05 -04:00
local_access_chain_convert_test.cpp Re-format source tree - NFC. 2017-11-27 14:31:49 -05:00
local_redundancy_elimination_test.cpp Add scalar replacement 2017-12-11 10:51:13 -05:00
local_single_block_elim.cpp Remove redundant stores. 2018-05-15 10:24:05 -04:00
local_single_store_elim_test.cpp Rewrite local-single-store-elim to not create large data structures. 2018-04-18 16:38:18 -04:00
local_ssa_elim_test.cpp Fix SSA rewrite for nested loops. 2018-04-06 15:17:52 -04:00
module_test.cpp Adding ostream operators for IR structures 2018-01-12 11:19:58 -05:00
module_utils.h Re-format source tree - NFC. 2017-11-27 14:31:49 -05:00
optimizer_test.cpp Fix optimizer on when to write the binary 2017-04-03 15:48:50 -04:00
pass_fixture.h Add pass to reaplce invalid opcodes 2018-02-01 15:25:09 -05:00
pass_manager_test.cpp Store all enabled capabilities in the feature manger. 2017-12-21 11:14:53 -05:00
pass_merge_return_test.cpp Change merge return pass to handle structured cfg. 2018-03-19 13:49:04 -04:00
pass_remove_duplicates_test.cpp Avoid generating duplicate names when merging types 2018-03-05 12:02:50 -05:00
pass_test.cpp Adding an unique id to Instruction generated by IRContext 2017-11-20 17:49:10 -05:00
pass_utils.cpp Relicense SPIRV-Tools under Apache 2.0 2016-09-02 10:00:29 -04:00
pass_utils.h Add missing <iterator> header for std::back_inserter 2018-03-30 11:30:25 -04:00
private_to_local_test.cpp Teach the private to local about OpImageTexelPointer. 2018-04-04 13:42:35 -04:00
propagator_test.cpp Remove cfg_ field from SSAPropagator class - NFC. 2017-12-04 15:28:21 -05:00
reduce_load_size_test.cpp Fix getting operand without checking opcode. 2018-05-16 09:34:43 -04:00
redundancy_elimination_test.cpp Add scalar replacement 2017-12-11 10:51:13 -05:00
register_liveness.cpp Add register liveness analysis. 2018-04-20 09:45:15 -04:00
replace_invalid_opc_test.cpp hex_float: Use max_digits10 for the float precision 2018-04-03 12:53:10 -04:00
scalar_analysis.cpp Initial patch for scalar evolution analysis 2018-03-28 16:34:23 -04:00
scalar_replacement_test.cpp Remove the limit on struct size in SROA. 2018-05-18 10:03:46 -04:00
set_spec_const_default_value_test.cpp hex_float: Use max_digits10 for the float precision 2018-04-03 12:53:10 -04:00
simplification_test.cpp Add folding of OpCompositeExtract and OpConstantComposite constant instructions. 2018-02-09 17:52:33 -05:00
strength_reduction_test.cpp hex_float: Use max_digits10 for the float precision 2018-04-03 12:53:10 -04:00
strip_debug_info_test.cpp Re-format source tree - NFC. 2017-11-27 14:31:49 -05:00
strip_reflect_info_test.cpp Add --strip-reflect pass 2018-03-15 21:20:42 -04:00
type_manager_test.cpp Handle types with self references. 2018-05-30 15:48:38 -04:00
types_test.cpp Handle types with self references. 2018-05-30 15:48:38 -04:00
unify_const_test.cpp Add scalar replacement 2017-12-11 10:51:13 -05:00
utils_test.cpp Re-format source tree - NFC. 2017-11-27 14:31:49 -05:00
value_table_test.cpp Compute value number when the value table is constructed. 2017-12-04 11:02:04 -05:00
vector_dce_test.cpp Improve Vector DCE 2018-04-30 11:55:50 -04:00
workaround1209_test.cpp Create a pass to work around a driver bug related to OpUnreachable. 2018-01-18 20:31:46 -05:00