Hi,
llvm likes spaghetti code!

Code:
"
program goto1;

label
 a,b,c;

begin
a:
 inc(exitcode);
 if exitcode = 4 then goto b;
 if exitcode < 5 then begin
  goto a;
 end;
b:
end.
"

FPC fixes_3_0 -O3:
"
main:
.Lc1:
# [test1.pas]
# [6] begin
        call    FPC_INITIALIZEUNITS
.Lj3:
# [8] inc(exitcode);
        addl    $1,operatingsystem_result
# [9] if exitcode = 4 then goto b;
        cmpl    $4,operatingsystem_result
        je      .Lj6
# [10] if exitcode < 5 then begin
        cmpl    $5,operatingsystem_result
        jl      .Lj3
.Lj6:
# [14] end.
        call    FPC_DO_EXIT
        ret
"

MSElang-llvm:
"
main:                                   # @main
# BB#0:
        movl    __mla__system.1, %ecx
        incl    %ecx
        movl    $4, %eax
        cmpl    $3, %ecx
        cmovgl  %ecx, %eax
        movl    %eax, __mla__system.1
        ret
"
Martin

------------------------------------------------------------------------------
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to