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

Function TEST_F

test/opt/loop_optimizations/unroll_simple.cpp:45–194  ·  view source on GitHub ↗

Generated from the following GLSL #version 330 core layout(location = 0) out vec4 c; void main() { float x[4]; for (int i = 0; i < 4; ++i) { x[i] = 1.0f; } } */

Source from the content-addressed store, hash-verified

43}
44*/
45TEST_F(PassClassTest, SimpleFullyUnrollTest) {
46 // With LocalMultiStoreElimPass
47 const std::string text = R"(
48 OpCapability Shader
49 %1 = OpExtInstImport "GLSL.std.450"
50 OpMemoryModel Logical GLSL450
51 OpEntryPoint Fragment %2 "main" %3
52 OpExecutionMode %2 OriginUpperLeft
53 OpSource GLSL 330
54 OpName %2 "main"
55 OpName %5 "x"
56 OpName %3 "c"
57 OpDecorate %3 Location 0
58 %6 = OpTypeVoid
59 %7 = OpTypeFunction %6
60 %8 = OpTypeInt 32 1
61 %9 = OpTypePointer Function %8
62 %10 = OpConstant %8 0
63 %11 = OpConstant %8 4
64 %12 = OpTypeBool
65 %13 = OpTypeFloat 32
66 %14 = OpTypeInt 32 0
67 %15 = OpConstant %14 4
68 %16 = OpTypeArray %13 %15
69 %17 = OpTypePointer Function %16
70 %18 = OpConstant %13 1
71 %19 = OpTypePointer Function %13
72 %20 = OpConstant %8 1
73 %21 = OpTypeVector %13 4
74 %22 = OpTypePointer Output %21
75 %3 = OpVariable %22 Output
76 %2 = OpFunction %6 None %7
77 %23 = OpLabel
78 %5 = OpVariable %17 Function
79 OpBranch %24
80 %24 = OpLabel
81 %35 = OpPhi %8 %10 %23 %34 %26
82 OpLoopMerge %25 %26 Unroll
83 OpBranch %27
84 %27 = OpLabel
85 %29 = OpSLessThan %12 %35 %11
86 OpBranchConditional %29 %30 %25
87 %30 = OpLabel
88 %32 = OpAccessChain %19 %5 %35
89 OpStore %32 %18
90 OpBranch %26
91 %26 = OpLabel
92 %34 = OpIAdd %8 %35 %20
93 OpBranch %24
94 %25 = OpLabel
95 OpReturn
96 OpFunctionEnd
97 )";
98
99 const std::string output = R"(OpCapability Shader
100%1 = OpExtInstImport "GLSL.std.450"
101OpMemoryModel Logical GLSL450
102OpEntryPoint Fragment %2 "main" %3

Callers

nothing calls this directly

Calls 15

GetFunctionFunction · 0.85
NumLoopsMethod · 0.80
HasUnrollLoopControlMethod · 0.80
FindConditionBlockMethod · 0.80
FindConditionVariableMethod · 0.80
getMethod · 0.80
CanPerformUnrollMethod · 0.80
ctailMethod · 0.80
NumImmediateChildrenMethod · 0.80
FullyUnrollMethod · 0.80
FinalizeMethod · 0.80

Tested by

no test coverage detected