[PATCH] D115850: [LTO][codegen] Add TargetLibraryInfoWrapperPass initially
Freddy, Ye via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 19 19:46:18 PST 2021
FreddyYe added a comment.
For example can fix such code on Linux:
$ cat foo.h
double foo(double a);
[pengfei at shliclel310 build_base_core_avx512.0000]$ cat foo.c
#include <math.h>
#include "foo.h"
double foo(double a){
return sqrt(a);
}
$ cat main.c
#include <stdio.h>
#include "foo.h"
int main() { printf("%lf\n", foo(200));}
$ cat foo.sh
clang -c -o foo.o -Ofast -flto foo.c
clang -c -o main.o -Ofast -flto main.c
clang -Ofast -flto foo.o main.o -lm
objdump -d a.out | less
$ sh foo.sh
With -flto on, it will generate `call __sqrt_finite`, without -flto on, it will generate `sqrtsd %xmm0,%xmm0`. The later version is faster. I don't know how to add lto dependent lit test. Hi @aeubanks, do you know how?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115850/new/
https://reviews.llvm.org/D115850
More information about the llvm-commits
mailing list