[LLVMbugs] [Bug 16938] New: Duplicate loading of double constants
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Aug 19 19:08:20 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16938
Bug ID: 16938
Summary: Duplicate loading of double constants
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: eltoder at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
I found that in some cases llvm generates duplicate loads of double constants,
e.g.
$ cat t.c
double f(double* p, int n)
{
double s = 0;
if (n)
s += *p;
return s;
}
$ clang -S -O3 t.c -o -
...
f: # @f
.cfi_startproc
# BB#0:
xorps %xmm0, %xmm0
testl %esi, %esi
je .LBB0_2
# BB#1:
xorps %xmm0, %xmm0
addsd (%rdi), %xmm0
.LBB0_2:
ret
...
Note that there are 2 xorps instructions, the one in BB#1 being clearly
redundant
as it's dominated by the first one. Two xorps come from 2 FsFLD0SD generated by
instruction selection and never eliminated by machine passes. My guess would be
machine CSE should take care of it.
A variation of this case without indirection has the same problem, as well as a
related but separate issue: not commuting addps, resulting in an extra movps:
$ cat t.c
double f(double p, int n)
{
double s = 0;
if (n)
s += p;
return s;
}
$ clang -S -O3 t.c -o -
...
f: # @f
.cfi_startproc
# BB#0:
xorps %xmm1, %xmm1
testl %edi, %edi
je .LBB0_2
# BB#1:
xorps %xmm1, %xmm1
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
.LBB0_2:
movaps %xmm1, %xmm0
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/20130820/9ce9b7fc/attachment.html>
More information about the llvm-bugs
mailing list