| 60 | }; |
| 61 | |
| 62 | TEST(ReducerTest, ExprToConstantAndRemoveUnreferenced) { |
| 63 | // Check that ExprToConstant and RemoveUnreferenced work together; once some |
| 64 | // ID uses have been changed to constants, those IDs can be removed. |
| 65 | std::string original = R"( |
| 66 | OpCapability Shader |
| 67 | %1 = OpExtInstImport "GLSL.std.450" |
| 68 | OpMemoryModel Logical GLSL450 |
| 69 | OpEntryPoint Fragment %4 "main" %60 |
| 70 | OpExecutionMode %4 OriginUpperLeft |
| 71 | OpSource ESSL 310 |
| 72 | OpName %4 "main" |
| 73 | OpName %16 "buf2" |
| 74 | OpMemberName %16 0 "i" |
| 75 | OpName %18 "" |
| 76 | OpName %25 "buf1" |
| 77 | OpMemberName %25 0 "f" |
| 78 | OpName %27 "" |
| 79 | OpName %60 "_GLF_color" |
| 80 | OpMemberDecorate %16 0 Offset 0 |
| 81 | OpDecorate %16 Block |
| 82 | OpDecorate %18 DescriptorSet 0 |
| 83 | OpDecorate %18 Binding 2 |
| 84 | OpMemberDecorate %25 0 Offset 0 |
| 85 | OpDecorate %25 Block |
| 86 | OpDecorate %27 DescriptorSet 0 |
| 87 | OpDecorate %27 Binding 1 |
| 88 | OpDecorate %60 Location 0 |
| 89 | %2 = OpTypeVoid |
| 90 | %3 = OpTypeFunction %2 |
| 91 | %6 = OpTypeInt 32 1 |
| 92 | %9 = OpConstant %6 0 |
| 93 | %16 = OpTypeStruct %6 |
| 94 | %17 = OpTypePointer Uniform %16 |
| 95 | %18 = OpVariable %17 Uniform |
| 96 | %19 = OpTypePointer Uniform %6 |
| 97 | %22 = OpTypeBool |
| 98 | %100 = OpConstantTrue %22 |
| 99 | %24 = OpTypeFloat 32 |
| 100 | %25 = OpTypeStruct %24 |
| 101 | %26 = OpTypePointer Uniform %25 |
| 102 | %27 = OpVariable %26 Uniform |
| 103 | %28 = OpTypePointer Uniform %24 |
| 104 | %31 = OpConstant %24 2 |
| 105 | %56 = OpConstant %6 1 |
| 106 | %58 = OpTypeVector %24 4 |
| 107 | %59 = OpTypePointer Output %58 |
| 108 | %60 = OpVariable %59 Output |
| 109 | %72 = OpUndef %24 |
| 110 | %74 = OpUndef %6 |
| 111 | %4 = OpFunction %2 None %3 |
| 112 | %5 = OpLabel |
| 113 | OpBranch %10 |
| 114 | %10 = OpLabel |
| 115 | %73 = OpPhi %6 %74 %5 %77 %34 |
| 116 | %71 = OpPhi %24 %72 %5 %76 %34 |
| 117 | %70 = OpPhi %6 %9 %5 %57 %34 |
| 118 | %20 = OpAccessChain %19 %18 %9 |
| 119 | %21 = OpLoad %6 %20 |
nothing calls this directly
no test coverage detected