[llvm-bugs] [Bug 48411] New: Failure to optimize out loop that does nothing and always ends

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 6 06:43:06 PST 2020


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

            Bug ID: 48411
           Summary: Failure to optimize out loop that does nothing and
                    always ends
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at lists.llvm.org

void foo(unsigned short int x, unsigned char y) {
  unsigned char *a = &y;

  while (y < 3) {
    if (x != 0)
      ++y;
    ++y;
  }
}

This can be optimized out. GCC does this optimization, but LLVM does not.

Comparison here : https://godbolt.org/z/cM4bj8

-- 
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/20201206/b70ec1cf/attachment.html>


More information about the llvm-bugs mailing list