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

Method IntersectsPath

source/opt/code_sink.cpp:294–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294bool CodeSinkingPass::IntersectsPath(uint32_t start, uint32_t end,
295 const std::unordered_set<uint32_t>& set) {
296 std::vector<uint32_t> worklist;
297 worklist.push_back(start);
298 std::unordered_set<uint32_t> already_done;
299 already_done.insert(start);
300
301 while (!worklist.empty()) {
302 BasicBlock* bb = context()->get_instr_block(worklist.back());
303 worklist.pop_back();
304
305 if (bb->id() == end) {
306 continue;
307 }
308
309 if (set.count(bb->id())) {
310 return true;
311 }
312
313 bb->ForEachSuccessorLabel([&already_done, &worklist](uint32_t* succ_bb_id) {
314 if (already_done.insert(*succ_bb_id).second) {
315 worklist.push_back(*succ_bb_id);
316 }
317 });
318 }
319 return false;
320}
321
322// namespace opt
323

Callers

nothing calls this directly

Calls 9

get_instr_blockMethod · 0.80
backMethod · 0.80
pop_backMethod · 0.80
ForEachSuccessorLabelMethod · 0.80
push_backMethod · 0.45
insertMethod · 0.45
emptyMethod · 0.45
idMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected