Patent ID: 8549507

Claim:
A loop coalescing method executed by a processor, the method, comprising: removing an inner-most loop from among nested loops in a program, so that an outer operation provided outside of the inner-most loop is performed if a condition of a conditional statement is satisfied; providing the conditional statement in the program from which the inner-most loop has been removed, the condition of the conditional statement being periodically changed according to a number of iterations of the inner-most loop; generating a guard code by applying an if-conversion method to the conditional statement; and converting a guard of the guard code by using an instruction calculating the guard of the guard code, the instruction calculating the guard using a register where information related to a period of time corresponding to the number of iterations of the inner-most loop is stored, wherein the converting of the guard stores, in the register, the period of time corresponding to the number of iterations of the inner-most loop as is, and calculates the guard by comparing a value of a counter with a value of the register where the information related to the period of time corresponding to the number of iterations of the inner-most loop is stored, the value of the counter being incremented by one each time the instruction is called.