[fpc-devel] Debugging Loop Unroll Optimization

J. Gareth Moreton gareth at moreton-family.com
Mon May 21 19:44:08 CEST 2018


 Unless I'm missing something, that could be unrolled without any
problems.  The only problem that could occur is if Test2 raises an
exception (which, as the name implies, is an exceptional situation) or it
jumps outside of the procedure, which can only realistically occur in some
compiler optimisations (e.g. CALL [routine]; RET is optimised to JMP
[routine]).  Exit is not a problem here because it will simply exit Test2
and stay within the for-loop.

 Gareth aka. Kit

 On Mon 21/05/18 18:27 , Ondrej Pokorny lazarus at kluug.net sent:
 On 21.05.2018 18:23, Martok wrote: 
 > Am 21.05.2018 um 17:44 schrieb Florian Klämpfl: 
 >> I added raise, exit, goto and label as well. 
 > Oh, label, right. 
 > 
 > I'd say #0033614 can be resolved as "fixed in 39083" and #0033753 as "no
change 
 > required" then. 

 Well there is still something left: 

 program LoopUnrollTest; 
 procedure Test; 
 var 
   I: Integer; 
   procedure Test2; 
   begin 
     Writeln(I); 
   end; 
 begin 
   for I := 1 to 10 do 
     Test2; 
 end; 
 begin 
   Test; 
 end. 

 Ondrej 
 _______________________________________________ 
 fpc-devel maillist - fpc-devel at lists.freepascal.org [1] 
 http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel 

 

Links:
------
[1] mailto:fpc-devel at lists.freepascal.org
[2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180521/e3eb17a2/attachment.html>


More information about the fpc-devel mailing list