public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/68027] New: conditional statement and unnecessary register assignment
@ 2015-10-20  5:24 SztfG at yandex dot ru
  2015-10-20  5:30 ` [Bug middle-end/68027] " SztfG at yandex dot ru
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: SztfG at yandex dot ru @ 2015-10-20  5:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 68027
           Summary: conditional statement and unnecessary register
                    assignment
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: SztfG at yandex dot ru
  Target Milestone: ---

C source code:

int a1(int);
int a2(int);
int a3(int);

int test1(int a)
{
  if (a > 100) return a1(a);
  else if (a < 100) return a2(a);
  return a3(a);
}

-----------------------------------

Assembly output:


test1:
.LFB0:
        .cfi_startproc
        cmpl    $100, %edi
        jg      .L5
        jne     .L6
        movl    $100, %edi   # no need to do this, eax is equal $100 at this
point
        jmp     a3
        .p2align 4,,10
        .p2align 3
.L6:
        jmp     a2
        .p2align 4,,10
        .p2align 3
.L5:
        jmp     a1
        .cfi_endproc

-----------------------------------

Tested on http://gcc.godbolt.org/ : gcc versions 4.4.7 - 5.2.0 have this
problem.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-10 18:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-20  5:24 [Bug middle-end/68027] New: conditional statement and unnecessary register assignment SztfG at yandex dot ru
2015-10-20  5:30 ` [Bug middle-end/68027] " SztfG at yandex dot ru
2015-10-20  8:00 ` [Bug tree-optimization/68027] " rguenth at gcc dot gnu.org
2015-10-20  8:28 ` SztfG at yandex dot ru
2015-10-20 17:37 ` SztfG at yandex dot ru
2021-08-10 18:20 ` [Bug tree-optimization/68027] uncprop should work on more than PHI nodes pinskia at gcc dot gnu.org
2021-08-10 18:22 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).