[llvm-bugs] [Bug 39854] New: Missing optimization opportunity: overlapping ranges optimization (condition simplification) after inlining

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 1 05:27:38 PST 2018


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

            Bug ID: 39854
           Summary: Missing optimization opportunity: overlapping ranges
                    optimization (condition simplification) after inlining
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nok.raven at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

bool foo(char c)
{
    return c >= '0' && c <= '9';
}

bool bar(char c)
{
    return c != '\0' && foo(c);
}

bool foobar(char c)
{
    return c != '\0' && c >= '0' && c <= '9';
}

All the functions above must result in the same instruction sequence (after
inlining and optimization), but Clang fails to optimize the condition in the
`bar` function. GCC makes the optimization perfectly in all cases (since 4.8.1
version). https://godbolt.org/z/fmXuT5

-- 
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/20181201/f7122997/attachment-0001.html>


More information about the llvm-bugs mailing list