| 30 | namespace { |
| 31 | |
| 32 | TEST(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 |
nothing calls this directly
no test coverage detected