Patent ID: 8826255

Claim:
A computer-implemented method comprising: generating, using a processor of a computing device, a control flow graph for at least a portion of a model, wherein the control flow graph comprises an unstructured cyclical region having: a cycle, a back-edge, a head node, and two or more merge nodes in the cycle, wherein the merge nodes represent nodes at which two or more edges of the control flow graph converge; locating the unstructured cyclical region in the control flow graph, the locating using the processor of the computing device, the locating comprising: searching the cycle of the control flow graph for the two or more merge nodes, examining a flow of control between respective pairs of the two or more merge nodes, determining that the flow of control results in an instruction to skip a command in the control flow graph, where: the instruction goes to a different command in the control flow graph when the flow of control causes the instruction to skip the command, and identifying the unstructured cyclical region as a region between one of the respective pairs of merge nodes when the flow of control causes the instruction to skip the command; and generating, using the processor of the computing device, a structured cyclical region by restructuring the unstructured cyclical region, wherein generating the structured cyclical region comprises: re-routing the back-edge of the unstructured cyclical region to the head node of the unstructured cyclical region; and routing the flow of control from a first location inside the unstructured cyclical region to a second location inside the unstructured cyclical region, the routing using a test of a control variable.