[llvm-bugs] [Bug 47416] New: [x86] Failure to remove all statements in function that doesn't return anything but should

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 4 03:39:44 PDT 2020


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

            Bug ID: 47416
           Summary: [x86] Failure to remove all statements in function
                    that doesn't return anything but should
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

int f(int a, int b)
{
    if ((a < 4 && b == 'r') || (a == 1 && (b == 'h' || b == 'i')) || (a == 2))
        a = b;
}

Compiling this results in this assembly output:

f(int, int):
  cmp edi, 1

It should be possible to remove the `cmp edi, 1` as far as I know. I guess this
isn't really by itself considering the behaviour is undefined anyway but this
behaviour itself seems rather weird.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200904/69533b4f/attachment-0001.html>


More information about the llvm-bugs mailing list