venkataramanan.kumar.llvm added a comment.
Hi,
I am on Ubuntu 18 machine and it has finite math header <bits/math-finite.h>.
This header is included by the glibc 2.27. This header has this following
definition.
extern double log (double) __asm__ ("" "__log_finite") __attribute__
((__nothrow__ ));
Consider the following test case
#include <math.h>
double mylog (double d) {
return log(d);
}
Before this patch clang generates -O2 -ffast-math
--Snip--
; Function Attrs: nounwind readnone uwtable
define dso_local double @mlog(double %d) local_unnamed_addr #0 {
entry:
%0 = tail call fast double @llvm.log.f64(double %d)
ret double %0
}
---Snip--
After this patch on machines with lesser glibc versions, for -O2 -ffast-math,
clang generates
--Snip--
; Function Attrs: nounwind readnone uwtable
define dso_local double @mlog(double %d) local_unnamed_addr #0 {
entry:
%call = tail call fast double @__log_finite(double %d) #2
ret double %call
}
--Snip--
Note on latest Ubuntu 20.04.1 LTS with Glibc 2.31 <bits/math-finite.h> header
is not present
It is removed by glibc. so there I see the @llvm.log.f64 intrinsic calls.
So on machines with lesser glibc versions where the header file is present this
will be a problem.
Note the LLVM "opt" does optimizations like vectorization only on the
intrinsic, but ignores the calls to @__log_finite.
Example https://llvm.godbolt.org/z/765We8
I am not sure if this known issue.
It is causing some performance issues with some benchmarks on my ubuntu 18
machine.
Shall I file a PR for this ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88712/new/
https://reviews.llvm.org/D88712
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits