This paper presents a general approach to automatically validate code-improving transformations on low-level program representations. The approach ensures the correctness of compiler and hand-specified optimizations at the machine instruction level. The method verifies the semantic equivalence of the program representation before and after a transformation to determine the validity of the transformation, i.e. whether the instance of the transformation is semantics preserving. To verify that the transformation is semantics preserving, the method derives semantic effects from the sequence of low-level instructions that span the execution paths affected by the transformation. The semantics are preserved if the normalized semantic effects derived from the code before and after the transformation are proven to be identical. A validating compilation system was implemented that is able to validate basic changes comprising instruction insertions, modifications, and deletions, to more powerful...
Robert van Engelen, David B. Whalley, Xin Yuan