115 Commits

Author SHA1 Message Date
Tim Renouf
4987965545 [TLI][AMDGPU] AMDPAL does not have library functions
Configure TLI to say that r600/amdgpu does not have any library
functions, such that InstCombine does not do anything like turn sin/cos
into the library function @tan with sufficient fast math flags.

Differential Revision: https://reviews.llvm.org/D67406

Change-Id: I02f907d3e64832117ea9800e9f9285282856e5df

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371592 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-11 07:26:39 +00:00
Teresa Johnson
ef512ca8e6 Change TargetLibraryInfo analysis passes to always require Function
Summary:
This is the first change to enable the TLI to be built per-function so
that -fno-builtin* handling can be migrated to use function attributes.
See discussion on D61634 for background. This is an enabler for fixing
handling of these options for LTO, for example.

This change should not affect behavior, as the provided function is not
yet used to build a specifically per-function TLI, but rather enables
that migration.

Most of the changes were very mechanical, e.g. passing a Function to the
legacy analysis pass's getTLI interface, or in Module level cases,
adding a callback. This is similar to the way the per-function TTI
analysis works.

There was one place where we were looking for builtins but not in the
context of a specific function. See FindCXAAtExit in
lib/Transforms/IPO/GlobalOpt.cpp. I'm somewhat concerned my workaround
could provide the wrong behavior in some corner cases. Suggestions
welcome.

Reviewers: chandlerc, hfinkel

Subscribers: arsenm, dschuff, jvesely, nhaehnle, mehdi_amini, javed.absar, sbc100, jgravelle-google, eraman, aheejin, steven_wu, george.burgess.iv, dexonsmith, jfb, asbirlea, gchatelet, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66428

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371284 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-07 03:09:36 +00:00
Evandro Menezes
0fead05e69 [TargetLibraryInfo] Define enumerator for no library function (NFC)
Add a null enumerator do designate no library function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370947 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-04 18:15:58 +00:00
Benjamin Kramer
6c4da29600 [TLI] Simplify code. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369854 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-24 17:30:12 +00:00
Benjamin Kramer
0f2e0c0e37 Fix some accidental global initializers by using StringLiteral instead of StringRef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369850 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-24 15:24:25 +00:00
Stanislav Mekhanoshin
edb506d79d [AMDGPU] Printf runtime binding pass
This pass is a port of the according pass from the HSAIL compiler.
It parses printf calls and setup runtime printf buffer.
After that it copies printf arguments to the buffer and fills in
module metadata for runtime.

Differential Revision: https://reviews.llvm.org/D24035

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368592 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-12 17:12:29 +00:00
Alex Lorenz
9fc0b127ad TLI: darwin does not support _bcmp
Not all Darwin targets support _bcmp in all circumstances.

Differential Revision: https://reviews.llvm.org/D65834

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368113 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-07 00:03:37 +00:00
David Bolvansky
0f33e81d49 [TLI][NFC] Fixed typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367827 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-05 10:14:09 +00:00
Nemanja Ivanovic
c0b8c8f0c4 Initial support for IBM MASS vector library
This is the LLVM portion of patch https://reviews.llvm.org/D59881.
The clang portion is to follow.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362568 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-05 01:31:43 +00:00
Erik Pilkington
8964612be0 [SimplifyLibCalls] Fold more fortified functions into non-fortified variants
When the object size argument is -1, no checking can be done, so calling the
_chk variant is unnecessary. We already did this for a bunch of these
functions.

rdar://50797197

Differential revision: https://reviews.llvm.org/D62358

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362272 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 22:41:36 +00:00
Fangrui Song
e0295ed37b Add Triple::isPPC64()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360864 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-16 08:31:22 +00:00
Philip Reames
f34129d190 Compile time tweak for libcall lookup
If we have a large module which is mostly intrinsics, we hammer the lib call lookup path from CodeGenPrepare.  Adding a fastpath reduces compile by 15% for one such example.

