[llvm-bugs] [Bug 41259] New: switch is not converted into an argument LUT when a call return value is discarded

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 27 09:48:37 PDT 2019


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

            Bug ID: 41259
           Summary: switch is not converted into an argument LUT when a
                    call return value is discarded
           Product: new-bugs
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Keywords: code-quality
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: nok.raven at gmail.com
                CC: hans at chromium.org, htmldeveloper at gmail.com,
                    llvm-bugs at lists.llvm.org

For this code an argument LUT is constructed

int f(int);

int foo(int x)
{
    switch (x) {
    case 0: return f(12);
    case 1: return f(34);
    case 2: return f(56);
    case 3: return f(78);
    case 4: return f(90);
    }
}

But if the return value is discarded, as Hans Wennborg noticed in
https://bugs.llvm.org/show_bug.cgi?id=41242#c4

int f(int);

int foo(int x)
{
    switch (x) {
    case 0: f(12); break;
    case 1: f(34); break;
    case 2: f(56); break;
    case 3: f(78); break;
    case 4: f(90); break;
    }
}

The optimization did not work, and jump table is produced, while it could just
make a call instead of a jump.

-- 
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/20190327/adaba314/attachment.html>


More information about the llvm-bugs mailing list