| 401 | } // namespace |
| 402 | |
| 403 | bool 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 | |
| 427 | bool Loop::IsLCSSA() const { |
| 428 | CFG* cfg = context_->cfg(); |
no test coverage detected