The problem is really more general than intrinsics - a module with lots of non-intrinsics non-libcall calls has the same problem - but we might as well avoid an easy case quickly.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360391 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-09 23:13:09 +00:00
Fangrui Song
66987a8d19 Use llvm::lower_bound. NFC
This reapplies rL358161. That commit inadvertently reverted an exegesis file to an old version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358246 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-12 02:02:06 +00:00
Ali Tamur
8c653aebb3 Revert "Use llvm::lower_bound. NFC"
This reverts commit rL358161.

This patch have broken the test:
llvm/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358199 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-11 17:35:20 +00:00
Fangrui Song
a5919957f1 Use llvm::lower_bound. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358161 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-11 10:25:41 +00:00
Nemanja Ivanovic
c9acb1de28 NFC: Refactor library-specific mappings of scalar maths functions to their vector counterparts
This patch factors out mappings of scalar maths functions to their vector
counterparts from TargetLibraryInfo.cpp to a separate VecFuncs.def file. Such
mappings are currently available for Accelerate framework, and SVML library.

This is in support of the follow-up: https://reviews.llvm.org/D59881

Patch by pjeeva01

Differential revision: https://reviews.llvm.org/D60211


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358001 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-09 13:21:11 +00:00
Alon Zakai
683212b71c [WebAssembly] Add Emscripten OS definition + small_printf
The Emscripten OS provides a definition of __EMSCRIPTEN__, and also that it
supports iprintf optimizations.

Also define small_printf optimizations, which is a printf with float support
but not long double (which in wasm can be useful since long doubles are 128
bit and force linking of float128 emulation code). This part is based on
sunfish's https://reviews.llvm.org/D57620 (which can't land yet since
the WASI integration isn't ready yet).

Differential Revision: https://reviews.llvm.org/D60167

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357552 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-03 01:08:35 +00:00
Clement Courbet
154171347b [SelectionDAG] Allow the user to specify a memeq function.
Summary:
Right now, when we encounter a string equality check,
e.g. `if (memcmp(a, b, s) == 0)`, we try to expand to a comparison if `s` is a
small compile-time constant, and fall back on calling `memcmp()` else.

This is sub-optimal because memcmp has to compute much more than
equality.

This patch replaces `memcmp(a, b, s) == 0` by `bcmp(a, b, s) == 0` on platforms
that support `bcmp`.

`bcmp` can be made much more efficient than `memcmp` because equality
compare is trivially parallel while lexicographic ordering has a chain
dependency.

Subscribers: fedor.sergeev, jyknight, ckennelly, gchatelet, llvm-commits

Differential Revision: https://reviews.llvm.org/D56593

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355672 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-08 09:07:45 +00:00
Evandro Menezes
12946fbd9d [TargetLibraryInfo] Update run time support for Windows
It seems that, since VC19, the `float` C99 math functions are supported for all
targets, unlike the C89 ones.

According to the discussion at https://reviews.llvm.org/D57625.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353758 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 22:12:01 +00:00
Evandro Menezes
1fb641f9e6 [TargetLibraryInfo] Update run time support for Windows
It seems that the run time for Windows has changed and supports more math
functions than it used to, especially on AArch64, ARM, and AMD64.

Fixes PR40541.

Differential revision: https://reviews.llvm.org/D57625

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353733 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 19:02:28 +00:00
Evandro Menezes
ed4942cb20 [TargetLibraryInfo] Regroup run time functions for Windows (NFC)
Regroup supported and unsupported functions by precision and C standard.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353213 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 20:24:21 +00:00
Evandro Menezes
c828f0931e Revert "[PATCH] [TargetLibraryInfo] Update run time support for Windows"
This reverts accidental commit ff5527718d5d3b9966f6e8948866c0dc15ffcf3c.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353118 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 23:34:50 +00:00
Evandro Menezes
44e34019ea [PATCH] [TargetLibraryInfo] Update run time support for Windows
It seems that the run time for Windows has changed and supports more math
functions than before.  Since LLVM requires at least VS2015, I assume that
this is the run time that would be redistributed with programs built with
Clang.  Thus, I based this update on the header file `math.h` that
accompanies it.

