1. A method, in a data processing system having a processor implemented in hardware, for optimizing program code, comprising: receiving, by the processor, source code for a program in a compiler; transforming, by the processor, the source code into a program statement view of the source code; transforming, by the processor, the program statement view of the source code into a program loop view of the source code, wherein the program loop view is an abstract syntax tree (AST) representation of the source code generated by applying a loop transformation on the program statement view, and wherein the AST of the program loop view comprises a plurality of nodes with each node representing a loop in the source code; applying, by the processor, one or more code generation optimizations to the program loop view of the source code to generate optimized code; and outputting, by the processor, the optimized code to a compiler for use in generating executable code for execution on a computing device, wherein the one or more code generation optimizations transform the program loop view of the source code into the optimized code while maintaining both program and schedule equivalence between the optimized code and the program statement view of the source code, wherein each code generation optimization of the one or more code generation optimizations visits a list of nodes of the AST in the program loop view for which the code generation optimization is to be applied and a propagation mode indicator that identifies a manner by which the list of nodes is to be processed by the code generation optimization.