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

Method GetMergingBlocks

source/opt/loop_descriptor.cpp:370–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370void Loop::GetMergingBlocks(
371 std::unordered_set<uint32_t>* merging_blocks) const {
372 assert(GetMergeBlock() && "This loop is not structured");
373 CFG* cfg = context_->cfg();
374 merging_blocks->clear();
375
376 std::stack<const BasicBlock*> to_visit;
377 to_visit.push(GetMergeBlock());
378 while (!to_visit.empty()) {
379 const BasicBlock* bb = to_visit.top();
380 to_visit.pop();
381 merging_blocks->insert(bb->id());
382 for (uint32_t pred_id : cfg->preds(bb->id())) {
383 if (!IsInsideLoop(pred_id) && !merging_blocks->count(pred_id)) {
384 to_visit.push(cfg->block(pred_id));
385 }
386 }
387 }
388}
389
390namespace {
391

Callers 1

MakeLoopClosedSSAMethod · 0.80

Calls 7

cfgMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
insertMethod · 0.45
idMethod · 0.45
countMethod · 0.45
blockMethod · 0.45

Tested by

no test coverage detected