This patch addresses the PR40541.  Unfortunately, I have no access to a
Windows development environment to validate it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353114 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 23:29:41 +00:00
Chandler Carruth
6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
Joel Jones
9951b07907 Revert unapproved commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347511 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-24 07:26:55 +00:00
Joel Jones
8ae5719795 [AArch64] Enable libm vectorized functions via SLEEF
This changeset is modeled after Intel's submission for SVML. It enables
trigonometry functions vectorization via SLEEF: http://sleef.org/.

 * A new vectorization library enum is added to TargetLibraryInfo.h: SLEEF.
 * A new option is added to TargetLibraryInfoImpl - ClVectorLibrary: SLEEF.
 * A comprehensive test case is included in this changeset.
 * In a separate changeset (for clang), a new vectorization library argument is
   added to -fveclib: -fveclib=SLEEF.

Trigonometry functions that are vectorized by sleef:

acos
asin
atan
atanh
cos
cosh
exp
exp2
exp10
lgamma
log10
log2
log
sin
sinh
sqrt
tan
tanh
tgamma

Patch by Stefan Teleman
Differential Revision: https://reviews.llvm.org/D53927


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347510 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-24 06:41:39 +00:00
Calixte Denizet
5cd01d9130 Fix unit tests after patch https://reviews.llvm.org/rL346313
Summary: Tests are broken so fix them.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: sylvestre.ledru, llvm-commits

Differential Revision: https://reviews.llvm.org/D54208

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346318 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-07 14:46:26 +00:00
Calixte Denizet
bb74632144 [GCOV] Flush counters before to avoid counting the execution before fork twice and for exec** functions we must flush before the call
Summary:
This is replacement for patch in https://reviews.llvm.org/D49460.
When we fork, the counters are duplicate as they're and so the values are finally wrong when writing gcda for parent and child.
So just before to fork, we flush the counters and so the parent and the child have new counters set to zero.
For exec** functions, we need to flush before the call to have some data.

Reviewers: vsk, davidxl, marco-c

Reviewed By: marco-c

Subscribers: llvm-commits, sylvestre.ledru, marco-c

Differential Revision: https://reviews.llvm.org/D53593

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346313 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-07 13:49:17 +00:00
Eli Friedman
d9f217dc39 Disable calls to *_finite and other glibc-only functions on Musl.
Non-GNU environments don't have __finite_*, so treat them as
unavailable.

Differential Revision: https://reviews.llvm.org/D51282



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346250 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-06 18:23:32 +00:00
Fangrui Song
3b35e17b21 llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
Summary: The convenience wrapper in STLExtras is available since rL342102.

Reviewers: dblaikie, javed.absar, JDevlieghere, andreadb

Subscribers: MatzeB, sanjoy, arsenm, dschuff, mehdi_amini, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, javed.absar, gbedwell, jrtc27, mgrang, atanasyan, steven_wu, george.burgess.iv, dexonsmith, kristina, jsji, llvm-commits

Differential Revision: https://reviews.llvm.org/D52573

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343163 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 02:13:45 +00:00
Alexander Richardson
e8508360bc Add Triple::isMIPS()/isMIPS32()/isMIPS64(). NFC
There are quite a few if statements that enumerate all these cases. It gets
even worse in our fork of LLVM where we also have a Triple::cheri (which
is mips64 + CHERI instructions) and we had to update all if statements that
check for Triple::mips64 to also handle Triple::cheri. This patch helps to
reduce our diff to upstream and should also make some checks more readable.

Reviewed By: atanasyan

