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

Method IsSafeToClone

source/opt/loop_descriptor.cpp:403–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401} // namespace
402
403bool Loop::IsSafeToClone() const {
404 CFG& cfg = *context_->cfg();
405
406 for (uint32_t bb_id : GetBlocks()) {
407 BasicBlock* bb = cfg.block(bb_id);
408 assert(bb);
409 if (!IsBasicBlockSafeToClone(context_, bb)) return false;
410 }
411
412 // Look at the merge construct.
413 if (GetHeaderBlock()->GetLoopMergeInst()) {
414 std::unordered_set<uint32_t> blocks;
415 GetMergingBlocks(&blocks);
416 blocks.erase(GetMergeBlock()->id());
417 for (uint32_t bb_id : blocks) {
418 BasicBlock* bb = cfg.block(bb_id);
419 assert(bb);
420 if (!IsBasicBlockSafeToClone(context_, bb)) return false;
421 }
422 }
423
424 return true;
425}
426
427bool Loop::IsLCSSA() const {
428 CFG* cfg = context_->cfg();

Callers 1

CanUnswitchLoopMethod · 0.80

Calls 6

IsBasicBlockSafeToCloneFunction · 0.85
GetLoopMergeInstMethod · 0.80
cfgMethod · 0.45
blockMethod · 0.45
eraseMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected