Commit Graph

2987 Commits

Author SHA1 Message Date
Lang Hames
a46dd583d6 [APFloat][ADT] Fix sign handling logic for FMA results that truncate to zero.
This patch adds a check for underflow when truncating results back to lower
precision at the end of an FMA. The additional sign handling logic in
APFloat::fusedMultiplyAdd should only be performed when the result of the
addition step of the FMA (in full precision) is exactly zero, not when the
result underflows to zero.

Unit tests for this case and related signed zero FMA results are included.

Fixes <rdar://problem/18925551>.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225123 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-04 01:20:55 +00:00
Alexey Samsonov
af94b8a441 Remove unnecessary StringRef->std::string conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224953 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-29 20:59:02 +00:00
Juergen Ributzka
1fe03a49d6 Add missing implementation of 'sys::path::is_other' to the support library.
The header claims that this function exists, but the linker wasn't too happy
about it not being in the library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224527 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 18:19:47 +00:00
JF Bastien
544f63e84a Random Number Generator Refactoring (removing from Module)
This patch removes the RNG from Module. Passes should instead create a new RNG for their use as needed.

Patch by Stephen Crane @rinon.

Differential revision: http://reviews.llvm.org/D4377

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224444 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-17 18:12:10 +00:00
Rafael Espindola
650708838d Remove a debugging assert.
Sorry for the noise, I have no idea how it survived to the final version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224414 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-17 03:38:04 +00:00
Rafael Espindola
9a845bdcd5 Fix the windows build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224412 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-17 02:42:20 +00:00
Rafael Espindola
2f569017cb Refactor and simplify the code reading /proc/cpuinfo. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224410 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-17 02:32:44 +00:00
Rafael Espindola
8b3754208f Remove the last unnecessary member variable of mapped_file_region. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224312 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 03:10:29 +00:00
Rafael Espindola
b5f992ccc0 Convert a member variable to a local variable. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224311 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 02:53:35 +00:00
Rafael Espindola
a99ff35cb5 Remove unused member and simplify. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 02:19:26 +00:00
David Majnemer
1691fa27d7 ThreadLocal: Move Unix-specific code out of Support/ThreadLocal.cpp
Just a cleanup, no functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224227 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 01:19:53 +00:00
David Majnemer
1f59bf4441 ThreadLocal: Return a mutable pointer if templated with a non-const type
It makes more sense for ThreadLocal<const T>::get to return a const T*
and ThreadLocal<T>::get to return a T*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224225 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 01:04:45 +00:00
David Majnemer
a53d2268a9 APInt: udivrem should use machine instructions for single-word APInts
This mirrors the behavior of APInt::udiv and APInt::urem.  Some
architectures, like X86, have a single instruction which can compute
both division and remainder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224217 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-14 09:41:56 +00:00
Yaron Keren
27d4d1c7bf Pass EC by reference to MemoryBufferMMapFile to return error code.
Patch by Kim Grasman!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224159 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 22:27:53 +00:00
Michael Ilseman
3f0e8837be Clean up static analyzer warnings.
Clang's static analyzer found several potential cases of undefined
behavior, use of un-initialized values, and potentially null pointer
dereferences in tablegen, Support, MC, and ADT. This cleans them up
with specific assertions on the assumptions of the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224154 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 21:48:03 +00:00
Rafael Espindola
8ef835e3dc MAP_FILE is the default. We don't need to add it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224144 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 19:12:42 +00:00
Rafael Espindola
879b54621e Remove silly left over from the Windows resize_file implementation.
I didn't notice the problem first because on a non debug build the CRT was
just exiting the process without any message.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224139 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 18:37:43 +00:00
Rafael Espindola
7f4b22e7de Move the resize file feature from mapped_file_region to the only user.
This removes a duplicated stat on every file that llvm-ar looks at.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224138 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 18:13:23 +00:00
Rafael Espindola
e1136e38a7 Pass a FD to resise_file and add a testcase.
I will add a real use in another commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224136 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 17:55:12 +00:00
Rafael Espindola
7291e0706e Remove unused feature. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224135 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 17:35:34 +00:00
Rafael Espindola
0be06cf360 Remove a convoluted way of calling close by moving the call to the only caller.
As a bonus we can actually check the return value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224046 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 20:12:55 +00:00
Michael Ilseman
2b7ed472a7 Silence static analyzer warnings in LLVMSupport.
The static analyzer catches a few potential bugs in LLVMSupport. Add
in asserts to silence the warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224044 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 19:46:38 +00:00
Rafael Espindola
de15d01f9d Remove dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224029 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-11 17:17:26 +00:00
Yaron Keren
499e74c3cd Silence warning: variable 'buffer' set but not used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223389 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 21:36:38 +00:00
Rafael Espindola
3f598f77bd Remove dead code. NFC.
This interface was added 2 years ago but users never developed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223368 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 16:59:36 +00:00
Tom Stellard
fcf4242b9b Triple: Add AMDHSA operating system type
This operating system type represents the AMD HSA runtime,
and will be required by the R600 backend in order to generate
correct code for this runtime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223124 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 16:45:47 +00:00
Chandler Carruth
84c0f65446 Fix several bugs in r221220's new program finding code.
In both the Unix and Windows variants, std::getenv was called and the
result passed directly to a function accepting a StringRef. This isn't
OK because it might return a null pointer and that causes the StringRef
constructor to assert (and generally produces crash-prone code if
asserts are disabled). Fix this by independently testing the result as
non-null prior to splitting things.

