We present a new approach to the debugging of optimized code through comparison checking. In this scheme, both the unoptimized and optimized versions of an application execute, and values they compute are compared in order to ensure that the behaviors of the two versions are the same. To determine what values should be compared and where the comparisons must take place, statement instances in the
... [Show full abstract] unoptimized code are mapped to statement instances in the optimized code. The mappings are derived automatically as optimizations are performed. Annotations for both versions of the code are developed from the mappings. Using the annotations, a driver checks, while the programs are executing, that both programs are producing the same values. If values are different, the user determines if there is a bug in the unoptimized code. If so, a conventional debugger is used to debug the code. If the bug is in the optimized code, the user is told where in the code the problem occurred and what optimiza...