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

Method GetLoadsAndStoresInLoop

source/opt/loop_fusion.cpp:360–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360std::pair<std::vector<Instruction*>, std::vector<Instruction*>>
361LoopFusion::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
382bool LoopFusion::IsUsedInLoop(Instruction* instruction, Loop* loop) {
383 auto not_used = context_->get_def_use_mgr()->WhileEachUser(

Callers

nothing calls this directly

Calls 5

GetContinueBlockMethod · 0.80
FindBlockMethod · 0.80
idMethod · 0.45
opcodeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected