https://bugs.llvm.org/show_bug.cgi?id=47428

            Bug ID: 47428
           Summary: Opportunity to simplify conditions
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: llvm-bugs@lists.llvm.org

void bar (void);

void
foo (int a)
{
  if (a < 100)
    return;
  if (200 < a)
    return;

  if (a - 10 > 150)
    bar ();
}

Clang:
foo(int): # @foo(int)
  cmp edi, 161
  jl .LBB0_2
  add edi, -100
  cmp edi, 100
  ja .LBB0_2
  jmp bar() # TAILCALL
.LBB0_2:
  ret


GCC:
foo(int):
        sub     edi, 161
        cmp     edi, 39
        jbe     .L4
        ret
.L4:
        jmp     bar()



Maybe CE pass can simplify this code?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to