David Kastrup <d...@gnu.org> writes:

> Pavel Roskin <pro...@gnu.org> writes:
>
>> Quoting David Kastrup <d...@gnu.org>:
>>
>>> Pavel Roskin <pro...@gnu.org> writes:
>>>
>>>> Quoting Pavel Roskin <pro...@gnu.org>:
>>
>>>> I'll try to identify the function tomorrow.
>>>
>>> That would be welcome.  I looked through the function right now and saw
>>> no obvious problematic candidate.
>>
>> It's Simultaneous_music_iterator::pending_moment()
>
> That would have been my most likely guess.  Probably the "min" function
> call.
>
>>> simultanous-music-iterator.cc is short enough to look through the
>>> generated code manually.  If you compile it (of course with all other
>>> relevant options) and options -S (for generating assembly source) and
>>> -fverbose-asm then I should have a reasonable chance of finding problems
>>> in the generated code by manual inspection.
>>
>> I moved everything but the problematic function to another file.  I'm
>> attaching the files.  simultaneous-music-iterator-O1.s is compiled
>> with -O1, simultaneous-music-iterator-O2.s is compiled with -O2.
>>
>> That's x64_64 assembly.  Please let me know if you want i386 assembly.
>
> Would definitely help with my limited vocabulary.  This is enough of a
> headacher without secondguessing the instruction set.

Well, secondguess or not, look here:

        movq    %rsp, %rsi      #,
        movq    %rbx, %rdi      # <retval>,
        call    _ZN6Moment7compareERKS_S1_@PLT  #
.LVL8:
.LBE71:
.LBE70:
.LBE69:
.LBB72:
.LBB73:
.LBB74:
.LBB75:
        .file 5 "../flower/include/rational.hh"
        .loc 5 107 0
        movl    (%rsp), %eax    # MEM[(const struct Rational &)&D.34963].sign_, 
MEM[(const struct Rational &)&D.34963].sign_
        movl    %eax, (%rbx)    # MEM[(const struct Rational &)&D.34963].sign_, 
MEM[(struct Rational *)<retval>_2(D)].sign_
        .loc 5 108 0
        movq    8(%rsp), %rax   # MEM[(const struct Rational &)&D.34963].num_, 
MEM[(const struct Rational &)&D.34963].num_
        movq    %rax, 8(%rbx)   # MEM[(const struct Rational &)&D.34963].num_, 
MEM[(struct Rational *)<retval>_2(D)].num_
        .loc 5 109 0
        movq    16(%rsp), %rax  # MEM[(const struct Rational &)&D.34963].den_, 
MEM[(const struct Rational &)&D.34963].den_
        movq    %rax, 16(%rbx)  # MEM[(const struct Rational &)&D.34963].den_, 
MEM[(struct Rational *)<retval>_2(D)].den_
.LVL9:
.LBE75:
.LBE74:
.LBE73:
.LBB76:
.LBB77:
.LBB78:
        .loc 5 107 0
        movl    24(%rsp), %eax  # MEM[(const struct Rational &)&D.34963 + 
24].sign_, MEM[(const struct Rational &)&D.34963 + 24].sign_
        movl    %eax, 24(%rbx)  # MEM[(const struct Rational &)&D.34963 + 
24].sign_, MEM[(struct Rational *)<retval>_2(D) + 24B].sign_
        .loc 5 108 0
        movq    32(%rsp), %rax  # MEM[(const struct Rational &)&D.34963 + 
24].num_, MEM[(const struct Rational &)&D.34963 + 24].num_
        movq    %rax, 32(%rbx)  # MEM[(const struct Rational &)&D.34963 + 
24].num_, MEM[(struct Rational *)<retval>_2(D) + 24B].num_
        .loc 5 109 0
        movq    40(%rsp), %rax  # MEM[(const struct Rational &)&D.34963 + 
24].den_, MEM[(const struct Rational &)&D.34963 + 24].den_
        movq    %rax, 40(%rbx)  # MEM[(const struct Rational &)&D.34963 + 
24].den_, MEM[(struct Rational *)<retval>_2(D) + 24B].den_
.LVL10:
.LBE78:
.LBE77:
.LBE76:
.LBE72:
.LBE63:
.LBB80:
.LBB81:


The optimizer does not appear interested in the result of the comparison
when calculating the minimum value!  There is no conditional path
entered.  That does not make all too much sense.

-- 
David Kastrup


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to