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

Method CollectNonSemanticTree

source/opt/ir_context.cpp:260–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260void IRContext::CollectNonSemanticTree(
261 Instruction* inst, std::unordered_set<Instruction*>* to_kill) {
262 if (!inst->HasResultId()) return;
263 // Debug[No]Line result id is not used, so we are done
264 if (inst->IsDebugLineInst()) return;
265 std::vector<Instruction*> work_list;
266 std::unordered_set<Instruction*> seen;
267 work_list.push_back(inst);
268
269 while (!work_list.empty()) {
270 auto* i = work_list.back();
271 work_list.pop_back();
272 get_def_use_mgr()->ForEachUser(
273 i, [&work_list, to_kill, &seen](Instruction* user) {
274 if (user->IsNonSemanticInstruction() && seen.insert(user).second) {
275 work_list.push_back(user);
276 to_kill->insert(user);
277 }
278 });
279 }
280}
281
282bool IRContext::KillDef(uint32_t id) {
283 Instruction* def = get_def_use_mgr()->GetDef(id);

Callers 1

EliminateFunctionFunction · 0.80

Calls 9

HasResultIdMethod · 0.80
IsDebugLineInstMethod · 0.80
backMethod · 0.80
pop_backMethod · 0.80
ForEachUserMethod · 0.80
push_backMethod · 0.45
emptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected