An optimization apparatus that optimizes a program so as to be suitable for pipeline processing, the program including a loop structure composed of a body and a control statement, the body including at least one arithmetic expression, the control statement prescribing a repeat condition for the body,
- the optimization apparatus comprising:
- a detection means for detecting a first arithmetic expression that defines a value in an i-th repetition of the body, the value being to be referred to in an (i+x)th repetition of the body, where i and x are positive integers;
- an estimation means for estimating, based on a value of x, an execution delay that will occur when the body is repeatedly executed in pipeline processing;
- and
- a conversion means for converting, when the execution delay exceeds a predetermined threshold level, the detected arithmetic expression into a second arithmetic expression that defines a value in the i-th repetition, the value being to be referred to in an (i+y)th repetition of the body, where y is an integer that is greater than x.