Differential Revision: https://reviews.llvm.org/D48548

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335493 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 16:49:20 +00:00
Sanjay Patel
bd9be7a1ed [TargetLibraryInfo] add mappings from LLVM sin/cos intrinsics to SVML calls
These weren't included in D19544 - probably just an oversight.
D40044 made it more likely that we'll have LLVM math intrinsics rather 
than libcalls, so this bug was more easily exposed.
As the tests/code show, we already have the complete mappings for pow/exp/log.

I don't have any experience with SVML, so I don't know if anything else is 
missing. It's also not clear to me that we should be doing this transform in 
IR rather than DAG/isel, but that's a separate issue.

Differential Revision: https://reviews.llvm.org/D47610


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334211 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 18:21:24 +00:00
Martin Storsjo
a925a3b124 [Analysis] Only use _unlocked stdio functions on linux
The existing comment said that the functions were available only
on GNU/Linux (and on certain Android versions), but only checked
T.isGNUEnvironment() which also is true on MinGW (for arch-windows-gnu
triplets), which doesn't have such functions.

Existing checks in the initialize function in TargetLibraryInfo.cpp
also use only T.isOSLinux() to check for glibc features.

This fixes use of stdio on MinGW.

Differential Revision: https://reviews.llvm.org/D47002

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332581 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 08:16:08 +00:00
David Bolvansky
cb037efeac [SimplifyLibcalls] Replace locked IO with unlocked IO
Summary: If file stream arg is not captured and source is fopen, we could replace IO calls by unlocked IO ("_unlocked" function variants) to gain better speed,

Reviewers: efriedma, RKSimon, spatel, sanjoy, hfinkel, majnemer, lebedev.ri, rja

Reviewed By: rja

Subscribers: rja, srhines, efriedma, lebedev.ri, llvm-commits

Differential Revision: https://reviews.llvm.org/D45736

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332452 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 11:39:52 +00:00
Martin Storsjo
d2bdcd6f8a [Analysis] Validate the return type of s(n)printf like libcalls
If the sprintf function is static (as on mingw-w64, where many stdio
functions are static inline wrappers), earlier optimization passes
could optimize out the return value altogether, and make it void,
which could break optimizations of this libcall that touch the
return value.

This fixes the issue discussed in PR37408 for the sprintf function.

Differential Revision: https://reviews.llvm.org/D46752

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332106 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-11 16:53:56 +00:00
Matt Morehouse
d0cb241845 Revert "[SimplifyLibcalls] Replace locked IO with unlocked IO"
This reverts r331002 due to sanitizer bot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331011 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 01:48:09 +00:00
David Bolvansky
c64f4dbfe3 [SimplifyLibcalls] Replace locked IO with unlocked IO
Summary: If file stream arg is not captured and source is fopen, we could replace IO calls by unlocked IO ("_unlocked" function variants) to gain better speed,

Reviewers: efriedma, RKSimon, spatel, sanjoy, hfinkel, majnemer

Subscribers: lebedev.ri, llvm-commits

Differential Revision: https://reviews.llvm.org/D45736

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331002 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 22:31:43 +00:00
Eric Fiselier
75627b1a25 [Analysis] Support aligned new/delete functions.
Summary:
Clang's __builtin_operator_new/delete was recently taught about the aligned allocation overloads (r328134). This patch makes LLVM aware of them as well.
This allows the compiler to perform certain optimizations including eliding new/delete calls.

Reviewers: rsmith, majnemer, dblaikie, vsk, bkramer

Reviewed By: bkramer

Subscribers: ckennelly, llvm-commits

Differential Revision: https://reviews.llvm.org/D44769

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329218 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 19:01:51 +00:00
Eric Fiselier
b9f31323a6 Revert "[Analysis] Support aligned new/delete functions."
This reverts commit bee3bbd9bdd3ab3364b8fb0cdb6326bc1ae740e0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329217 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 18:23:00 +00:00
Eric Fiselier
bee3bbd9bd [Analysis] Support aligned new/delete functions.
Summary:
Clang's __builtin_operator_new/delete was recently taught about the aligned allocation overloads (r328134). This patch makes LLVM aware of them as well.
This allows the compiler to perform certain optimizations including eliding new/delete calls.

Reviewers: rsmith, majnemer, dblaikie, vsk, bkramer

Reviewed By: bkramer

Subscribers: ckennelly, llvm-commits

Differential Revision: https://reviews.llvm.org/D44769

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329215 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-04 18:12:01 +00:00
Mandeep Singh Grang
ccca812fc3 [Analysis] Change std::sort to llvm::sort in response to r327219
Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer D44363 for a list of all the required patches.

Reviewers: sanjoy, dexonsmith, hfinkel, RKSimon

Reviewed By: dexonsmith

Subscribers: david2050, llvm-commits

Differential Revision: https://reviews.llvm.org/D44944

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328925 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-01 01:46:51 +00:00
Fangrui Song
73d8dbf806 Fix a bunch of typoes. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328907 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-30 22:22:31 +00:00
Chih-Hung Hsieh
a0ae1f88fb [Analysis] Disable calls to *_finite and other glibc-only functions on Android.
Since r322087, glibc's finite lib calls are generated when possible.
However, they are not supported on Android. This change also
disables other functions not available on Android.

Differential Revision: http://reviews.llvm.org/D42668


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323898 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-31 19:12:50 +00:00
MinSeong Kim
3c68a97987 [Analysis] Disable exp/exp2/pow finite lib calls on Android with -ffast-math.
Summary:
Since r322087, glibc's finite lib calls are generated when possible.
However, glibc is not supported on Android. Therefore this change
enables llvm to finely distinguish between linux and Android for
unsupported library calls. The change also include some regression
tests.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: kongyi, chh, javed.absar, llvm-commits

Differential Revision: https://reviews.llvm.org/D42288

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323187 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-23 11:11:36 +00:00
Sanjay Patel
cc2e1c221c [TargetLibraryInfo] fix finite mathlib function availability
This patch was part of:
https://reviews.llvm.org/D41338
...but we can expose the bug in IR via constant propagation
as shown in the test. Unless the triple includes 'linux', we
should not fold these because the functions don't exist on
other platforms (yet?).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322010 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 17:38:09 +00:00
Igor Laevsky
b887495d4b [TargetLibraryInfo] Discard library functions with incorrectly sized integers
Differential Revision: https://reviews.llvm.org/D41184



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320964 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 10:31:58 +00:00
Hal Finkel
1d4f2b0d25 [SimplifyLibCalls] Inline calls to cabs when it's safe to do so
When unsafe algerbra is allowed calls to cabs(r) can be replaced by:

  sqrt(creal(r)*creal(r) + cimag(r)*cimag(r))

Patch by Paul Walker, thanks!

Differential Revision: https://reviews.llvm.org/D40069

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16 01:26:25 +00:00
Sanjay Patel
050e890bd4 [TargetLibraryInfo] fix documentation comment; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15 18:54:29 +00:00
Matthias Braun
77cad59acf TargetLibraryInfo: Stop guessing wchar_t size
Usually the frontend communicates the size of wchar_t via metadata and
we can optimize wcslen (and possibly other calls in the future). In
cases without the wchar_size metadata we would previously try to guess
the correct size based on the target triple; however this is fragile to
keep up to date and may miss users manually changing the size via flags.
Better be safe and stop guessing and optimizing if the frontend didn't
communicate the size.

Differential Revision: https://reviews.llvm.org/D38106

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314185 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26 02:36:57 +00:00
Xin Tong
a9ee0160e6 Revert "Add pthread_self function prototype and make it speculatable."
This reverts commit 143d7445b5dfa2f6d6c45bdbe0433d9fc531be21.

Build breaking

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303496 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-21 00:37:55 +00:00