1. A method for discovering a set of possible iterative sequences for a given loop in a program, comprising: partitioning the loop into a plurality of portions based on control flow in the loop; associating labels with the portions; constructing an initial loop automaton in memory storage that represents loop iterations as a regular language over the labels corresponding to the portions in the program; analyzing subsequences of the labels to determine infeasibility of the subsequences permitted in the automaton; and refining the loop automaton by removing all infeasible subsequences to discover a set of possible iteration sequences.