| 755 | } |
| 756 | |
| 757 | bool InlinePass::HasNoReturnInLoop(Function* func) { |
| 758 | // If control not structured, do not do loop/return analysis |
| 759 | // TODO: Analyze returns in non-structured control flow |
| 760 | if (!context()->get_feature_mgr()->HasCapability(spv::Capability::Shader)) |
| 761 | return false; |
| 762 | const auto structured_analysis = context()->GetStructuredCFGAnalysis(); |
| 763 | // Search for returns in structured construct. |
| 764 | bool return_in_loop = false; |
| 765 | for (auto& blk : *func) { |
| 766 | auto terminal_ii = blk.cend(); |
| 767 | --terminal_ii; |
| 768 | if (spvOpcodeIsReturn(terminal_ii->opcode()) && |
| 769 | structured_analysis->ContainingLoop(blk.id()) != 0) { |
| 770 | return_in_loop = true; |
| 771 | break; |
| 772 | } |
| 773 | } |
| 774 | return !return_in_loop; |
| 775 | } |
| 776 | |
| 777 | void InlinePass::AnalyzeReturns(Function* func) { |
| 778 | // Analyze functions without a return in loop. |
nothing calls this directly
no test coverage detected