Jakob Stoklund Olesen
aea4fe2862
Prevent infinite growth of SmallMap instances.
...
Rehash but don't grow when full of tombstones.
Patch by José Fonseca!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128565 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 18:32:44 +00:00
Benjamin Kramer
8398512f89
Avoid turning a floating point division with a constant power of two into a denormal multiplication.
...
Some platforms may treat denormals as zero, on other platforms multiplication
with a subnormal is slower than dividing by a normal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128555 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 17:02:54 +00:00
Benjamin Kramer
2746000f4f
Add APFloat::getExactInverse.
...
The idea is, that if an ieee 754 float is divided by a power of two, we can
turn the division into a cheaper multiplication. This function sees if we can
get an exact multiplicative inverse for a divisor and returns it if possible.
This is the hard part of PR9587.
I tested many inputs against llvm-gcc's frotend implementation of this
optimization and didn't find any difference. However, floating point is the
land of weird edge cases, so any review would be appreciated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128545 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 15:42:27 +00:00
Frits van Bommel
6208610fd6
Constant folding support for calls to umul.with.overflow(), basically identical to the smul.with.overflow() code.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-27 14:26:13 +00:00
Andrew Trick
0a828fd7ef
revert r128199 until it can be made to work with Frontend/dependency-gen.c.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128218 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24 16:43:37 +00:00
Michael J. Spencer
e1db1b8d4e
Remove all uses of PATH_MAX and MAXPATHLEN from PathV2.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128199 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24 05:23:40 +00:00
Rafael Espindola
11d1803770
We don't need a null terminator for the output file.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128098 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 19:20:47 +00:00
Ted Kremenek
3311d951e2
Properly initialize all fields in CrashReporterCleanupContext. This caused the buildbot failure earlier.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128071 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 04:33:13 +00:00
Ted Kremenek
07235a1705
Temporarily stop recovering resources in CrashRecoveryContext while I investigate further why this works on my machine and not on others.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128065 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 02:06:32 +00:00
Ted Kremenek
b52fde4185
Provide a means for CrashRecovery clients to determine if code is currently running while crash recovery cleanups are being processed.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128008 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-21 18:38:03 +00:00
Benjamin Kramer
ed8f9589a8
Avoid initializing posix_spawn_file_actions_t if not used.
...
- glibc falls back to fork+exec if a file actions object is present.
- On BSDs this saves a malloc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-20 15:52:24 +00:00
Ted Kremenek
1a06d5721a
Tweak CrashRecoveryContextCleanup to provide an easy method for clients to select between 'delete' and 'destructor' cleanups, and allow the destructor of CrashRecoveryContextCleanupRegister to be pseudo re-entrant.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127929 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 00:59:37 +00:00
Ted Kremenek
fb200e30a4
Tweak CrashRecoveryContext::GetCurrent() to return quickly if 'gCrsahRecoveryEnabled' is false. This avoids us needing to go to thread local storage for
...
the performance sensitive case where we are compiling code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127928 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-19 00:59:33 +00:00
Jim Grosbach
05f98a39e5
setExecutable() should default to success if there's nothing custom for it.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127891 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 18:51:03 +00:00
NAKAMURA Takumi
d4f4e6ee2c
raw_ostream: [PR6745] Tweak formatting (double)%e for Windows hosts.
...
On MSVCRT and compatible, output of %e is incompatible to Posix by default. Number of exponent digits should be at least 2. "%+03d"
FIXME: Implement our formatter in future!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127872 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 09:30:10 +00:00
Bill Wendling
f09a8b533d
Initialize the only-used-with-PPC-double-double parts of the APFloat class. This
...
makes valgrind stop complaining about uninitialized variables being read when it
accesses a bitfield (category) that shares its bits with these variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127871 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 09:09:44 +00:00
Rafael Espindola
49ab1207df
Check RequiresNullTerminator first, or we might read from an invalid address.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127853 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 02:55:51 +00:00
Ted Kremenek
a4f9839701
Augment CrashRecoveryContext to have registered "cleanup" objects that can be used to release resources during a crash.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127849 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 02:05:11 +00:00
Rafael Espindola
9916d2ac39
Use RequiresNullTerminator to create buffers without a null terminator
...
instead of copying.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127835 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 22:18:42 +00:00
Benjamin Kramer
d9103df51b
Add an argument to APInt's magic udiv calculation to specify the number of bits that are known zero in the divided number.
...
This will come in handy soon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127828 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 20:39:06 +00:00
NAKAMURA Takumi
7a7215b563
lib/Support/raw_ostream.cpp: On mingw, report_fatal_error() should not be called at dtor context.
...
report_fatal_error() invokes exit(). We know report_fatal_error() might not write messages to stderr when any errors were detected on FD == 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 02:53:39 +00:00
NAKAMURA Takumi
bab2d49d4a
Windows/PathV2.inc: [PR8520] Recognize "NUL" as special (character) file.
...
FIXME: It is a temporal hack. We should detect as many "special file name" as possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127724 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 02:53:32 +00:00
NAKAMURA Takumi
bfb25cd97c
Windows/Path.inc: [PR6270] PathV1::makeUnique(): Give arbitrary initial seed for workaround.
...
FIXME: We should use sys::fs::unique_file() in future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127723 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 02:53:24 +00:00
John Thompson
6046cffbaf
Add scei vendor
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127705 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 21:51:56 +00:00
Rafael Espindola
9d2234d6a0
Don't compute the file size if we don't need to.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127426 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 20:54:07 +00:00
Rafael Espindola
f7fdad15d9
Add r127409 back now that the windows file was updated.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127417 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 18:33:29 +00:00
Rafael Espindola
b78e2ae4ca
Try to fix the windows build.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127416 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 18:30:48 +00:00
Jakob Stoklund Olesen
4b0e1f1278
Revert r127409 which broke all the Windows bots.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 18:01:43 +00:00
Rafael Espindola
7deb187736
Add support for MemoryBuffers that are not null terminated and add
...
support for creating buffers that cover only a part of a file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127409 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 16:10:30 +00:00
NAKAMURA Takumi
c61ac5120d
lib/Support/regcomp.c: Fix cygwin warning.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127241 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 12:25:29 +00:00
NAKAMURA Takumi
19b6c73878
Windows/PathV2.inc: Eliminate redundant condition. DWORD is unsigned.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127140 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 00:12:53 +00:00
Benjamin Kramer
ca9714470e
raw_ostream: while it is generally desirable to do larger writes, it can lead to
...
inefficient file system buffering if the writes are not a multiple of the desired
buffer size. Avoid this by limiting the large write to a multiple of the buffer
size and copying the remainder into the buffer.
Thanks to Dan for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127026 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 19:49:30 +00:00
Benjamin Kramer
e90756d8a0
raw_ostream: If writing a string that is larger than the buffer, write it directly instead of doing many buffer-sized writes.
...
This caps the number of write(2) calls per string to a maximum of 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127010 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 18:18:16 +00:00
Daniel Dunbar
0aa00f9110
Support: Add llvm::AreStatisticsEnabled().
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-26 23:17:12 +00:00
Cameron Zwarich
8d7285d0e5
The signed version of our "magic number" computation for the integer approximation
...
of a constant had a minor typo introduced when copying it from the book, which
caused it to favor negative approximations over positive approximations in many
cases. Positive approximations require fewer operations beyond the multiplication.
In the case of division by 3, we still generate code that is a single instruction
larger than GCC's code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126097 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-21 00:22:02 +00:00
Devang Patel
98d9f5d90d
Provide tag strings for llvm specific tags.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125986 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 23:06:29 +00:00
Chris Lattner
6309b3e9be
improve support for OpenBSD, patch by Amit Kulkarni!
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 17:04:56 +00:00
Argyrios Kyrtzidis
c788f44642
Check the errorcode.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125804 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 00:47:07 +00:00
Nadav Rotem
093399cbf3
Enhance constant folding of bitcast operations on vectors of floats.
...
Add getAllOnesValue of FP numbers to Constants and APFloat.
Add more tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125776 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17 21:22:27 +00:00
NAKAMURA Takumi
6904f05e60
Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 generally.
...
No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32. In llvm side, i686 and x64 can be treated as similar way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125747 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17 12:24:17 +00:00
Argyrios Kyrtzidis
6e31b9b8c3
Implement a function from PathV2 whose definition is missing.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125574 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15 17:51:19 +00:00
Zhanyong Wan
63cc3a85cc
Adds llvm::sys::path::is_separator() to test whether a char is a path separator
...
on the host OS. Reviewed by dgregor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125406 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 21:24:40 +00:00
Douglas Gregor
f3e3f21db1
Rip out realpath() support. It's expensive, and often a bad idea, and
...
I have another way to achieve the same goal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125239 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 23:33:15 +00:00
Cameron Zwarich
0bef1f3d1b
Attempt to fix the build after r125228.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125236 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 23:02:14 +00:00
Douglas Gregor
025feadb97
Add llvm::sys::path::canonical(), which provides the canonicalized
...
name of a path, after resolving symbolic links and eliminating excess
path elements such as "foo/../" and "./".
This routine still needs a Windows implementation, but I don't have a
Windows machine available. Help? Please?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125228 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 22:11:23 +00:00
NAKAMURA Takumi
e29b0aca51
lib/Support/Errno.cpp: Check strerror_s() with HAVE_DECL_STRERROR_S in config.h.*.
...
AC_CHECK_FUNCS seeks a symbol only in libs. We should check the declaration in string.h.
FIXME: I have never seen mingw(s) have strerror_s() (not _strerror_s()).
FIXME: Autoconf/CMake may seek strerror_s() with the definition MINGW_HAS_SECURE_API in future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125172 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 04:18:48 +00:00
NAKAMURA Takumi
fd289497a5
Windows/Windows.h: Redefine _WIN32_WINNT here. mingw-w64 tends to define it as 0x0502 in its headers.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125171 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 04:18:30 +00:00
NAKAMURA Takumi
2d52a612d9
Windows/Program.inc: Eliminate the declaration of SetInformationJobObject(). It should be provided with _WIN32_WINNT>=0x0500.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125170 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 04:18:21 +00:00
NAKAMURA Takumi
ad1b453b24
Windows/DynamicLibrary.inc: ELM_Callback fix for mingw-w64.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125169 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 04:18:12 +00:00
Rafael Espindola
b4cc031a3e
Don't open the file again in the gold plugin. To be able to do this, update
...
MemoryBuffer::getOpenFile to not close the file descriptor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 22:40:47 +00:00