[llvm-bugs] [Bug 34240] New: strange optimization for cos(cos(20)) with math.h but not cmath
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 18 16:36:27 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34240
Bug ID: 34240
Summary: strange optimization for cos(cos(20)) with math.h but
not cmath
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: xaxxon at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Recursive call with cos(cos(20)) in the body is reduced to no-op with cmath but
with math.h the generated code makes the recursive calls.
With only cos(20) both headers result in the generated code being a no-op.
#include <math.h>
void recurseTest(int level){
for(int i =0; i < 15; i++){
cos(cos(20));
recurseTest(level +1);
}
}
Strange behavior with math.h:
https://godbolt.org/g/y9gZW7
Desired behavior with cmath instead:
https://godbolt.org/g/rh9BMg
Desired behavior with math.h and only cos(20) not cos(cos(20))
https://godbolt.org/g/tn6EDg
--
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/20170818/0f595674/attachment.html>
More information about the llvm-bugs
mailing list