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

Function CheckOptimization

test/cpp_interface_test.cpp:227–240  ·  view source on GitHub ↗

Checks that after running the given optimizer |opt| on the given |original| source code, we can get the given |optimized| source code.

Source from the content-addressed store, hash-verified

225// Checks that after running the given optimizer |opt| on the given |original|
226// source code, we can get the given |optimized| source code.
227void CheckOptimization(const std::string& original,
228 const std::string& optimized, const Optimizer& opt) {
229 SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
230 std::vector<uint32_t> original_binary;
231 ASSERT_TRUE(t.Assemble(original, &original_binary));
232
233 std::vector<uint32_t> optimized_binary;
234 EXPECT_TRUE(opt.Run(original_binary.data(), original_binary.size(),
235 &optimized_binary));
236
237 std::string optimized_text;
238 EXPECT_TRUE(t.Disassemble(optimized_binary, &optimized_text));
239 EXPECT_EQ(optimized, optimized_text);
240}
241
242TEST(CppInterface, OptimizeEmptyModule) {
243 SpirvTools t(SPV_ENV_UNIVERSAL_1_1);

Callers 1

TESTFunction · 0.85

Calls 5

AssembleMethod · 0.45
RunMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
DisassembleMethod · 0.45

Tested by

no test coverage detected