Commit Graph

2950 Commits

Author SHA1 Message Date
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
Chris Bieneman
3a143ce2e7 Removing the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex.
This patch adds a new llvm_call_once function which is used by the ManagedStatic implementation to safely initialize a global to avoid static construction and destruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219638 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-13 22:37:25 +00:00
David Majnemer
dfe81adbce InstCombine: Don't miscompile (x lshr C1) udiv C2
We have a transform that changes:
  (x lshr C1) udiv C2
into:
  x udiv (C2 << C1)

However, it is unsafe to do so if C2 << C1 discards any of C2's bits.

This fixes PR21255.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219634 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-13 21:48:30 +00:00
NAKAMURA Takumi
5adece02b6 Unix/Signals.inc: Let findModulesAndOffsets() built conditionally regarding to (defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)). [-Wunused-function]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219596 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-13 04:32:43 +00:00
Benjamin Kramer
b85e7ae9ab [Modules] Add some missing includes to make files compile stand-alone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219592 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-12 22:49:26 +00:00
Benjamin Kramer
c67df0c462 Modernize old-style static asserts. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219588 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-12 17:56:40 +00:00
Chandler Carruth
fade9f1d17 Guard the definition of the stack tracing function with the same macros
that guard its usage. Without this, we can get unused function warnings
when backtraces are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-11 01:04:40 +00:00
Alexey Samsonov
fab0a999d7 Follow-up to r219534 to make symbolization more robust.
1) Explicitly provide important arguments to llvm-symbolizer,
not relying on defaults.
2) Be more defensive about symbolizer output.

This might fix weird failures on ninja-x64-msvc-RA-centos6 buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219541 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 22:58:26 +00:00
Alexey Samsonov
fcc00a10e3 Re-land r219354: Use llvm-symbolizer to symbolize LLVM/Clang crash dumps.
In fact, symbolization is now expected to work only on Linux and
FreeBSD/NetBSD, where we have dl_iterate_phdr and can learn the
main executable name without argv0 (it will be possible on BSD systems
after http://reviews.llvm.org/D5693 lands). #ifdef-out the code for
all the rest Unix systems.

Reviewed in http://reviews.llvm.org/D5610


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219534 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 22:06:59 +00:00
Benjamin Kramer
d8b0418d96 APInt: Unfold return expressions so RVO can work.
Saves a couple of expensive deep copies. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219487 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 10:18:12 +00:00
Chandler Carruth
cb84b21243 [ADT] Add the scalbn function for APFloat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219473 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 04:54:30 +00:00
Frederic Riss
0d807ccc39 Add ApplePropertyString dump helper to Dwarf.{h|cpp}.
Reviewers: dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219442 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-09 20:43:04 +00:00
Alexey Samsonov
aa486d0764 Revert r219354. It seems to break some buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219355 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-08 23:07:59 +00:00