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; } } */
| 43 | } |
| 44 | */ |
| 45 | TEST_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" |
| 101 | OpMemoryModel Logical GLSL450 |
| 102 | OpEntryPoint Fragment %2 "main" %3 |
nothing calls this directly
no test coverage detected