| 358 | } |
| 359 | |
| 360 | std::pair<std::vector<Instruction*>, std::vector<Instruction*>> |
| 361 | LoopFusion::GetLoadsAndStoresInLoop(Loop* loop) { |
| 362 | std::vector<Instruction*> loads{}; |
| 363 | std::vector<Instruction*> stores{}; |
| 364 | |
| 365 | for (auto block_id : loop->GetBlocks()) { |
| 366 | if (block_id == loop->GetContinueBlock()->id()) { |
| 367 | continue; |
| 368 | } |
| 369 | |
| 370 | for (auto& instruction : *containing_function_->FindBlock(block_id)) { |
| 371 | if (instruction.opcode() == spv::Op::OpLoad) { |
| 372 | loads.push_back(&instruction); |
| 373 | } else if (instruction.opcode() == spv::Op::OpStore) { |
| 374 | stores.push_back(&instruction); |
| 375 | } |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | return std::make_pair(loads, stores); |
| 380 | } |
| 381 | |
| 382 | bool LoopFusion::IsUsedInLoop(Instruction* instruction, Loop* loop) { |
| 383 | auto not_used = context_->get_def_use_mgr()->WhileEachUser( |
nothing calls this directly
no test coverage detected