Commit Graph

2962 Commits

Author SHA1 Message Date
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
Rafael Espindola
a48b83ebfd Remove the now unused StringRefMemoryObject.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221755 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-12 02:13:27 +00:00
Michael J. Spencer
049368273b Fix style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221547 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-07 21:30:36 +00:00
NAKAMURA Takumi
93f761eced [CMake] LLVMSupport: Give system_libs PRIVATE scope when LLVMSupport is built as SHARED. Users of LLVMSupport won't inherit ${system_libs}.
unittests/SupporTests is another user of libpthreads. Apply LLVM_SYSTEM_LIBS for him explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221531 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-07 16:08:19 +00:00
Matt Arsenault
4ebcbd0af7 Remove unnecessary .c_str() when implicitly converting to Twine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221422 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-06 01:13:27 +00:00
David Majnemer
4787059b2f llvm-readobj: Add support for dumping the DOS header in PE files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221333 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 06:24:35 +00:00
Jiangning Liu
07e1080b89 Revert 220932.
Commit 220932 caused crash when building clang-tblgen on aarch64 debian target,
so it's blocking all daily tests.

The std::call_once implementation in pthread has bug for aarch64 debian.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221331 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 04:44:31 +00:00
Rafael Espindola
5dac5bd225 Remove FindProgramByName. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221258 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 12:35:47 +00:00
Yaron Keren
3f4bf44b1c Fix Visual C++ warning, Program.inc(85): warning C4018: '<' : signed/unsigned mismatch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221252 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 09:22:41 +00:00
NAKAMURA Takumi
8f129a446d sys::findProgramByName(): [Win32] Tweak to pass lowercase .exe to SearchPath() to appease clang Driver's tests.
It seems SearchPath() doesn't show actual extension on the filesystem.

FIXME: Shall we use FindFirstFile() here?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221246 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 08:17:15 +00:00
Yaron Keren
60234de3b5 #include <winbase.h> is not enough for Visual C++ 2013, it errors:
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\minwinbase.h(46):
error C2146: syntax error : missing ';' before identifier 'nLength'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\minwinbase.h(46):
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
...

including <windows.h> is actually required.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221244 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 07:53:30 +00:00
Michael J. Spencer
58206dd147 Use findProgramByName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221221 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 01:29:59 +00:00
Michael J. Spencer
376a2e104f [Support][Program] Add findProgramByName(Name, OptionalPaths)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221220 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04 01:29:29 +00:00
Rafael Espindola
9586f1a56a Add CRLF support to LineIterator.
The MRI scripts have to work with CRLF, and in general it is probably
a good idea to support this in a core utility like LineIterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221153 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-03 14:09:47 +00:00
Peter Collingbourne
b4793c488f CMake: Add libm to list of system libs printed by llvm-config.
This is required by the interpreter library, and also matches the autoconf
behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221147 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-03 10:38:26 +00:00
David Blaikie
c700c4d161 Update the non-pthreads fallback for RWMutex on Unix
Tested this by #if 0'ing out the pthreads implementation, which
indicated that this fallback was not currently compiling successfully
and applying this patch resolves that.

Patch by Andy Chien.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220969 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-31 17:02:30 +00:00
Hans Wennborg
9eb0a09710 Speculative fix for Windows build after r220932
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220936 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-30 23:10:01 +00:00
Chris Bieneman
8744520b53 Removing the static initializer in ManagedStatic.cpp by using llvm_call_once to initialize the ManagedStatic mutex.
Summary:
This patch adds an llvm_call_once which is a wrapper around std::call_once on platforms where it is available and devoid of bugs. The patch also migrates the ManagedStatic mutex to be allocated using llvm_call_once.

These changes are philosophically equivalent to the changes added in r219638, which were reverted due to a hang on Win32 which was the result of a bug in the Windows implementation of std::call_once.

Reviewers: aaron.ballman, chapuni, chandlerc, rnk

Reviewed By: rnk

Subscribers: majnemer, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220932 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-30 22:07:09 +00:00
Rafael Espindola
f6066a7fd3 Fix bug where sys::Wait could wait on wrong pid.
Setting ChildPid to -1 would cause waitpid to wait for any child process.

Patch by Daniel Reynaud!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220717 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 20:30:04 +00:00
Frederic Riss
54d6b1b71e Modernize doxygen comments in Support/Dwarf.h
In post-commit review of r219442, Rafael pointed out that the comment style
of the newly introduced helper didn't follow LLVM's coding standard.
Modernize the whole file to the new standards.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220467 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 04:08:38 +00:00
Benjamin Kramer
9552fcab70 Strength reduce constant-sized vectors into arrays. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220412 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-22 19:55:26 +00:00
David Blaikie
82805eb232 PR21202: Memory leak in Windows RWMutexImpl when using SRWLOCK
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220251 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-21 00:34:39 +00:00
Peter Collingbourne
86b3d8eb43 Introduce LLVMParseCommandLineOptions C API function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219975 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16 22:47:52 +00:00
Chris Bieneman
c14fb89680 Defining a new API for debug options that doesn't rely on static global cl::opts.
Summary:
This is based on the discussions from the LLVMDev thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-August/075886.html

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219854 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-15 21:54:35 +00:00
Hal Finkel
f0f98417ca Revert "r216914 - Revert: [APFloat] Fixed a bug in method 'fusedMultiplyAdd'"
Reapply r216913, a fix for PR20832 by Andrea Di Biagio. The commit was reverted
because of buildbot failures, and credit goes to Ulrich Weigand for isolating
the underlying issue (which can be confirmed by Valgrind, which does helpfully
light up like the fourth of July). Uli explained the problem with the original
patch as:

  It seems the problem is calling multiplySignificand with an addend of category
  fcZero; that is not expected by this routine.  Note that for fcZero, the
  significand parts are simply uninitialized, but the code in (or rather, called
  from) multiplySignificand will unconditionally access them -- in effect using
  uninitialized contents.

This version avoids using a category == fcZero addend within
multiplySignificand, which avoids this problem (the Valgrind output is also now
clean).

Original commit message:

[APFloat] Fixed a bug in method 'fusedMultiplyAdd'.

When folding a fused multiply-add builtin call, make sure that we propagate the
correct result in the case where the addend is zero, and the two other operands
are finite non-zero.

Example:
  define double @test() {
    %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0.0)
    ret double %1
  }

Before this patch, the instruction simplifier wrongly folded the builtin call
in function @test to constant 'double 7.0'.
With this patch, method 'fusedMultiplyAdd' correctly evaluates the multiply and
propagates the expected result (i.e. 56.0).

Added test fold-builtin-fma.ll with the reproducible from PR20832 plus extra
test cases to verify the behavior of method 'fusedMultiplyAdd' in the presence
of NaN/Inf operands.

This fixes PR20832.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219708 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14 19:23:07 +00:00
NAKAMURA Takumi
65e4aa4656 Revert r219638, (r219640 and r219676), "Removing the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex."
It caused hang-up on msc17 builder, probably deadlock.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219687 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14 15:58:16 +00:00