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

            Bug ID: 85095
           Summary: [6/7/8 Regression] worse code generated
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

typedef unsigned long uint64_t;

uint64_t adc(uint64_t a, uint64_t b)
{
    a += b;
    if (a < b) /* should simplify to nothing (setting carry is implicit in the
add) */
        a++; /* should simplify to adc r0, 0 */
    return a;
}

At r230856 with -O3 this gets compiled to:

        movq    %rdi, %rax      # a, a
        addq    %rsi, %rax      # b, a
        adcq    $0, %rax        #, <retval>
        ret

At r230857 it becomes:

        xorl    %eax, %eax      # _7
        addq    %rdi, %rsi      # a, tmp93
        setc    %al     #, _7
        cmpq    $1, %rax        #, _7
        movq    %rsi, %rax      # tmp93, tmp93
        sbbq    $-1, %rax       #, tmp93
        ret


commit 83caf9ff7e5307a3982af5efe4885524b0be0d88
Author: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Nov 25 09:08:20 2015 +0000

            * ipa-inline-analysis.c: Include gimplify.h
            (set_cond_stmt_execution_predicate,
            set_switch_stmt_execution_predicate): Be sure to not leak locations
            to function body.


    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230857
138bc75d-0d04-0410-961f-82ee72b054a4

Reply via email to