MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / TEST

Function TEST

test/fuzz/shrinker_test.cpp:32–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30namespace {
31
32TEST(ShrinkerTest, ReduceAddedFunctions) {
33 const std::string kReferenceModule = R"(
34 OpCapability Shader
35 %1 = OpExtInstImport "GLSL.std.450"
36 OpMemoryModel Logical GLSL450
37 OpEntryPoint Fragment %4 "main"
38 OpExecutionMode %4 OriginUpperLeft
39 OpSource ESSL 320
40 %2 = OpTypeVoid
41 %3 = OpTypeFunction %2
42 %6 = OpTypeInt 32 1
43 %7 = OpTypePointer Private %6
44 %8 = OpVariable %7 Private
45 %9 = OpConstant %6 2
46 %10 = OpTypePointer Function %6
47 %4 = OpFunction %2 None %3
48 %5 = OpLabel
49 %11 = OpVariable %10 Function
50 OpStore %8 %9
51 %12 = OpLoad %6 %8
52 OpStore %11 %12
53 OpReturn
54 OpFunctionEnd
55 )";
56
57 const std::string kDonorModule = R"(
58 OpCapability Shader
59 %1 = OpExtInstImport "GLSL.std.450"
60 OpMemoryModel Logical GLSL450
61 OpEntryPoint Fragment %4 "main"
62 OpExecutionMode %4 OriginUpperLeft
63 OpSource ESSL 320
64 %2 = OpTypeVoid
65 %3 = OpTypeFunction %2
66 %6 = OpTypeInt 32 1
67 %7 = OpTypePointer Function %6
68 %8 = OpTypeFunction %6 %7
69 %12 = OpTypeFunction %2 %7
70 %17 = OpConstant %6 0
71 %26 = OpTypeBool
72 %32 = OpConstant %6 1
73 %46 = OpTypePointer Private %6
74 %47 = OpVariable %46 Private
75 %48 = OpConstant %6 3
76 %4 = OpFunction %2 None %3
77 %5 = OpLabel
78 %49 = OpVariable %7 Function
79 %50 = OpVariable %7 Function
80 %51 = OpLoad %6 %49
81 OpStore %50 %51
82 %52 = OpFunctionCall %2 %14 %50
83 OpReturn
84 OpFunctionEnd
85 %10 = OpFunction %6 None %8
86 %9 = OpFunctionParameter %7
87 %11 = OpLabel
88 %16 = OpVariable %7 Function
89 %18 = OpVariable %7 Function

Callers

nothing calls this directly

Calls 13

IsValidAndWellFormedFunction · 0.85
ShrinkerClass · 0.85
getMethod · 0.80
DonateSingleModuleMethod · 0.80
BuildModuleFunction · 0.50
AssembleMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
moduleMethod · 0.45
opcodeMethod · 0.45
RunMethod · 0.45
result_idMethod · 0.45

Tested by

no test coverage detected