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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to