[Bug tree-optimization/17116] Missed jump threading/bypassing optimization with loop and % (or ands)
law at redhat dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 15 00:55:00 GMT 2005
------- Additional Comments From law at redhat dot com 2005-02-14 20:35 -------
Actually, if the jump threader code really did its job right it would just
emit 45 calls to puts ("hello") since we've got a series of cascading jump
threads here.
As it stands now, the first DOM pass threads the initial loop test, effectively
turning the loop into a "do ... while" loop.
The second DOM pass then comes along and threads the i%2 test for the first
iteration of the loop -- in effect peeling the first iteration of the loop --
which effectively turns the loop back into a while ... do loop (with one
less iteration than before).
The third iteration of DOM threads the initial loop test again which turns the
loop back into a do ... while loop.
Clearly if this contined, we'd just keep peeling off iterations until we had 45
calls to puts ("hello") and a loop which did nothing (which would then be removed).
So I think the real question is do we want DOM's jump threader to peel
off all the iterations or not :-)
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17116
More information about the Gcc-bugs
mailing list