[llvm-bugs] [Bug 46411] New: Failure to optimize strlen that will always be smaller than a certain length

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 21 05:13:14 PDT 2020


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

            Bug ID: 46411
           Summary: Failure to optimize strlen that will always be smaller
                    than a certain length
           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

bool f(int i)
{
    return strlen(&"123"[i]) > 3;
}

This can be optimized to `return false;`. GCC does this transformation, but
LLVM does not.

-- 
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/20200621/001434fb/attachment-0001.html>


More information about the llvm-bugs mailing list