SPIRV-Tools/test/opt
Steven Perron 148c97f687
Avoid use of type manager in extact->construct folding (#5684)
* Avoid use of type manager in extact->construct folding

When dealing with structs the type manager merge two different structs
into a single entry if they have all of the same decorations and
element types. This is because they hash to the same value in the hash
table. This can cause problems if you need to get the id of a type from
the type manager because you could get either one. In this case, it
returns the wrong one.

The fix avoids using the type manager in one place. I have not
looked closely at other places the type manager is used to make
sure it is used safely everywhere.

Fixes #5624

* Remove use of TypeManager::GetId

This removes a use of TypeManager::GetId by keeping the id around. This
avoid a potential problem if the type manager gets confused. These types
of bugs are hard to generate test cases for, so I do not have a test.
However, existing tests make sure that do not regress.
2024-05-31 14:13:20 +02:00
..
dominator_tree spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
loop_optimizations Fix LICMPass (#5087) 2023-04-05 11:48:14 -04:00
aggressive_dead_code_elim_test.cpp Make sure that fragment shader interlock instructions are not removed by DCE (#5400) 2023-09-11 15:26:10 -04:00
amd_ext_to_khr.cpp Validate GroupNonUniform instructions (#5296) 2023-07-11 08:40:40 -04:00
analyze_live_input_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
assembly_builder_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
assembly_builder.h Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
block_merge_test.cpp opt: prevent meld to merge block with MaximalReconvergence (#5557) 2024-02-06 06:12:00 -05:00
c_interface_test.cpp Add C interface for Optimizer (#5030) 2023-02-01 13:58:52 +00:00
ccp_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
cfg_cleanup_test.cpp Add validation for execution modes 2018-10-02 10:22:23 -04:00
cfg_test.cpp Build struct order only for the section needed when unrolling. (#4830) 2022-06-29 09:53:26 -04:00
CMakeLists.txt opt: Remove bindless and buff addr instrumentation passes (#5657) 2024-05-02 18:52:17 -04:00
code_sink_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
combine_access_chains_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
compact_ids_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
constant_manager_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
constants_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
control_dependence.cpp spirv-opt: Rename ControlDependenceAnalysis::DoesBlockExist to HasBlock (#4412) 2021-07-29 08:30:48 -04:00
convert_relaxed_to_half_test.cpp spirv-opt: Fix OpCompositeExtract relaxation with struct operands (#5536) 2024-02-01 15:19:02 -07:00
convert_to_sampled_image_test.cpp Add spirv-opt convert-to-sampled-image pass (#4340) 2021-08-18 08:30:48 -04:00
copy_prop_array_test.cpp [OPT] Identify arrays with unknown length in copy prop arrays (#5570) 2024-02-13 14:41:38 -05:00
dataflow.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
dead_branch_elim_test.cpp Use structural dominance to validate cfg (#4832) 2022-06-29 23:32:20 -04:00
dead_insert_elim_test.cpp Fix nullptr argument in MarkInsertChain (#5465) 2023-11-16 19:36:32 +00:00
dead_variable_elim_test.cpp Validate variable initializer type (#2668) 2019-06-15 00:34:18 -04:00
debug_info_manager_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
decoration_manager_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
def_use_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
desc_sroa_test.cpp opt: Add OpEntryPoint to DescriptorScalarReplacement pass (#5553) 2024-02-01 09:50:36 -05:00
eliminate_dead_const_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
eliminate_dead_functions_test.cpp Fix removal of dependent non-semantic instructions (#5122) 2023-02-24 01:10:35 +00:00
eliminate_dead_io_components_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
eliminate_dead_member_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
eliminate_dead_output_stores_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
feature_manager_test.cpp opt: change Get* functions to return const& (#5331) 2023-07-20 10:18:19 -04:00
fix_func_call_arguments_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
fix_storage_class_test.cpp opt: support 64-bit OpAccessChain index in FixStorageClass (#5446) 2023-10-19 20:02:46 +00:00
flatten_decoration_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
fold_spec_const_op_composite_test.cpp [OPT] Use new instruction folder for for all opcodes in spec consti folding (#5569) 2024-02-12 19:52:55 +00:00
fold_test.cpp Avoid use of type manager in extact->construct folding (#5684) 2024-05-31 14:13:20 +02:00
freeze_spec_const_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
function_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
function_utils.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
graphics_robust_access_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
if_conversion_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
inline_opaque_test.cpp Opt passes should apply to the exported functions (#4554) 2021-10-18 13:18:16 -04:00
inline_test.cpp Add AliasedPointer decoration (#5635) 2024-04-05 11:45:55 -06:00
insert_extract_elim_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
inst_debug_printf_test.cpp printf: Remove stage specific info (#5495) 2023-12-04 15:43:36 -07:00
instruction_list_test.cpp Fix -Wextra-semi-stmt -Wsuggest-destructor-override -Wdeprecated-copy-dtor (#4164) 2021-03-09 13:16:43 +00:00
instruction_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
interface_var_sroa_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
interp_fixup_test.cpp Add interpolate legalization pass (#4220) 2021-03-31 14:26:36 -04:00
invocation_interlock_placement_test.cpp Add a new legalization pass to dedupe invocation interlock instructions (#5409) 2023-09-27 19:54:10 -04:00
ir_builder.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
ir_context_test.cpp NFC: makes the FeatureManager immutable for users (#5329) 2023-07-17 11:15:08 -04:00
ir_loader_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
iterator_test.cpp Move make_unique to source/util. (#1836) 2018-08-14 12:44:54 -04:00
line_debug_info_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
local_access_chain_convert_test.cpp Add Vulkan memory model to allow lists (#5173) 2023-03-28 16:57:45 -04:00
local_redundancy_elimination_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
local_single_block_elim.cpp Add Vulkan memory model to allow lists (#5173) 2023-03-28 16:57:45 -04:00
local_single_store_elim_test.cpp Add Vulkan memory model to allow lists (#5173) 2023-03-28 16:57:45 -04:00
local_ssa_elim_test.cpp Fix missing and incorrect DebugValues (#4929) 2022-09-13 14:41:07 +00:00
modify_maximal_reconvergence_test.cpp Add tooling support for SPV_KHR_maximal_reconvergence (#5542) 2024-01-25 09:39:49 -05:00
module_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
module_utils.h Enforce layering_check in Bazel build rules. (#5032) 2022-12-20 10:54:46 -05:00
optimizer_test.cpp Rename strip reflect to strip nonsemantic (#4661) 2021-12-15 09:55:30 -05:00
pass_fixture.h CCP should mark IR changed if it created new constants. (#3732) 2020-08-20 16:48:11 -04:00
pass_manager_test.cpp Switch SPIRV-Tools to use spirv.hpp11 internally (#4981) 2022-11-04 17:27:10 -04:00
pass_merge_return_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
pass_remove_duplicates_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
pass_utils.cpp Check for unreachable blocks in merge-return. (#1966) 2018-10-10 15:18:15 -04:00
pass_utils.h Fix gtest.h include in test/opt/pass_utils.h 2018-10-12 10:22:25 -04:00
pch_test_opt.cpp Rename PCH macro to spvtools_pch to avoid conflicts with other projects. Also add pch to test/opt. (#2034) 2018-11-07 09:15:04 -05:00
pch_test_opt.h Rename PCH macro to spvtools_pch to avoid conflicts with other projects. Also add pch to test/opt. (#2034) 2018-11-07 09:15:04 -05:00
private_to_local_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
propagator_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
reduce_load_size_test.cpp Reduce load size does not work for array with spec const size (#4845) 2022-07-05 16:16:50 -04:00
redundancy_elimination_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
register_liveness.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
relax_float_ops_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
remove_dontinline_test.cpp Add pass to remove DontInline function control (#4747) 2022-03-07 12:45:17 -05:00
remove_unused_interface_variables_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
replace_desc_array_access_using_var_index_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
replace_invalid_opc_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
scalar_analysis.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
scalar_replacement_test.cpp Apply scalar replacement on vars with Pointer decorations (#5208) 2023-05-08 09:39:14 -04:00
set_spec_const_default_value_test.cpp Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
simplification_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
spread_volatile_semantics_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
strength_reduction_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
strip_debug_info_test.cpp Add support for SPV_KHR_non_semantic_info (#3110) 2019-12-18 18:10:29 -05:00
strip_nonsemantic_info_test.cpp reflect debug (#4662) 2021-12-15 11:06:51 -05:00
struct_cfg_analysis_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
switch_descriptorset_test.cpp opt: Add SwitchDescriptorSetPass (#5375) 2023-08-22 00:16:35 +00:00
trim_capabilities_pass_test.cpp opt: Add VulkanMemoryModelDeviceScope to trim (#5544) 2024-01-25 14:05:04 -05:00
type_manager_test.cpp Fix rebuilding types with circular references (#5623). (#5637) 2024-04-09 10:36:21 -04:00
types_test.cpp Apply scalar replacement on vars with Pointer decorations (#5208) 2023-05-08 09:39:14 -04:00
unify_const_test.cpp Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
upgrade_memory_model_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
utils_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
value_table_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
vector_dce_test.cpp Handle out-of-bounds accesses in VDCE (#4518) 2021-09-13 09:57:44 -04:00
workaround1209_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00
wrap_opkill_test.cpp spirv-opt: Remove unused includes and code (#5177) 2023-03-28 12:40:30 -04:00