[llvm-bugs] [Bug 39333] New: Redundant jump table index xoring
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 16 15:17:06 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39333
Bug ID: 39333
Summary: Redundant jump table index xoring
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
template<int> int foo();
typedef int (*int_fun)();
int_fun get_fun(unsigned int x)
{
switch(x&3)
{
case 0: return foo<0>;
case 1: return foo<1>;
case 2: return foo<2>;
case 3: return foo<3>;
}
return 0;
}
Current (SVN, X86-64, -O3):
get_fun(unsigned int):
and edi, 3
xor edi, 2
mov rax, qword ptr [8*rdi + .Lswitch.table.get_fun(unsigned int)]
ret
Prefered:
get_fun(unsigned int):
and edi, 3
mov rax, QWORD PTR CSWTCH.1[0+rdi*8]
ret
--
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/20181016/0d17dc41/attachment.html>
More information about the llvm-bugs
mailing list