| 715 | } |
| 716 | |
| 717 | bool InlinePass::IsInlinableFunctionCall(const Instruction* inst) { |
| 718 | if (inst->opcode() != spv::Op::OpFunctionCall) return false; |
| 719 | const uint32_t calleeFnId = |
| 720 | inst->GetSingleWordOperand(kSpvFunctionCallFunctionId); |
| 721 | const auto ci = inlinable_.find(calleeFnId); |
| 722 | if (ci == inlinable_.cend()) return false; |
| 723 | |
| 724 | if (early_return_funcs_.find(calleeFnId) != early_return_funcs_.end()) { |
| 725 | // We rely on the merge-return pass to handle the early return case |
| 726 | // in advance. |
| 727 | std::string message = |
| 728 | "The function '" + id2function_[calleeFnId]->DefInst().PrettyPrint() + |
| 729 | "' could not be inlined because the return instruction " |
| 730 | "is not at the end of the function. This could be fixed by " |
| 731 | "running merge-return before inlining."; |
| 732 | consumer()(SPV_MSG_WARNING, "", {0, 0, 0}, message.c_str()); |
| 733 | return false; |
| 734 | } |
| 735 | |
| 736 | return true; |
| 737 | } |
| 738 | |
| 739 | void InlinePass::UpdateSucceedingPhis( |
| 740 | std::vector<std::unique_ptr<BasicBlock>>& new_blocks) { |
nothing calls this directly
no test coverage detected