This in turn uncovered another bug in the Unix variant where it would
infinitely recurse if PATH="", or after this fix if PATH isn't set.
There is no need to recurse at all. Slightly re-arrange the code to make
it clear that we can just fixup the Paths argument based on the
environment if we find anything.

I don't know of a particularly useful way to test these routines in
LLVM. I'll commit a test to Clang that ensures that its driver correctly
handles various settings of PATH. However, I have no idea how to
correctly write a Windows test for the PATHEXT change. Any Windows
developers who could provide such a test, please have at. =D

Many thanks to Nick Lewycky and others for helping debug this. =/ It was
quite nasty for us to track down.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223099 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 00:52:01 +00:00
Evgeniy Stepanov
ccac3a0229 [msan] Annotate zlib functions for MemorySanitizer.
Mark destination buffer in zlib::compress and zlib::decompress as fully
initialized.

When building LLVM with system zlib and MemorySanitizer instrumentation,
MSan does not observe memory writes in zlib code and erroneously considers
zlib output buffers as uninitialized, resulting in false use-of-uninitialized
memory reports. This change helps MSan understand the state of that memory
and prevents such reports.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222763 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 15:24:07 +00:00
Paul Robinson
2dc4746332 More long path name support on Windows, this time in program execution.
Allows long paths for the executable and redirected stdin/stdout/stderr.
Addresses PR21563.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222671 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-24 18:05:29 +00:00
Matthias Braun
1f69d31727 Allow multiple -debug-only args
Debug output is shown if any of the -debug-only arguments match.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222547 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-21 18:06:09 +00:00
Alexey Samsonov
88dc43f69e Remove support for undocumented SpecialCaseList entries.
"global-init", "global-init-src" and "global-init-type" were originally
used to blacklist entities in ASan init-order checker. However, they
were never documented, and later were replaced by "=init" category.

Old blacklist entries should be converted as follows:
  * global-init:foo -> global:foo=init
  * global-init-src:bar -> src:bar=init
  * global-init-type:baz -> type:baz=init



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222401 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-20 01:27:19 +00:00
Lang Hames
58c62e1dba [ADT] Fix PR20728 - Incorrect APFloat::fusedMultiplyAdd results for x86_fp80.
As detailed at http://llvm.org/PR20728, due to an internal overflow in
APFloat::multiplySignificand the APFloat::fusedMultiplyAdd method can return
incorrect results for x87DoubleExtended (x86_fp80) values. This commonly
manifests as incorrect constant folding of libm fmal calls on x86. E.g.

fmal(1.0L, 1.0L, 3.0L) == 0.0L      (should be 4.0L)

This patch fixes PR20728 by adding an extra bit to the significand for
intermediate results of APFloat::multiplySignificand, avoiding the overflow.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222374 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 19:15:41 +00:00
David Blaikie
5401ba7099 Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool>
This is to be consistent with StringSet and ultimately with the standard
library's associative container insert function.

This lead to updating SmallSet::insert to return pair<iterator, bool>,
and then to update SmallPtrSet::insert to return pair<iterator, bool>,
and then to update all the existing users of those functions...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222334 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 07:49:26 +00:00
David Blaikie
1d4f28c6bc Remove StringMap::GetOrCreateValue in favor of StringMap::insert
Having two ways to do this doesn't seem terribly helpful and
consistently using the insert version (which we already has) seems like
it'll make the code easier to understand to anyone working with standard
data structures. (I also updated many references to the Entry's
key and value to use first() and second instead of getKey{Data,Length,}
and get/setValue - for similar consistency)

