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

Function StripOpNameInstructionsToSet

test/opt/unify_const_test.cpp:79–93  ·  view source on GitHub ↗

A helper function to strip OpName instructions from the given string of disassembly code and put those debug instructions to a set. Returns the string with all OpName instruction stripped and a set of OpName instructions.

Source from the content-addressed store, hash-verified

77// string with all OpName instruction stripped and a set of OpName
78// instructions.
79std::tuple<std::string, std::unordered_set<std::string>>
80StripOpNameInstructionsToSet(const std::string& str) {
81 std::stringstream ss(str);
82 std::ostringstream oss;
83 std::string inst_str;
84 std::unordered_set<std::string> opname_instructions;
85 while (std::getline(ss, inst_str, '\n')) {
86 if (inst_str.find("OpName %") == std::string::npos) {
87 oss << inst_str << '\n';
88 } else {
89 opname_instructions.insert(inst_str);
90 }
91 }
92 return std::make_tuple(oss.str(), std::move(opname_instructions));
93}
94
95// The test fixture for all tests of UnifyConstantPass. This fixture defines
96// the rule of checking: all the optimized code should be exactly the same as

Callers 1

CheckMethod · 0.85

Calls 2

insertMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected