An optimizer is instrumented to generate the trace of an optimization run in terms of the predefined transformation primitives. The validation succeeds if (1) the trace conforms to the optimization and (2) the soundness conditions of the individual transformations in the trace are satisfied. The first step eliminates the need to trust the instrumentation. The soundness conditions are defined in a temporal logic and therefore the second step involves model checking. Thus the scheme is completely automatable.
We have applied this approach to several intraprocedural optimizations
of RTL intermediate code in GCC v4.1.0,
namely, loop invariant code motion, partial redundancy elimination, lazy code motion,
code hoisting, and copy and constant propagation for sample programs written in
a subset of the C language. The validation does not require information about program analyses performed by GCC.
Therefore even though the GCC code base is quite large and complex,
instrumentation could be achieved easily.
The framework requires an estimated 21 lines of instrumentation code and 140 lines of PVS specifications
for every 1000 lines of the GCC code considered for validation.
Journal: Software Practice and Experience, 39(6),
2009, pp. 611-639,
© Wiley.
PDF.
DBLP.