Also removes the GetOrCreateValue functions so there's less surface area
to StringMap to fix/improve/change/accommodate move semantics, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222319 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 05:49:42 +00:00
Michael J. Spencer
b9f39bcc82 Support ELF files of unknown type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222208 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 01:14:25 +00:00
Renato Golin
18e5ce0188 Fix ARM triple parsing
The triple parser should only accept existing architecture names
when the triple starts with armv, armebv, thumbv or thumbebv.

Patch by Gabor Ballabas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222129 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 14:08:57 +00:00
Yaron Keren
c2eafa1ce3 silence gcc 4.9.1 warning in /llvm/lib/Support/Windows/Path.inc:564:39:
warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   if (ec = widenPath(path, path_utf16))



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222122 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 09:29:33 +00:00
NAKAMURA Takumi
5d94c2a6ad SearchForAddressOfSymbol(): Disable 3 symbols, copysignf, fminf, and fmaxf, on msc17. *These were added in VS 2013*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221971 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 04:53:55 +00:00
Reid Kleckner
53c7d53c50 Fix the VS 2012 build
VS 2012 doesn't have fminf or fmaxf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221949 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 23:45:50 +00:00
Reid Kleckner
016f651f8d Fix symbol resolution of floating point libc builtins in MCJIT
Fix for LLI failure on Windows\X86: http://llvm.org/PR5053

LLI.exe crashes on Windows\X86 when single precession floating point
intrinsics like the following are used: acos, asin, atan, atan2, ceil,
copysign, cos, cosh, exp, floor, fmin, fmax, fmod, log, pow, sin, sinh,
sqrt, tan, tanh

The above intrinsics are defined as inline-expansions in math.h, and are
not exported by msvcr120.dll (Win32 API GetProcAddress returns null).

For an FREM instruction, the JIT compiler generates a call to a stub for
the fmodf() intrinsic, and adds a relocation to fixup at load time. The
loader searches the libraries for the function, but fails because the
symbol is not exported. So, the call target remains NULL and the
execution crashes.

Since the math functions are loaded at JIT/runtime, the JIT can patch
CALL instruction directly instead of the searching the libraries'
exported symbols.  However, this fix caused build failures due to
unresolved symbols like _fmodf at link time.

Therefore, the current fix defines helper functions in the Runtime
link/load library to perform the above operations.  The address of these
helper functions are used to patch up the CALL instruction at load time.

Reviewers: lhames, rnk

Reviewed By: rnk

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

Patch by Swaroop Sridhar!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221947 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 23:32:52 +00:00
Reid Kleckner
c12b641130 Avoid usage of char16_t as MSVC "14" doesn't appear to support it
Fixes the MSVC "14" build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221932 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 22:09:56 +00:00
Aaron Ballman
dbe68adeb2 Fixing -Wtype-limits warnings with the asserts (the expression would always evaluate to true). Also fixing a -Wcast-qual warning, where the cast expression isn't required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221888 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 13:55:13 +00:00
Rafael Espindola
509156a4ab Read 64 bits at a time in the bitcode reader.
The reading of 64 bit values could still be optimized, but at least this cuts
down on the number of virtual calls to fetch more data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221865 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 07:23:22 +00:00
Paul Robinson
038e20451d Improve long path name support on Windows.
Windows normally limits the length of an absolute path name to 260
characters; directories can have lower limits.  These limits increase
to about 32K if you use absolute paths with the special '\\?\'
prefix. Teach Support\Windows\Path.inc to use that prefix as needed.

TODO: Other parts of Support could also learn to use this prefix.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221841 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 00:12:14 +00:00
Rafael Espindola
ea3c2111f4 Use the return of readBytes to find out if we are at the end of the stream.
This allows the removal of isObjectEnd and opens the way for reading 64 bits
at a time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221804 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 18:37:00 +00:00
Rafael Espindola
d0ab58245f Return the number of read bytes in MemoryObject::readBytes.
Returning more information will allow BitstreamReader to be simplified a bit
and changed to read 64 bits at a time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221794 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 17:11:16 +00:00
Rafael Espindola
d0518569ec Merge StreamableMemoryObject into MemoryObject.
Every MemoryObject is a StreamableMemoryObject since the removal of
StringRefMemoryObject, so just merge the two.

I will clean up the MemoryObject interface in the upcoming commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221766 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 03:55:46 +00:00
Rafael Espindola
b0022d46da Remove unused method. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221759 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 02:35:31 +00:00
Rafael Espindola
ccb2a0e99a Make readBytes pure virtual. Every real implementation has it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221758 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 02:30:38 +00:00
Rafael Espindola
67a38a848e Remove unused method. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221757 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 02:27:40 +00:00