1. A non-transitory computer-readable storage medium storing therein a compiler program for causing a computer to execute a procedure comprising: copying a source program written in a parallel programming language to generate a plurality of optimization target programs corresponding to a plurality of image numbers respectively, each of the plurality of image numbers including each number of processes that are executed in parallel when the source program is executed; and repeatedly performing, for each of the plurality of optimization target programs, a first optimization that includes, substituting a function or a variable that indicates one of the plurality of image numbers in the each of the plurality of optimization target programs with the one of the plurality of image numbers, performing a constant propagation in the each of the plurality of optimization target programs, deleting a conditional branch instruction having a condition under which a conditional statement is changed to a constant due to the constant propagation, and deleting a code that is not to be executed based on the conditional branch instruction.