[LLVMbugs] [Bug 18604] New: The register allocator allocates unnecessarily many registers
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jan 24 09:41:13 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18604
Bug ID: 18604
Summary: The register allocator allocates unnecessarily many
registers
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: jn at sirrida.de
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The register allocator allocates unnecessarily many registers.
Trying to minimize the number of involved registers allows for
more freely usable registers in the callers, assuming inlining is too costly.
int test(int x) {
int y;
x ^= (x >> 2);
x = (x >> 3) ^ x;
x = x ^ (x >> 4);
y = x; x >>= 5; x ^= y; // almost the same but explicit
return x;
}
=>
movl %edi, %eax
sarl $2, %eax
xorl %edi, %eax
movl %eax, %ecx // %ecx => %edi
sarl $3, %ecx
xorl %eax, %ecx
movl %ecx, %edx // %ecx => %edi; %edx => %eax
sarl $4, %edx
xorl %ecx, %edx
movl %edx, %eax // %eax => %edi; %edx => %eax
sarl $5, %eax
xorl %edx, %eax // reverse operands
retq
--
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/20140124/fafa9fef/attachment.html>
More information about the llvm-bugs
mailing list