https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92957

            Bug ID: 92957
           Summary: gcc produces a duplicated load, clang doesn't
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rafael at espindo dot la
  Target Milestone: ---

Created attachment 47507
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47507&action=edit
testcase

In the attached testcase gcc produces

_Z3fooPN7seastar12future_stateIJiEEES2_:
        movq    (%rsi), %rax
        movq    %rax, (%rdi)
        movq    $0, (%rsi)
        movq    (%rdi), %rax
        subq    $2, %rax
        cmpq    $1, %rax
        ja      .L1
        movl    8(%rsi), %eax
        movl    %eax, 8(%rdi)
.L1:
        ret

The "movq       (%rdi), %rax" load is redundant and clang avoids it.

Reply via email to