#include <algorithm>
#include <string>
#include <unordered_set>
#include <vector>
#include "test/opt/assembly_builder.h"
#include "test/opt/pass_fixture.h"
#include "test/opt/pass_utils.h"
namespace spvtools {
namespace opt {
namespace {
using EliminateDeadConstantBasicTest = PassTest<::testing::Test>;
TEST_F(EliminateDeadConstantBasicTest, BasicAllDeadConstants) {
const std::vector<const char*> text = {
"OpCapability Shader",
"OpCapability Float64",
"%1 = OpExtInstImport \"GLSL.std.450\"",
"OpMemoryModel Logical GLSL450",
"OpEntryPoint Vertex %main \"main\"",
"OpName %main \"main\"",
"%void = OpTypeVoid",
"%4 = OpTypeFunction %void",
"%bool = OpTypeBool",
"%true = OpConstantTrue %bool",
"%false = OpConstantFalse %bool",
"%int = OpTypeInt 32 1",
"%9 = OpConstant %int 1",
"%uint = OpTypeInt 32 0",
"%11 = OpConstant %uint 2",
"%float = OpTypeFloat 32",
"%13 = OpConstant %float 3.1415",
"%double = OpTypeFloat 64",
"%15 = OpConstant %double 3.14159265358979",
"%main = OpFunction %void None %4",
"%16 = OpLabel",
"OpReturn",
"OpFunctionEnd",
};
const char* const_decl_opcodes[] = {
" OpConstantTrue ",
" OpConstantFalse ",
" OpConstant ",
};
const std::string expected_disassembly =
SelectiveJoin(text, [&const_decl_opcodes](const char* line) {
return std::any_of(
std::begin(const_decl_opcodes), std::end(const_decl_opcodes),
[&line](const char* const_decl_op) {
return std::string(line).find(const_decl_op) != std::string::npos;
});
});
SinglePassRunAndCheck<EliminateDeadConstantPass>(
JoinAllInsts(text), expected_disassembly, true);
}
TEST_F(EliminateDeadConstantBasicTest, BasicNoneDeadConstants) {
const std::vector<const char*> text = {
"OpCapability Shader",
"OpCapability Float64",
"%1 = OpExtInstImport \"GLSL.std.450\"",
"OpMemoryModel Logical GLSL450",
"OpEntryPoint Vertex %main \"main\"",
"OpName %main \"main\"",
"OpName %btv \"btv\"",
"OpName %bfv \"bfv\"",
"OpName %iv \"iv\"",
"OpName %uv \"uv\"",
"OpName %fv \"fv\"",
"OpName %dv \"dv\"",
"%void = OpTypeVoid",
"%10 = OpTypeFunction %void",
"%bool = OpTypeBool",
"%_ptr_Function_bool = OpTypePointer Function %bool",
"%true = OpConstantTrue %bool",
"%false = OpConstantFalse %bool",
"%int = OpTypeInt 32 1",
"%_ptr_Function_int = OpTypePointer Function %int",
"%int_1 = OpConstant %int 1",
"%uint = OpTypeInt 32 0",
"%_ptr_Function_uint = OpTypePointer Function %uint",
"%uint_2 = OpConstant %uint 2",
"%float = OpTypeFloat 32",
"%_ptr_Function_float = OpTypePointer Function %float",
"%float_3_1415 = OpConstant %float 3.1415",
"%double = OpTypeFloat 64",
"%_ptr_Function_double = OpTypePointer Function %double",
"%double_3_14159265358979 = OpConstant %double 3.14159265358979",
"%main = OpFunction %void None %10",
"%27 = OpLabel",
"%btv = OpVariable %_ptr_Function_bool Function",
"%bfv = OpVariable %_ptr_Function_bool Function",
"%iv = OpVariable %_ptr_Function_int Function",
"%uv = OpVariable %_ptr_Function_uint Function",
"%fv = OpVariable %_ptr_Function_float Function",
"%dv = OpVariable %_ptr_Function_double Function",
"OpStore %btv %true",
"OpStore %bfv %false",
"OpStore %iv %int_1",
"OpStore %uv %uint_2",
"OpStore %fv %float_3_1415",
"OpStore %dv %double_3_14159265358979",
"OpReturn",
"OpFunctionEnd",
};
SinglePassRunAndCheck<EliminateDeadConstantPass>(
JoinAllInsts(text), JoinAllInsts(text), true);
}
struct EliminateDeadConstantTestCase {
std::vector<std::string> used_consts;
std::vector<std::string> main_insts;
std::vector<std::string> dead_consts;
};
const std::vector<std::string> CommonTypes = {
"%bool = OpTypeBool",
"%uint = OpTypeInt 32 0",
"%int = OpTypeInt 32 1",
"%float = OpTypeFloat 32",
"%double = OpTypeFloat 64",
"%v2bool = OpTypeVector %bool 2",
"%v2uint = OpTypeVector %uint 2",
"%v2int = OpTypeVector %int 2",
"%v3int = OpTypeVector %int 3",
"%v4int = OpTypeVector %int 4",
"%v2float = OpTypeVector %float 2",
"%v3float = OpTypeVector %float 3",
"%v2double = OpTypeVector %double 2",
"%_pf_bool = OpTypePointer Function %bool",
"%_pf_uint = OpTypePointer Function %uint",
"%_pf_int = OpTypePointer Function %int",
"%_pf_float = OpTypePointer Function %float",
"%_pf_double = OpTypePointer Function %double",
"%_pf_v2int = OpTypePointer Function %v2int",
"%_pf_v3int = OpTypePointer Function %v3int",
"%_pf_v2float = OpTypePointer Function %v2float",
"%_pf_v3float = OpTypePointer Function %v3float",
"%_pf_v2double = OpTypePointer Function %v2double",
"%inner_struct = OpTypeStruct %bool %int %float %double",
"%outer_struct = OpTypeStruct %inner_struct %int %double",
"%flat_struct = OpTypeStruct %bool %int %float %double",
};
using EliminateDeadConstantTest =
PassTest<::testing::TestWithParam<EliminateDeadConstantTestCase>>;
TEST_P(EliminateDeadConstantTest, Custom) {
auto& tc = GetParam();
AssemblyBuilder builder;
builder.AppendTypesConstantsGlobals(CommonTypes)
.AppendTypesConstantsGlobals(tc.used_consts)
.AppendInMain(tc.main_insts);
const std::string expected = builder.GetCode();
builder.AppendTypesConstantsGlobals(tc.dead_consts);
const std::string assembly_with_dead_const = builder.GetCode();
SinglePassRunAndCheck<EliminateDeadConstantPass>(
assembly_with_dead_const, expected, true);
}
INSTANTIATE_TEST_SUITE_P(
ScalarTypeConstants, EliminateDeadConstantTest,
::testing::ValuesIn(std::vector<EliminateDeadConstantTestCase>({
{
{
"%used_const_int = OpConstant %int 1",
},
{
"%int_var = OpVariable %_pf_int Function",
"OpStore %int_var %used_const_int",
},
{
"%dead_const_int = OpConstant %int 1",
},
},
{
{
"%used_const_uint = OpConstant %uint 1",
},
{
"%uint_var = OpVariable %_pf_uint Function",
"OpStore %uint_var %used_const_uint",
},
{
"%dead_const_uint = OpConstant %uint 1",
},
},
{
{
"%used_const_float = OpConstant %float 3.1415",
},
{
"%float_var = OpVariable %_pf_float Function",
"OpStore %float_var %used_const_float",
},
{
"%dead_const_float = OpConstant %float 3.1415",
},
},
{
{
"%used_const_double = OpConstant %double 3.141592653",
},
{
"%double_var = OpVariable %_pf_double Function",
"OpStore %double_var %used_const_double",
},
{
"%dead_const_double = OpConstant %double 3.141592653",
},
},
})));
INSTANTIATE_TEST_SUITE_P(
VectorTypeConstants, EliminateDeadConstantTest,
::testing::ValuesIn(std::vector<EliminateDeadConstantTestCase>({
{
{
"%used_int_x = OpConstant %int 1",
"%used_int_y = OpConstant %int 2",
"%used_v2int = OpConstantComposite %v2int %used_int_x %used_int_y",
},
{
"%v2int_var = OpVariable %_pf_v2int Function",
"OpStore %v2int_var %used_v2int",
},
{
"%dead_int_x = OpConstant %int 1",
"%dead_int_y = OpConstant %int 2",
"%dead_v2int = OpConstantComposite %v2int %dead_int_x %dead_int_y",
},
},
{
{
"%used_int_x = OpConstant %int 1",
"%used_int_y = OpConstant %int 2",
"%used_int_z = OpConstant %int 3",
"%used_v3int = OpConstantComposite %v3int %used_int_x %used_int_y %used_int_z",
},
{
"%v3int_var = OpVariable %_pf_v3int Function",
"OpStore %v3int_var %used_v3int",
},
{
"%dead_v3int = OpConstantComposite %v3int %used_int_x %used_int_y %used_int_z",
},
},
{
{
"%used_float_x = OpConstant %float 3.1415",
"%used_float_y = OpConstant %float 4.25",
"%used_v2float = OpConstantComposite %v2float %used_float_x %used_float_y",
},
{
"%v2float_var = OpVariable %_pf_v2float Function",
"OpStore %v2float_var %used_v2float",
},
{
"%dead_float_x = OpConstant %float 3.1415",
"%dead_float_y = OpConstant %float 4.25",
"%dead_v2float = OpConstantComposite %v2float %dead_float_x %dead_float_y",
},
},
{
{
"%used_float_x = OpConstant %float 3.1415",
"%used_float_y = OpConstant %float 4.25",
"%used_float_z = OpConstant %float 4.75",
"%used_v3float = OpConstantComposite %v3float %used_float_x %used_float_y %used_float_z",
},
{
"%v3float_var = OpVariable %_pf_v3float Function",
"OpStore %v3float_var %used_v3float",
},
{
"%dead_v3float = OpConstantComposite %v3float %used_float_x %used_float_y %used_float_z",
},
},
})));
INSTANTIATE_TEST_SUITE_P(
StructTypeConstants, EliminateDeadConstantTest,
::testing::ValuesIn(std::vector<EliminateDeadConstantTestCase>({
{
{},
{},
{
"%dead_bool = OpConstantTrue %bool",
"%dead_int = OpConstant %int 1",
"%dead_float = OpConstant %float 2.5",
"%dead_double = OpConstant %double 3.14159265358979",
"%dead_struct = OpConstantComposite %flat_struct %dead_bool %dead_int %dead_float %dead_double",
},
},
{
{
"%used_int = OpConstant %int 1",
"%used_double = OpConstant %double 3.14159265358979",
},
{
"%int_var = OpVariable %_pf_int Function",
"OpStore %int_var %used_int",
"%double_var = OpVariable %_pf_double Function",
"OpStore %double_var %used_double",
},
{
"%dead_bool = OpConstantTrue %bool",
"%dead_float = OpConstant %float 2.5",
"%dead_struct = OpConstantComposite %flat_struct %dead_bool %used_int %dead_float %used_double",
},
},
{
{},
{},
{
"%dead_bool = OpConstantTrue %bool",
"%dead_int = OpConstant %int 1",
"%dead_float = OpConstant %float 2.5",
"%dead_double = OpConstant %double 3.1415926535",
"%dead_inner_struct = OpConstantComposite %inner_struct %dead_bool %dead_int %dead_float %dead_double",
"%dead_int2 = OpConstant %int 2",
"%dead_double2 = OpConstant %double 1.428571428514",
"%dead_outer_struct = OpConstantComposite %outer_struct %dead_inner_struct %dead_int2 %dead_double2",
},
},
{
{
"%used_int = OpConstant %int 1",
"%used_double = OpConstant %double 3.14159265358979",
},
{
"%int_var = OpVariable %_pf_int Function",
"OpStore %int_var %used_int",
"%double_var = OpVariable %_pf_double Function",
"OpStore %double_var %used_double",
},
{
"%dead_bool = OpConstantTrue %bool",
"%dead_float = OpConstant %float 2.5",
"%dead_inner_struct = OpConstantComposite %inner_struct %dead_bool %used_int %dead_float %used_double",
"%dead_int = OpConstant %int 2",
"%dead_outer_struct = OpConstantComposite %outer_struct %dead_inner_struct %dead_int %used_double",
},
},
{
{
"%used_bool = OpConstantTrue %bool",
"%used_int = OpConstant %int 1",
"%used_float = OpConstant %float 1.25",
"%used_double = OpConstant %double 1.23456789012345",
"%used_inner_struct = OpConstantComposite %inner_struct %used_bool %used_int %used_float %used_double",
},
{
"%bool_var = OpVariable %_pf_bool Function",
"%bool_from_inner_struct = OpCompositeExtract %bool %used_inner_struct 0",
"OpStore %bool_var %bool_from_inner_struct",
},
{
"%dead_int = OpConstant %int 2",
"%dead_outer_struct = OpConstantComposite %outer_struct %used_inner_struct %dead_int %used_double"
},
},
{
{
"%used_bool = OpConstantTrue %bool",
"%used_int = OpConstant %int 1",
"%used_float = OpConstant %float 1.25",
"%used_double = OpConstant %double 1.23456789012345",
"%used_inner_struct = OpConstantComposite %inner_struct %used_bool %used_int %used_float %used_double",
"%used_outer_struct = OpConstantComposite %outer_struct %used_inner_struct %used_int %used_double"
},
{
"%int_var = OpVariable %_pf_int Function",
"%int_from_outer_struct = OpCompositeExtract %int %used_outer_struct 1",
"OpStore %int_var %int_from_outer_struct",
},
{},
},
})));
INSTANTIATE_TEST_SUITE_P(
ScalarTypeSpecConstants, EliminateDeadConstantTest,
::testing::ValuesIn(std::vector<EliminateDeadConstantTestCase>({
{
{
"%used_bool = OpSpecConstantTrue %bool",
"%used_uint = OpSpecConstant %uint 2",
"%used_int = OpSpecConstant %int 2",
"%used_float = OpSpecConstant %float 2.5",
"%used_double = OpSpecConstant %double 1.42857142851",
},
{
"%bool_var = OpVariable %_pf_bool Function",
"%uint_var = OpVariable %_pf_uint Function",
"%int_var = OpVariable %_pf_int Function",
"%float_var = OpVariable %_pf_float Function",
"%double_var = OpVariable %_pf_double Function",
"OpStore %bool_var %used_bool", "OpStore %uint_var %used_uint",
"OpStore %int_var %used_int", "OpStore %float_var %used_float",
"OpStore %double_var %used_double",
},
{
"%dead_bool = OpSpecConstantTrue %bool",
"%dead_uint = OpSpecConstant %uint 2",
"%dead_int = OpSpecConstant %int 2",
"%dead_float = OpSpecConstant %float 2.5",
"%dead_double = OpSpecConstant %double 1.42857142851",
},
},
})));
INSTANTIATE_TEST_SUITE_P(
VectorTypeSpecConstants, EliminateDeadConstantTest,
::testing::ValuesIn(std::vector<EliminateDeadConstantTestCase>({
{
{
"%used_bool = OpSpecConstantTrue %bool",
},
{
"%bool_var = OpVariable %_pf_bool Function",
"OpStore %bool_var %used_bool",
},
{
"%dead_bool = OpSpecConstantFalse %bool",
"%dead_bool_vec1 = OpSpecConstantComposite %v2bool %dead_bool %dead_bool",
"%dead_bool_vec2 = OpSpecConstantComposite %v2bool %dead_bool %used_bool",
},
},
{
{
"%used_uint = OpSpecConstant %uint 3",
},
{
"%uint_var = OpVariable %_pf_uint Function",
"OpStore %uint_var %used_uint",
},
{
"%dead_uint = OpSpecConstant %uint 1",
"%dead_uint_vec1 = OpSpecConstantComposite %v2uint %dead_uint %dead_uint",
"%dead_uint_vec2 = OpSpecConstantComposite %v2uint %dead_uint %used_uint",
},
},
{
{
"%used_int = OpSpecConstant %int 3",
},
{
"%int_var = OpVariable %_pf_int Function",
"OpStore %int_var %used_int",
},
{
"%dead_int = OpSpecConstant %int 1",
"%dead_int_vec1 = OpSpecConstantComposite %v2int %dead_int %dead_int",
"%dead_int_vec2 = OpSpecConstantComposite %v2int %dead_int %used_int",
},
},
{
{
"%used_spec_int = OpSpecConstant %int 3",
"%used_front_end_int = OpConstant %int 3",
},
{
"%int_var1 = OpVariable %_pf_int Function",
"OpStore %int_var1 %used_spec_int",
"%int_var2 = OpVariable %_pf_int Function",
"OpStore %int_var2 %used_front_end_int",
},
{
"%dead_spec_int = OpSpecConstant %int 1",
"%dead_front_end_int = OpConstant %int 1",
"%dead_int_vec1 = OpSpecConstantComposite %v2int %dead_spec_int %dead_front_end_int",
"%dead_int_vec2 = OpSpecConstantComposite %v2int %dead_spec_int %used_front_end_int",
"%dead_int_vec3 = OpSpecConstantComposite %v2int %dead_front_end_int %used_spec_int",
},
},
})));
INSTANTIATE_TEST_SUITE_P(
SpecConstantOp, EliminateDeadConstantTest,
::testing::ValuesIn(std::vector<EliminateDeadConstantTestCase>({
{
{},
{},
{
"%signed_zero = OpConstant %int 0",
"%signed_zero_vec = OpConstantComposite %v2int %signed_zero %signed_zero",
"%unsigned_zero = OpConstant %uint 0",
"%unsigned_zero_vec = OpConstantComposite %v2uint %unsigned_zero %unsigned_zero",
"%signed_one = OpConstant %int 1",
"%signed_one_vec = OpConstantComposite %v2int %signed_one %signed_one",
"%unsigned_one = OpConstant %uint 1",
"%unsigned_one_vec = OpConstantComposite %v2uint %unsigned_one %unsigned_one",
"%dead_bool = OpSpecConstantTrue %bool",
"%dead_uint = OpSpecConstant %uint 1",
"%dead_int = OpSpecConstant %int 2",
"%dead_bool_vec = OpSpecConstantComposite %v2bool %dead_bool %dead_bool",
"%dead_uint_vec = OpSpecConstantComposite %v2uint %dead_uint %dead_uint",
"%dead_int_vec = OpSpecConstantComposite %v2int %dead_int %dead_int",
"%int_to_bool = OpSpecConstantOp %bool INotEqual %dead_int %signed_zero",
"%uint_to_bool = OpSpecConstantOp %bool INotEqual %dead_uint %unsigned_zero",
"%int_to_bool_vec = OpSpecConstantOp %v2bool INotEqual %dead_int_vec %signed_zero_vec",
"%uint_to_bool_vec = OpSpecConstantOp %v2bool INotEqual %dead_uint_vec %unsigned_zero_vec",
"%bool_to_int = OpSpecConstantOp %int Select %dead_bool %signed_one %signed_zero",
"%uint_to_int = OpSpecConstantOp %uint IAdd %dead_uint %unsigned_zero",
"%bool_to_int_vec = OpSpecConstantOp %v2int Select %dead_bool_vec %signed_one_vec %signed_zero_vec",
"%uint_to_int_vec = OpSpecConstantOp %v2uint IAdd %dead_uint_vec %unsigned_zero_vec",
"%bool_to_uint = OpSpecConstantOp %uint Select %dead_bool %unsigned_one %unsigned_zero",
"%int_to_uint_vec = OpSpecConstantOp %uint IAdd %dead_int %signed_zero",
"%bool_to_uint_vec = OpSpecConstantOp %v2uint Select %dead_bool_vec %unsigned_one_vec %unsigned_zero_vec",
"%int_to_uint = OpSpecConstantOp %v2uint IAdd %dead_int_vec %signed_zero_vec",
},
},
{
{},
{},
{
"%dead_spec_int_a = OpSpecConstant %int 1",
"%dead_spec_int_a_vec = OpSpecConstantComposite %v2int %dead_spec_int_a %dead_spec_int_a",
"%dead_spec_int_b = OpSpecConstant %int 2",
"%dead_spec_int_b_vec = OpSpecConstantComposite %v2int %dead_spec_int_b %dead_spec_int_b",
"%dead_const_int_c = OpConstant %int 3",
"%dead_const_int_c_vec = OpConstantComposite %v2int %dead_const_int_c %dead_const_int_c",
"%add_a_b = OpSpecConstantOp %int IAdd %dead_spec_int_a %dead_spec_int_b",
"%add_a_b_vec = OpSpecConstantOp %v2int IAdd %dead_spec_int_a_vec %dead_spec_int_b_vec",
"%sub_a_b = OpSpecConstantOp %int ISub %dead_spec_int_a %dead_spec_int_b",
"%sub_a_b_vec = OpSpecConstantOp %v2int ISub %dead_spec_int_a_vec %dead_spec_int_b_vec",
"%mul_a_b = OpSpecConstantOp %int IMul %dead_spec_int_a %dead_spec_int_b",
"%mul_a_b_vec = OpSpecConstantOp %v2int IMul %dead_spec_int_a_vec %dead_spec_int_b_vec",
"%div_a_b = OpSpecConstantOp %int SDiv %dead_spec_int_a %dead_spec_int_b",
"%div_a_b_vec = OpSpecConstantOp %v2int SDiv %dead_spec_int_a_vec %dead_spec_int_b_vec",
"%xor_a_b = OpSpecConstantOp %int BitwiseXor %dead_spec_int_a %dead_spec_int_b",
"%xor_a_b_vec = OpSpecConstantOp %v2int BitwiseXor %dead_spec_int_a_vec %dead_spec_int_b_vec",
"%less_a_b = OpSpecConstantOp %bool SLessThan %dead_spec_int_a %dead_spec_int_b",
},
},
{
{
"%used_int = OpConstant %int 3",
},
{
"%int_var = OpVariable %_pf_int Function",
"OpStore %int_var %used_int",
},
{
"%dead_int = OpConstant %int 3",
"%dead_spec_int_a = OpSpecConstant %int 1",
"%vec_a = OpSpecConstantComposite %v4int %dead_spec_int_a %dead_spec_int_a %dead_int %dead_int",
"%dead_spec_int_b = OpSpecConstant %int 2",
"%vec_b = OpSpecConstantComposite %v4int %dead_spec_int_b %dead_spec_int_b %used_int %used_int",
"%a_x = OpSpecConstantOp %int CompositeExtract %vec_a 0",
"%b_x = OpSpecConstantOp %int CompositeExtract %vec_b 0",
"%a_xy = OpSpecConstantOp %v2int VectorShuffle %vec_a %vec_a 0 1",
"%b_xy = OpSpecConstantOp %v2int VectorShuffle %vec_b %vec_b 0 1",
},
},
{
{
"%used_int = OpConstant %int 3",
"%used_spec_int_a = OpSpecConstant %int 1",
"%used_spec_int_b = OpSpecConstant %int 2",
"%vec_a = OpSpecConstantComposite %v4int %used_spec_int_a %used_spec_int_a %used_int %used_int",
"%vec_b = OpSpecConstantComposite %v4int %used_spec_int_b %used_spec_int_b %used_int %used_int",
"%a_xy = OpSpecConstantOp %v2int VectorShuffle %vec_a %vec_a 0 1",
"%b_xy = OpSpecConstantOp %v2int VectorShuffle %vec_b %vec_b 0 1",
},
{
"%v2int_var_a = OpVariable %_pf_v2int Function",
"%v2int_var_b = OpVariable %_pf_v2int Function",
"OpStore %v2int_var_a %a_xy",
"OpStore %v2int_var_b %b_xy",
},
{},
},
})));
INSTANTIATE_TEST_SUITE_P(
LongDefUseChain, EliminateDeadConstantTest,
::testing::ValuesIn(std::vector<EliminateDeadConstantTestCase>({
{
{
"%array_size = OpConstant %int 4",
"%type_arr_int_4 = OpTypeArray %int %array_size",
"%used_int_0 = OpConstant %int 100",
"%used_int_1 = OpConstant %int 1",
"%used_int_2 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_1",
"%used_int_3 = OpSpecConstantOp %int ISub %used_int_0 %used_int_2",
"%used_int_4 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_3",
"%used_int_5 = OpSpecConstantOp %int ISub %used_int_0 %used_int_4",
"%used_int_6 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_5",
"%used_int_7 = OpSpecConstantOp %int ISub %used_int_0 %used_int_6",
"%used_int_8 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_7",
"%used_int_9 = OpSpecConstantOp %int ISub %used_int_0 %used_int_8",
"%used_int_10 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_9",
"%used_int_11 = OpSpecConstantOp %int ISub %used_int_0 %used_int_10",
"%used_int_12 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_11",
"%used_int_13 = OpSpecConstantOp %int ISub %used_int_0 %used_int_12",
"%used_int_14 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_13",
"%used_int_15 = OpSpecConstantOp %int ISub %used_int_0 %used_int_14",
"%used_int_16 = OpSpecConstantOp %int ISub %used_int_0 %used_int_15",
"%used_int_17 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_16",
"%used_int_18 = OpSpecConstantOp %int ISub %used_int_0 %used_int_17",
"%used_int_19 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_18",
"%used_int_20 = OpSpecConstantOp %int ISub %used_int_0 %used_int_19",
"%used_vec_a = OpSpecConstantComposite %v2int %used_int_18 %used_int_19",
"%used_vec_b = OpSpecConstantOp %v2int IMul %used_vec_a %used_vec_a",
"%used_int_21 = OpSpecConstantOp %int CompositeExtract %used_vec_b 0",
"%used_array = OpConstantComposite %type_arr_int_4 %used_int_20 %used_int_20 %used_int_21 %used_int_21",
},
{
"%int_var = OpVariable %_pf_int Function",
"%used_array_2 = OpCompositeExtract %int %used_array 2",
"OpStore %int_var %used_array_2",
},
{
"%dead_int_1 = OpConstant %int 2",
"%dead_int_2 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_1",
"%dead_int_3 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_2",
"%dead_int_4 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_3",
"%dead_int_5 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_4",
"%dead_int_6 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_5",
"%dead_int_7 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_6",
"%dead_int_8 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_7",
"%dead_int_9 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_8",
"%dead_int_10 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_9",
"%dead_int_11 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_10",
"%dead_int_12 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_11",
"%dead_int_13 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_12",
"%dead_int_14 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_13",
"%dead_int_15 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_14",
"%dead_int_16 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_15",
"%dead_int_17 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_16",
"%dead_int_18 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_17",
"%dead_int_19 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_18",
"%dead_int_20 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_19",
"%dead_vec_a = OpSpecConstantComposite %v2int %dead_int_18 %dead_int_19",
"%dead_vec_b = OpSpecConstantOp %v2int IMul %dead_vec_a %dead_vec_a",
"%dead_int_21 = OpSpecConstantOp %int CompositeExtract %dead_vec_b 0",
"%dead_array = OpConstantComposite %type_arr_int_4 %dead_int_20 %used_int_20 %dead_int_19 %used_int_19",
},
},
})));
}
}
}