[LLVMbugs] [Bug 23056] New: Clang emits calls to libcompiler-rt for complex numbers, even if they are trivial
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Mar 28 11:25:11 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23056
Bug ID: 23056
Summary: Clang emits calls to libcompiler-rt for complex
numbers, even if they are trivial
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: ed at 80386.nl
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Consider the following piece of code:
#include <complex.h>
double complex times_two(double complex x) {
return x * 2;
}
double complex rotate(double complex x) {
return x * I;
}
These functions are trivial:
- The first function multiplies both the real and imaginary part of the complex
number with a simple scalar value.
- The second function rotates the number on the complex plane.
It seems that Clang creates a call to __muldc3(). While correct, I'm not sure
this is really needed. Clang could be optimized to omit a call to __muldc3()
and friends if one of the parts of any of the two numbers can be proven to be
zero.
Another example:
double mul(double a, double b) {
return (double complex)a * (double complex)b;
}
Clang generates horrible code for this function, even though it can completely
ignore the complex keyword.
--
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/20150328/57c41bbc/attachment.html>
More information about the llvm-bugs
mailing list