[LLVMbugs] [Bug 21749] New: Missing optimization
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Dec 4 04:42:54 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=21749
Bug ID: 21749
Summary: Missing optimization
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: eugeni.stepanov at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
long a, b, c;
void f(long x) {
a = x ^ 0x1;
b = x ^ 0x2;
c = x;
}
On x86_64 with -O2, clang generates the following:
0000000000000000 <_Z1fl>:
0: 48 89 f8 mov %rdi,%rax
3: 48 83 f0 01 xor $0x1,%rax
7: 48 89 05 00 00 00 00 mov %rax,0x0(%rip) # e <_Z1fl+0xe>
e: 48 89 f8 mov %rdi,%rax
11: 48 83 f0 02 xor $0x2,%rax
15: 48 89 05 00 00 00 00 mov %rax,0x0(%rip) # 1c
<_Z1fl+0x1c>
1c: 48 89 3d 00 00 00 00 mov %rdi,0x0(%rip) # 23
<_Z1fl+0x23>
23: c3 retq
This:
mov %rdi,%rax
xor $0x2,%rax
could be written as:
xor $0x3, %rax
This costs 1.5% code size with MemorySanitizer instrumentation, but we have a
workaround.
--
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/20141204/ee14586b/attachment.html>
More information about the llvm-bugs
mailing list