3 ms·
I am not convinced it's that simple if 1 application of jump threading creates a new opportunity. The endlessly unreliable loop example in the post suggests tha
by MatzeBraun 11y ago
I am not convinced it's that simple if 1 application of jump threading creates a new opportunity.
The endlessly unreliable loop example in the post suggests that is is a halting problem to find out whether we should stop jump threading because we are unrolling an endless loop or not.
- perlgeek 11y agoThough there's a very pragmatic solution for the compiler: Stop after a fixed number of iterations. Since it's an optimization, and not required for correct operation of the compiler, one can simply give up instead of risking an infinite loop.
- DannyBee 11y agoFirst, that example is not jump threading, since its cloning code and CFG blocks. https://en.wikipedia.org/wiki/Jump_threading https://en.wikipedia.org/wiki/Jump_threading is a better description of jump threading. In what the author describes as jump threading, you have the same problem as loop peeling or any other loop optimization that may get applied to an infinite loop and want to duplicate per-iteration code from that loop. Yet somehow, as you'll see, we can prove things about the end states of those optimizations. ;-)