A useful technique in the design of an optimizing compiler is to include an "odometer test" on all endomorphic discretionary transformations. E.g., at a spot where one has a big go/no-go predicate that determines whether a change to the program is valid and beneficial, add a final term that's a call to a routine that returns true if odometer++ < limit. You can then use bisection on that limit and zero in quickly on the failing change.
This function is also a great place to put logging. I typically make it look like a printf() that returns a Boolean.
This function is also a great place to put logging. I typically make it look like a printf() that returns a Boolean.