| 503 | } |
| 504 | |
| 505 | void MemPass::CollectTargetVars(Function* func) { |
| 506 | seen_target_vars_.clear(); |
| 507 | seen_non_target_vars_.clear(); |
| 508 | type2undefs_.clear(); |
| 509 | |
| 510 | // Collect target (and non-) variable sets. Remove variables with |
| 511 | // non-load/store refs from target variable set |
| 512 | for (auto& blk : *func) { |
| 513 | for (auto& inst : blk) { |
| 514 | switch (inst.opcode()) { |
| 515 | case spv::Op::OpStore: |
| 516 | case spv::Op::OpLoad: { |
| 517 | uint32_t varId; |
| 518 | (void)GetPtr(&inst, &varId); |
| 519 | if (!IsTargetVar(varId)) break; |
| 520 | if (HasOnlySupportedRefs(varId)) break; |
| 521 | seen_non_target_vars_.insert(varId); |
| 522 | seen_target_vars_.erase(varId); |
| 523 | } break; |
| 524 | default: |
| 525 | break; |
| 526 | } |
| 527 | } |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | } // namespace opt |
| 532 | } // namespace spvtools |
no test coverage detected