Commit Graph

1249 Commits

Author SHA1 Message Date
Rui Ueyama
3014066976 Try to unbreak mingw32 buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190438 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-10 21:32:42 +00:00
Rui Ueyama
f42d4247ae Add getenv() wrapper that works on multibyte environment variable.
On Windows, character encoding of multibyte environment variable varies
depending on settings. The only reliable way to handle it I think is to use
GetEnvironmentVariableW().

GetEnvironmentVariableW() works on wchar_t string, which is on Windows UTF16
string. That's not ideal because we use UTF-8 as the internal encoding in LLVM.
This patch defines a wrapper function which takes and returns UTF-8 string for
GetEnvironmentVariableW().

The wrapper function does not do any conversion and just forwards the argument
to getenv() on Unix.

Differential Revision: http://llvm-reviews.chandlerc.com/D1612

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190423 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-10 19:45:51 +00:00
Bob Wilson
0b67c2127e Update CMake file to fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190331 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-09 19:25:11 +00:00
Bob Wilson
db3a9e64f8 Revert patches to add case-range support for PR1255.
The work on this project was left in an unfinished and inconsistent state.
Hopefully someone will eventually get a chance to implement this feature, but
in the meantime, it is better to put things back the way the were.  I have
left support in the bitcode reader to handle the case-range bitcode format,
so that we do not lose bitcode compatibility with the llvm 3.3 release.

This reverts the following commits: 155464, 156374, 156377, 156613, 156704,
156757, 156804 156808, 156985, 157046, 157112, 157183, 157315, 157384, 157575,
157576, 157586, 157612, 157810, 157814, 157815, 157880, 157881, 157882, 157884,
157887, 157901, 158979, 157987, 157989, 158986, 158997, 159076, 159101, 159100,
159200, 159201, 159207, 159527, 159532, 159540, 159583, 159618, 159658, 159659,
159660, 159661, 159703, 159704, 160076, 167356, 172025, 186736

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190328 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-09 19:14:35 +00:00
Dmitri Gribenko
072bd45a36 MemoryBufer: add a test: check that a file with size that is a multiple of the
page size can be null terminated correctly by MemoryBuffer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189965 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-04 18:02:13 +00:00
Alexander Kornienko
280e5eef43 Move generic isPrint and columnWidth implementations to a separate header/source to allow using both generic and system-dependent versions on win32.
Summary:
This is needed so we can use generic columnWidthUTF8 in clang-format on
win32 simultaneously with a separate system-dependent implementations of
isPrint/columnWidth in TextDiagnostic.cpp to avoid attempts to print Unicode
characters using narrow-character interfaces (which is not supported on Windows,
and we'll have to figure out how to handle this).

Reviewers: jordan_rose

Reviewed By: jordan_rose

CC: llvm-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D1559

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189952 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-04 16:00:12 +00:00
Eric Christopher
df69c9c8e3 It's a very large constant. Say so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189899 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-04 00:58:10 +00:00
Eric Christopher
4bc23f0980 Fix copy and pasto with CMake files for unittest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189863 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-03 22:08:28 +00:00
Eric Christopher
800a876128 Add a hashing routine that handles hashing types. Add a test for
hashing the contents of DW_FORM_data1 on top of a type with attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189862 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-03 21:57:57 +00:00
Eric Christopher
9f59ffcb54 Alphabetize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189848 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-03 20:51:14 +00:00
Joerg Sonnenberger
f57a80f494 Add a Python-like join function to merge a list of strings with a
separator between each two elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189846 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-03 20:43:54 +00:00
Eli Friedman
1053a0b9b4 Change default # of digits for APFloat::toString
This is a re-commit of r189442; I'll follow up with clang changes.

The previous default was almost, but not quite enough digits to
represent a floating-point value in a manner which preserves the
representation when it's read back in.  The larger default is much
less confusing.

I spent some time looking into printing exactly the right number of
digits if a precision isn't specified, but it's kind of complicated,
and I'm not really sure I understand what APFloat::toString is supposed
to output for FormatPrecision != 0 (or maybe the current API specification
is just silly, not sure which).  I have a WIP patch if anyone is interested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189624 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-29 23:44:34 +00:00
Rui Ueyama
2957273b88 Option parsing: support case-insensitive option matching.
Re-submitting r189416 with fix for Windows build on where strcasecmp is not defined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189501 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-28 20:04:31 +00:00
Ted Kremenek
9006170945 Revert r189442 "Change default # of digits for APFloat::toString"
This is breaking numerous Clang tests on the buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-28 06:21:46 +00:00
Eli Friedman
631bce51b9 Change default # of digits for APFloat::toString
The previous default was almost, but not quite enough digits to
represent a floating-point value in a manner which preserves the
representation when it's read back in.  The larger default is much
less confusing.

I spent some time looking into printing exactly the right number of
digits if a precision isn't specified, but it's kind of complicated,
and I'm not really sure I understand what APFloat::toString is supposed
to output for FormatPrecision != 0 (or maybe the current API specification
is just silly, not sure which).  I have a WIP patch if anyone is interested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189442 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-28 05:23:51 +00:00
Rui Ueyama
1997734e37 Revert "Option parsing: support case-insensitive option matching." as it broke Windows buildbot.
This reverts r189416.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189424 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-28 00:02:06 +00:00
Rui Ueyama
055f4e99ff Option parsing: support case-insensitive option matching.
Link.exe's command line options are case-insensitive. This patch
adds a new attribute to OptTable to let the option parser to compare
options, ignoring case.

Command lines are generally case-insensitive on Windows. CL.exe is an
exception. So this new attribute should be useful for other commands
running on Windows.

Differential Revision: http://llvm-reviews.chandlerc.com/D1485

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189416 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-27 23:47:01 +00:00
NAKAMURA Takumi
3f256c2e0b [Win32] mapped_file_region: Fix a bug in CreateFileMapping() that Size must contain Offset when Offset >= 65536.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189021 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-22 15:14:53 +00:00
NAKAMURA Takumi
37693da119 Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189020 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-22 15:14:45 +00:00
NAKAMURA Takumi
a5bd3937ab Suppress MemoryBufferTest.cpp on win32 for now. Investigating.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189001 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-22 12:00:44 +00:00
NAKAMURA Takumi
4efbeb2700 MemoryBufferTest.cpp: Tweak offset corresponding to the case that PageSize is greater than 8000.
PageSize, aka AllocationGranularity, is 65536 on Win32 (and Cygwin).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188999 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-22 10:23:58 +00:00
David Blaikie
296ca41b2d Basic unit tests for PointerUnion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188933 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-21 21:30:23 +00:00
Peter Collingbourne
2b762cc75d Introduce SpecialCaseList::isIn overload for GlobalAliases.
Differential Revision: http://llvm-reviews.chandlerc.com/D1437

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188688 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-19 19:00:35 +00:00
Peter Collingbourne
353149ea2f Remove SpecialCaseList::findCategory.
It turned out that I didn't need this for DFSan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188646 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-19 00:24:20 +00:00
Aaron Ballman
10ec62d2d2 Removing a spurious semi-colon; this macro expands into a namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188525 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-16 01:53:58 +00:00
Aaron Ballman
d5f33aa33f Tighten up the yamilizer so it stops eliding empty sequences if the embedded empty sequence is the first key/value in a map which is itself in a sequence.
Patch with help from Nick Kledzik.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188508 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-15 23:17:53 +00:00
Alexey Samsonov
ef7aefc53b Expose CRC-32 implementation from zlib
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188380 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-14 16:03:29 +00:00
Hans Wennborg
b06ccefc91 Options: explicit handling of --
Clients of the option parsing library should handle it explicitly
using a KIND_REMAINING_ARGS option.

Clang and lld have been updated in r188316 and r188318, respectively.

Also fix -Wsign-compare warning in the option parsing test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188323 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-13 22:23:05 +00:00
Hans Wennborg
af9e355755 Options: Add new option kind that consumes remaining arguments
This adds KIND_REMAINING_ARGS, a class of options that consume
all remaining arguments on the command line.

This will be used to support /link in clang-cl, which is used
to forward all remaining arguments to the linker.

It also allows us to remove the hard-coded handling of "--",
allowing clients (clang and lld) to implement that functionality
themselves with this new option class.

Differential Revision: http://llvm-reviews.chandlerc.com/D1387

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188314 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-13 21:09:50 +00:00
Nick Lewycky
72dba254ae Fix an oversight in isPotentiallyReachable where we wouldn't do any CFG-walking
to find loops if the From and To instructions were in the same block.

Refactor the code a little now that we need to fill to start the CFG-walking
algorithm with more than one starting basic block sometimes.

Special thanks to Andrew Trick for catching an error in my understanding of
natural loops in code review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188236 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-13 00:03:47 +00:00
Tareq A. Siraj
225396c2b5 Fixes a bug when iterating on paths
This fixes the incorrect implementation of iterating on file/directory
paths.

Differential Review: http://llvm-reviews.chandlerc.com/D1277


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188183 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12 17:10:49 +00:00
Alexey Samsonov
35f4d41471 Relax conditions of test added in r188156 to fix it on Windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188157 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12 09:04:58 +00:00
Alexey Samsonov
d976d43f23 Introduce factory methods for SpecialCaseList
Summary:
Doing work in constructors is bad: this change suggests to
call SpecialCaseList::create(Path, Error) instead of
"new SpecialCaseList(Path)". Currently the latter may crash with
report_fatal_error, which is undesirable - sometimes we want to report
the error to user gracefully - for example, if he provides an incorrect
file as an argument of Clang's -fsanitize-blacklist flag.

Reviewers: pcc

Reviewed By: pcc

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1327

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188156 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12 07:49:36 +00:00
Alexey Samsonov
783a0387c5 Fix off-by-one error in Regex::isValid
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187992 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-08 17:32:45 +00:00
Benjamin Kramer
6ee0581f42 Use EXPECT_TRUE/EXPECT_FALSE to avoid bogus warnings from the guts of gtest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187976 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-08 11:17:39 +00:00
Alexander Kornienko
6cd4f2a2b3 Changed isPrint for U+00AD SOFT HYPHEN to return true.
Summary:
This is consistent with MacOSX implementation, and most terminals
actually display this character (checked on gnome-terminal, lxterminal, lxterm,
Terminal.app, iterm2). Actually, this is in line with the ISO Latin 1 standard
(ISO 8859-1), which defines it differently from the Unicode Standard. More
information here: http://www.cs.tut.fi/~jkorpela/shy.html

Reviewers: gribozavr, jordan_rose

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1310

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187949 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-08 01:10:50 +00:00
Alexander Kornienko
6214ae5eff Disabled columnWidth test for OSX, need someone with Mac to deal with this effectively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187848 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-07 02:08:31 +00:00
Alexander Kornienko
074ce33290 Use correct platform detection macro: __MACOSX__ -> __APPLE__
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187847 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-07 01:23:28 +00:00
Reid Kleckner
97c57dfcb4 Fix boolean logic in LockFileManager and test it
This fixes a bug from r187826.

Reviewers: hans

Differential Revision: http://llvm-reviews.chandlerc.com/D1304

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187846 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-07 01:22:04 +00:00
Alexander Kornienko
31a4f1f1ea Disable tests on WIN32 (which has incorrect implementation of isPrint and
columnWidth), and partially disable tests on MACOSX (which handles some
characters differently).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187842 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-07 00:41:18 +00:00
Alexander Kornienko
ece0bec0c8 Implemented llvm::sys::locale::columnWidth and isPrint for the case of generic UTF8-capable terminal.
Summary:
This is a second attempt to get this right. After reading the Unicode
Standard I came up with the code that uses definitions of "printable" and
"column width" more suitable for terminal output (i.e. fixed-width fonts and
special treatment of many control characters).
The implementation here can probably be used for Windows and MacOS if someone
can test it properly.
The patch addresses PR14910.

Reviewers: jordan_rose, gribozavr

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1253

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187837 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-07 00:07:07 +00:00
Peter Collingbourne
aa80e61b0d Introduce Regex::isLiteralERE function.
This will be used to implement an optimisation for literal entries
in special case lists.

Differential Revision: http://llvm-reviews.chandlerc.com/D1278

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187731 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-05 17:47:59 +00:00
Peter Collingbourne
7bba9c5c0a Make one of the AttributeSet ctors maintain the invariant that the
attribute list is ordered by index.

Differential Revision: http://llvm-reviews.chandlerc.com/D1265

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187682 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-02 22:29:40 +00:00
Hans Wennborg
6bf104b165 Option parsing: recognize the special -- token
Everything that comes after -- should be treated as a filename. This
enables passing in filenames that would otherwise be conflated with
command-line options.

This is especially important for clang-cl which supports options
starting with /, which are easily conflatable with Unix-style
path names.

Differential Revision: http://llvm-reviews.chandlerc.com/D1274

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187675 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-02 21:20:27 +00:00
Sean Silva
2b61eb9843 Update incorrect file headers.
One of these was spotted in review by Rafael.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187598 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-01 18:42:28 +00:00
Hans Wennborg
a15d5db7f2 Option parsing: remove non-SUPPORT_ALIASARGS fall-back
The clients of this code have been updated to all support AliasArgs.

This depends on Clang r187538 and lld r187541.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187546 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-31 23:28:51 +00:00
Hans Wennborg
9dd8c0cffe Option parsing: add support for alias arguments.
This makes option aliases more powerful by enabling them to
pass along arguments to the option they're aliasing.

For example, if we have a joined option "-foo=", we can now
specify a flag option "-bar" to be an alias of that, with the
argument "baz".

This is especially useful for the cl.exe compatible clang driver,
where many options are aliases. For example, this patch enables
us to alias "/Ox" to "-O3" (-O is a joined option), and "/WX" to
"-Werror" (again, -W is a joined option).

Differential Revision: http://llvm-reviews.chandlerc.com/D1245

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187537 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-31 22:44:41 +00:00
Matt Arsenault
1bf0ec4e16 Fix ptr vector inconsistency in CreatePointerCast
One form would accept a vector of pointers, and the other did not.
Make both accept vectors of pointers, and add an assertion
for the number of elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187464 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-31 00:17:33 +00:00
Rafael Espindola
9ce8b2818d Fix windows' implementation of status when a file doesn't exist.
The unix one was returning no_such_file_or_directory, but the windows one
was return success.

Update the one one caller that was depending on the old behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187463 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-31 00:10:25 +00:00
Matt Arsenault
3181f5900f Respect address space sizes in isEliminableCastPair.
This avoids constant folding bitcast/ptrtoint/inttoptr combinations
that have illegal bitcasts between differently sized address spaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187455 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30 22:27:10 +00:00
Matt Arsenault
485c7fd76b Revert "Remove isCastable since nothing uses it now"
Apparently dragonegg uses it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187454 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30 22:02:14 +00:00
Matt Arsenault
0de6832c16 Remove isCastable since nothing uses it now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187448 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30 21:11:17 +00:00
Matt Arsenault
f34dc428fa Change behavior of calling bitcasted alias functions.
It will now only convert the arguments / return value and call
the underlying function if the types are able to be bitcasted.
This avoids using fp<->int conversions that would occur before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187444 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30 20:45:05 +00:00
Rafael Espindola
f4ab63f3d8 Implement getUniqueID for directories on windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187441 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30 20:25:53 +00:00
Rui Ueyama
264e92d6db Implement TokenizeWindowsCommandLine.
This is a follow up patch for r187390 to implement the parser for the
Windows-style command line. This should follow the rule as described
at http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx

Differential Revision: http://llvm-reviews.chandlerc.com/D1235

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187430 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30 19:03:20 +00:00
Rafael Espindola
3ed45fe2be Include st_dev to make the result of getUniqueID actually unique.
This will let us use getUniqueID instead of st_dev directly on clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187378 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-29 21:26:49 +00:00
Michael Gottesman
ca4d2e60ea [APFloat] Make all arithmetic operations with NaN produce positive NaNs.
IEEE-754R 1.4 Exclusions states that IEEE-754R does not specify the
interpretation of the sign of NaNs. In order to remove an irrelevant
variable that most floating point implementations do not use,
standardize add, sub, mul, div, mod so that operating anything with
NaN always yields a positive NaN.

In a later commit I am going to update the APIs for creating NaNs so
that one can not even create a negative NaN.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187314 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-27 21:49:25 +00:00
Nick Lewycky
c2c008aa18 Update this CMakeLists.txt for r187283 too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187286 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-27 01:26:30 +00:00
Nick Lewycky
81e480463d Reimplement isPotentiallyReachable to make nocapture deduction much stronger.
Adds unit tests for it too.

Split BasicBlockUtils into an analysis-half and a transforms-half, and put the
analysis bits into a new Analysis/CFG.{h,cpp}. Promote isPotentiallyReachable
into llvm::isPotentiallyReachable and move it into Analysis/CFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187283 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-27 01:24:00 +00:00
Rafael Espindola
496cf2308a Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."
This reverts commit r187248. It broke many bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-26 22:13:57 +00:00
Bill Schmidt
d063a326b2 [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.
Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for
all PowerPC targets, whether 32- or 64-bit.  They will both implicitly
define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not
for 32-bit targets.  We cannot be sure that all other possible
compilers used to compile Clang/LLVM define both __ppc__ and
__powerpc__, for example, so it is best to check for both when relying
on either inside the Clang/LLVM code base.

This patch makes sure we always check for both variants.  In addition,
it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp.
(At least one of __ppc__ and __powerpc__ should always be defined when
compiling for a PowerPC target, no matter which compiler is used, so
testing for them is unnecessary.)

There are some places in the compiler that check for other variants,
like __POWERPC__ and _POWER, and I have left those in place.  There is
no need to add them elsewhere.  This seems to be in Apple-specific
code, and I won't take a chance on breaking it.

There is no intended change in behavior; thus, no test cases are
added.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187248 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-26 21:39:15 +00:00
Rafael Espindola
268f400c57 Don't end a file name with a dot. It looks odd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187124 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-25 15:00:17 +00:00
Akira Hatanaka
3af1c9d334 [mips] Use pristine object file while processing relocations.
Similar to ARM change r182800, dynamic linker will read bits/addends from
    the original object rather than from the object that might have been patched
    previously. For the purpose of relocations for MCJIT stubs on MIPS, we
    internally use otherwise unused MIPS relocations.
    
    The change also enables MCJIT unit tests for MIPS (EL/BE), and the following
    two tests now pass:
    
    - MCJITTest.return_global and
    - MCJITTest.multiple_functions.
    
    These issues have been tracked as Bug 16250.

    Patch by Petar Jovanovic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187019 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-24 01:58:40 +00:00
Eli Bendersky
ab99d04c59 Refactor the unit test for MemoryBuffer::getOpenFileSlice
Run in two different modes: with and without reopening the temporary file
between creating it and mapping it with MemoryBuffer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186986 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 20:58:51 +00:00
Rafael Espindola
70c7e48545 Split getOpenFile into getOpenFile and getOpenFileSlice.
The main observation is that we never need both the filesize and the map size.
When mapping a slice of a file, it doesn't make sense to request a null
terminator and that would be the only case where the filesize would be used.

There are other cleanups that should be done in this area:

* A client should not have to pass the size (even an explicit -1) to say if
  it wants a null terminator or not, so we should probably swap the argument
  order.
* The default should be to not require a null terminator. Very few clients
  require this, but many end up asking for it just because it is the default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186984 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 20:25:01 +00:00
Eli Bendersky
f65712bfe3 Add a simple unit test for MemoryBuffer::getOpenFile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186887 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-22 22:46:21 +00:00
Hans Wennborg
6c7e78746e Option parsing: allow aliases in groups
Option aliases in option groups were previously disallowed by an assert.
As far as I can tell, there was no technical reason for this, and I would
like to be able to put cl.exe compatible options in their own group for Clang,
so let's change the assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186838 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-22 16:18:13 +00:00
Hans Wennborg
6cc16a0479 Add Option unit tests to the make build
Previously, they were only built and run in the CMake build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186756 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-20 03:04:36 +00:00
Reid Kleckner
75b1783b2b Add some flag exclusion tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186704 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-19 18:05:13 +00:00
Rafael Espindola
c9c9825c93 Add a unit test for checking that we respect the F_Binary flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186676 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-19 14:41:25 +00:00
Reid Kleckner
431b0a7646 [Support] Beef up and expose the response file parsing in llvm::cl
The plan is to use it for clang and lld.

Major behavior changes:
- We can now parse UTF-16 files that have a byte order mark.
- PR16209: Don't drop backslashes on the floor if they don't escape
  anything.

The actual parsing loop was based on code from Clang's driver.cpp,
although it's been rewritten to track its state with control flow rather
than state variables.

Reviewers: hans

Differential Revision: http://llvm-reviews.chandlerc.com/D1170

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186587 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18 16:52:05 +00:00
Rafael Espindola
1c881d9d35 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186561 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18 03:29:51 +00:00
Rafael Espindola
60f18ad8a5 Fix a regression I introduced back in r178147.
We don't want cast and dyn_cast to work on temporaries. They don't extend
lifetime like a direct bind to a reference would, so they can introduce
hard to find bugs.

I added tests to make sure we don't regress this. Thanks to Eli Friedman for
noticing this and for his suggestions on how to test it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186559 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-18 02:42:40 +00:00
Eli Friedman
763c066dca Handle '.' correctly in hex float literal parsing.
There were a couple of different loops that were not handling
'.' correctly in APFloat::convertFromHexadecimalString; these mistakes
could lead to assertion failures and incorrect rounding for overlong
hex float literals.

Fixes PR16643.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186539 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-17 22:17:29 +00:00
Rafael Espindola
c1b49b56d4 Add a wrapper for open.
This centralizes the handling of O_BINARY and opens the way for hiding more
differences (like how open behaves with directories).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 19:44:17 +00:00
Peter Collingbourne
71981ef040 Make SpecialCaseList match full strings, as documented, using anchors.
Differential Revision: http://llvm-reviews.chandlerc.com/D1149

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 17:56:07 +00:00
Reid Kleckner
06c847e83e [Support] Add a Unicode conversion wrapper from UTF16 to UTF8
This is to support parsing UTF16 response files in LLVM/lib/Option for
lld and clang.

Reviewers: hans

Differential Revision: http://llvm-reviews.chandlerc.com/D1138

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186426 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 17:14:33 +00:00
NAKAMURA Takumi
334f8b9b37 unittests/Support: Add TimeValue.Win32FILETIME, corresponding to r186374.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186375 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 02:44:23 +00:00
NAKAMURA Takumi
e7f0393f6d Rename Support.TimeValue to TimeValue.time_t in unittests/Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186372 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16 02:03:32 +00:00
Stephen Lin
60808c76b4 Convert Windows to Unix line endings, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186264 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 22:08:55 +00:00
Rafael Espindola
e39cad4b04 Attempt at fixing a mingw bot.
It is failing with

YAMLTest.cpp:38:   instantiated from here
YAMLTraits.h:226: error: 'llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping' is not a valid template argument for type 'void (*)(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' because function 'static void llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' has not external linkage

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186245 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-13 12:36:30 +00:00
Benjamin Kramer
459d7bf8f6 Sync SmallBitVector with BitVector. Add unit tests for the missing methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186123 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-11 21:59:16 +00:00
Peter Collingbourne
46e11c4c97 Implement categories for special case lists.
A special case list can now specify categories for specific globals,
which can be used to instruct an instrumentation pass to treat certain
functions or global variables in a specific way, such as by omitting
certain aspects of instrumentation while keeping others, or informing
the instrumentation pass that a specific uninstrumentable function
has certain semantics, thus allowing the pass to instrument callers
according to those semantics.

For example, AddressSanitizer now uses the "init" category instead of
global-init prefixes for globals whose initializers should not be
instrumented, but which in all other respects should be instrumented.

The motivating use case is DataFlowSanitizer, which will have a
number of different categories for uninstrumentable functions, such
as "functional" which specifies that a function has pure functional
semantics, or "discard" which indicates that a function's return
value should not be labelled.

Differential Revision: http://llvm-reviews.chandlerc.com/D1092

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185978 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 22:03:17 +00:00
Peter Collingbourne
c7087f8e42 Add some SpecialCaseList unit tests.
Differential Revision: http://llvm-reviews.chandlerc.com/D1091

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185977 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 22:03:12 +00:00
Sean Silva
845e196a52 Make BinaryRef output correctly in case of empty data.
Previously, it would simply output nothing, but it should output an
empty string `""`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185894 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 00:54:46 +00:00
Rafael Espindola
1cce797d32 We now always create files with the correct permissions. Simplify the interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185834 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 16:42:01 +00:00
Rafael Espindola
2c87a1705e Fix windows build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 22:32:33 +00:00
Rafael Espindola
1276b39613 Use sys::fs::createTemporaryFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185719 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 20:14:52 +00:00
Craig Topper
6227d5c690 Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-04 01:31:24 +00:00
David Blaikie
5186591cf5 Fix -Wsign-compare warning and remove windows-style line endings introduced by r185421
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185443 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 16:48:10 +00:00
Elena Demikhovsky
e5cb25f860 Fixed alignment of code sections in the JIT mode. Added a test to the JITMemoryManager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185421 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 12:24:22 +00:00
Michael Gottesman
b57770387a [APFloat] Ensure that we can properly parse strings that do not have null terminators.
rdar://14323230

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185397 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-01 23:54:08 +00:00
Matt Arsenault
76bf61fe07 Fix copypaste error in test.
Thename says it's an i32*, but it was actually creating another i8*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185239 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 23:24:10 +00:00
Daniel Malea
8bb9ec15c8 Replace UNIXy path with os-independent one in DebugIR unit test
- should resolve windows buildbot failure



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185232 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 22:17:57 +00:00
Jakob Stoklund Olesen
5d3257e37c Fix a bad overflow check pointed out by Ben.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185226 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:51:18 +00:00
Daniel Malea
9e638df937 Fix Windows/Darwin build error in DebugIR unit tests
- mistakenly used get_current_dir() linux function
- replaced with getcwd/_getcwd as appropriate for current platform



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185225 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:49:53 +00:00
Andrew Kaylor
40d8171e3e Revising the MCJIT ObjectCache interface to allow subclasses to avoid retaining references to returned objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185221 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:40:16 +00:00
Daniel Malea
5fa8186b8d Adding tests for DebugIR pass
- lit tests verify that each line of input LLVM IR gets a !dbg node and a
  corresponding entry of metadata that contains the line number 
- unit tests verify that DebugIR works as advertised in the interface
- refactored some useful IR generation functionality from the MCJIT unit tests
  so it can be reused



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185212 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 20:37:20 +00:00
Jakob Stoklund Olesen
d7648ff20f Add a division operator to BlockFrequency.
Allow a BlockFrequency to be divided by a non-zero BranchProbability
with saturating arithmetic. This will be used to compute the frequency
of a loop header given the probability of leaving the loop.

Our long division algorithm already saturates on overflow, so that was a
freebie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185184 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 18:23:42 +00:00
Rafael Espindola
08ddd12e44 Add a convenience createUniqueDirectory function.
There are a few valid situation where we care about the structure inside a
directory, but not about the directory itself. A simple example is for unit
testing directory traversal.

PathV1 had a function like this, add one to V2 and port existing users of the
created temp file and delete it hack to using it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185059 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 03:45:31 +00:00
Michael Gottesman
fb76ffd10b [APFloat] Added unittest for APFloat.divide that checks special cases, result categories, and result statuses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185050 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 00:42:00 +00:00
Michael Gottesman
bb77593765 Removed two logging printf statements from the APFloat tests... = /.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185045 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 00:00:45 +00:00
Michael Gottesman
2eda897c3c [APFloat] Added unittest for APFloat.multiply that checks special cases, result categories, and result status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 23:55:26 +00:00
Michael Gottesman
d7d88d969e [APFloat] Added unittest for APFloat.subtract that checks special cases, result categories, and result status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185043 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 23:55:23 +00:00
Michael Gottesman
a8f9364461 [APFloat] Removed debugging cruft that snuck in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184974 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 17:59:36 +00:00
Rafael Espindola
df0f525cc4 Remove unused includes.
llvm itself is now PathV1 clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184947 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 13:54:34 +00:00
Rafael Espindola
50188c1f42 Port GetMainExecutable over to PathV2.
I will remove the V1 version as soon as I change clang in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184914 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 05:01:35 +00:00
Michael Gottesman
567a1126fb [APFloat] Removed trailing whitespace from unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184715 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24 09:58:09 +00:00
Michael Gottesman
683069ffba [APFloat] Added a large unittest for APFloat.add that checks that special values are computed correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184714 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24 09:58:07 +00:00
Benjamin Kramer
b47aceaf06 Revert "BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability."
This reverts commit r184584. Breaks PPC selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184590 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 20:20:27 +00:00
Benjamin Kramer
93702a3b07 BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability.
Zero is used by BlockFrequencyInfo as a special "don't know" value. It also
causes a sink for frequencies as you can't ever get off a zero frequency with
more multiplies.

This recovers a 10% regression on MultiSource/Benchmarks/7zip. A zero frequency
was propagated into an inner loop causing excessive spilling.

PR16402.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184584 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 19:30:05 +00:00
Akira Hatanaka
deda39dbdf [mips] Remove Triple:mips from SupportedArchs in MCJIT unittests
MIPS does not handle multiple relocations correctly, so two tests from the
unittests are expected to fail. These are:
 - MCJITTest.return_global and
 - MCJITTest.multiple_functions.

Until the multiple relocations are fixed, XFAIL the MCJIT unittests for
MIPS. This issue is tracked as Bug 16250.

Patch by Petar Jovanovic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184461 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 20:33:06 +00:00
Michael Gottesman
a1694e5784 [APFloat] Rename isIEEENormal => isNormal and remove old isNormal method.
The old isNormal is already functionally replaced by the method isFiniteNonZero
in r184350 and all references to said method were replaced in LLVM/clang in
r184356/134366.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184449 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:34:38 +00:00
Michael Gottesman
3781fbc29a [APFloat] Fix typo in test so we actually test if we handle denormals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:25:16 +00:00
Rafael Espindola
9aa3365426 Rename fs::GetUniqueID to fs::getUniqueID to match the style guide.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 15:06:35 +00:00
Michael Gottesman
4f71c1b2b9 [APFloat] Changed APFloat::isNormal => APFloat::isFiniteNonZero for all tests in unittests.
I forgot to to do this in r184356. The only references were in APFloatTest.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184366 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:53:45 +00:00
Aaron Ballman
4655485eb7 Modified the implementation of fs::GetUniqueID on Windows such that it actually finds a unique identifier for a file. Also adds unit tests for GetUniqueID.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184351 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:03:50 +00:00
Michael Gottesman
7032c883cd [APFloat] Added isFiniteNonZero predicate.
This is the first patch in a series of patches to rename isNormal =>
isFiniteNonZero and isIEEENormal => isNormal. In order to prevent careless
errors on my part the overall plan is:

1. Add the isFiniteNonZero predicate with tests. I can do this in a method
independent of isNormal. (This step is this patch).
2. Convert all references to isNormal with isFiniteNonZero. My plan is to
comment out isNormal locally and continually convert isNormal references =>
isFiniteNonZero until llvm/clang compiles.
3. Remove old isNormal and rename isIEEENormal to isNormal.
4. Look through all of said references from patch 2 and see if we can simplify
them by using the new isNormal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184350 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:00:17 +00:00
Bill Wendling
ae5758bac7 Add unit test to test a trivial verifier check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184338 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 19:26:44 +00:00
Rafael Espindola
675e0ac0bf Avoid using PathV1.h in Program.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183940 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-13 20:25:38 +00:00
Rafael Espindola
9f1d9fd196 Remove the program class.
It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just
those two functions and make Execute and Wait implementations details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183864 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 20:58:35 +00:00
Rafael Espindola
a11c3e2501 Move PathV2.h to Path.h
Most clients have already been moved from Path V1 to V2. The ones using V1
now include PathV1.h explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183801 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 22:21:28 +00:00
Aaron Ballman
0c79301807 sys::process::get_id() now returns the process ID instead of a process handle on Windows. Patch thanks to Kim Gräsman!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183621 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-08 20:29:03 +00:00
Benjamin Kramer
a77376dae1 BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183525 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 15:14:31 +00:00
Benjamin Kramer
597253da97 Optimize BitVector::all().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183521 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 14:14:38 +00:00
Michael Gottesman
b30718af1a IEEE-754R 5.7.2 General Operations is* operations (except for isCanonical).
Specifically the following work was done:

1. If the operation was not implemented, I implemented it.

2. If the operation was already implemented, I just moved its location
in the APFloat header into the IEEE-754R 5.7.2 section. If the name was
incorrect, I put in a comment giving the true IEEE-754R name.

Also unittests have been added for all of the functions which did not
already have a unittest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183179 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04 03:46:25 +00:00
Benjamin Kramer
44dbb749f0 Try to avoid "integer literal too big" warnings from older GCCs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-01 22:29:41 +00:00
Eric Christopher
769d24a60d Add support for adding the contents of a StringRef to the MD5 hash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183054 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 22:34:56 +00:00
Eric Christopher
cbb45aa123 Convert more unsigned char -> uint8_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183053 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 22:34:52 +00:00
Michael Gottesman
504e2da08c [APFloat] Added a unittest for APFloat::getZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183028 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 18:43:34 +00:00
Rafael Espindola
198f972077 Remove unused member.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182958 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 20:19:35 +00:00
Michael Gottesman
964722ca40 Implement IEEE-754R 2008 nextUp/nextDown functions in the guise of the function APFloat::next(bool nextDown).
rdar://13852078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182945 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 18:07:13 +00:00
Eric Christopher
12378d4872 Add a comment and some tests including the NULL byte.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182900 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 00:43:26 +00:00
Michael Gottesman
999c693694 Added a unittest for APFloat::getSmallestNormalized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182897 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 00:18:47 +00:00
Michael Gottesman
7d13d525bc Added code to the unittest for APFloat::getSmallest to double check that we consider the result to be denormal.
I additionally changed certain checks to use EXPECT_FALSE instead of a boolean
complement with EXPECT_TRUE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182896 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 00:18:44 +00:00
Michael Gottesman
3e8d356b81 Add a unittest for APFloat::getSmallest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182894 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29 23:58:29 +00:00
Michael Gottesman
a32edcfbc5 [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for use in APFloat IEEE-754R 2008 nextUp/nextDown function.
rdar://13852078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182801 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-28 19:50:20 +00:00
Eric Christopher
725e3d324b Add to testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182693 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 23:20:16 +00:00
Eric Christopher
f7306f224e ArrayRef-ize MD5 and clean up a few variable names.
Add a stringize method to make dumping a bit easier, and add a testcase
exercising a few different paths.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182692 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 23:08:17 +00:00
Michael J. Spencer
3b77151a61 [Support] Remove Count{Leading,Trailing}Zeros_{32,64}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182690 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 22:58:37 +00:00
Michael J. Spencer
54c7482388 [Support][MathExtras] Fix literal type issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182679 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 22:19:05 +00:00
Michael J. Spencer
36fe3f2b56 [Support] Add type generic bit utilities to MathExtras.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182667 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24 20:29:47 +00:00
Filip Pizlo
6cfed36338 Expose the RTDyldMemoryManager through the C API. This allows clients of
the C API to provide their own way of allocating JIT memory (both code 
and data) and finalizing memory permissions (page protections, cache 
flush).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182448 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-22 02:46:43 +00:00
Filip Pizlo
1441bf7a41 Roll out r182407 and r182408 because they broke builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182409 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21 20:03:01 +00:00
Filip Pizlo
52755c472a Expose the RTDyldMemoryManager through the C API. This allows clients of
the C API to provide their own way of allocating JIT memory (both code 
and data) and finalizing memory permissions (page protections, cache 
flush).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182408 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21 20:00:56 +00:00
Ulrich Weigand
e3658a26b5 Alternative fix for problem addressed in r182233
Revision r182233 partially reverted the change in r181200 to simplify
JIT unif test #ifdefs, because that change caused a link error on some
host operating systems where the export list requires the following
symbols to be defined:

 JITTest_AvailableExternallyFunction
 JITTest_AvailableExternallyGlobal

As discussed on the list, the commit reverts r182233 (and re-installs
the full r181200 change), and instead fixes the link problem by moving
those two symbols to the top of the file and unconditionally defining
them.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182367 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21 10:30:59 +00:00
Bob Wilson
a4de3f2c85 Partially revert change in r181200 that tried to simplify JIT unit test #ifdefs.
The export list for this test requires the following symbols to be available:
  JITTest_AvailableExternallyFunction
  JITTest_AvailableExternallyGlobal
The change in r181200 commented them out, which caused the test to fail to
link, at least on Darwin. I have only reverted the change for arm, since I
can't test the other targets and since it sounds like that change was fixing
real problems for those other targets. It should be possible to rearrange the
code to keep those definitions outside the #ifdefs, but that should be done by
someone who can reproduce the problems that r181200 was trying to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182233 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-20 06:13:09 +00:00
Renato Golin
4e4464bf74 SubArch support in MCJIT unittest
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182220 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-19 20:10:10 +00:00
Tim Northover
233a4d7124 AArch64: enable MCJIT unittests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182217 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-19 19:44:56 +00:00
David Tweed
abb38fe8de Minor changes to the MCJITTest unittests to use the correct API for finalizing
the JIT object (including XFAIL an ARM test that now needs fixing). Also renames
internal function for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182085 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-17 10:01:46 +00:00
David Blaikie
453f4f0130 Use only explicit bool conversion operators
BitVector/SmallBitVector::reference::operator bool remain implicit since
they model more exactly a bool, rather than something else that can be
boolean tested.

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

One behavior change (YAMLParser) was made, though no test case is
included as I'm not sure how to reach that code path. Essentially any
comparison of llvm::yaml::document_iterators would be invalid if neither
iterator was at the end.

This helped uncover a couple of bugs in Clang - test cases provided for
those in a separate commit along with similar changes to `operator bool`
instances in Clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181868 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-15 07:36:59 +00:00
Filip Pizlo
13a3cf1928 SectionMemoryManager shouldn't be a JITMemoryManager. Previously, the
EngineBuilder interface required a JITMemoryManager even if it was being used 
to construct an MCJIT. But the MCJIT actually wants a RTDyldMemoryManager. 
Consequently, the SectionMemoryManager, which is meant for MCJIT, derived 
from the JITMemoryManager and then stubbed out a bunch of JITMemoryManager 
methods that weren't relevant to the MCJIT.

This patch fixes the situation: it teaches the EngineBuilder that 
RTDyldMemoryManager is a supertype of JITMemoryManager, and that it's 
appropriate to pass a RTDyldMemoryManager instead of a JITMemoryManager if 
we're using the MCJIT. This allows us to remove the stub methods from 
SectionMemoryManager, and make SectionMemoryManager a direct subtype of 
RTDyldMemoryManager.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181820 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-14 19:29:00 +00:00
Duncan Sands
8305acb200 Get the unittests compiling when building with cmake and the setting
-DLLVM_ENABLE_THREADS=false.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181788 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-14 13:29:16 +00:00
Shuxin Yang
4b6b53b0ce Fix a bug that APFloat::fusedMultiplyAdd() mistakenly evaluate "14.5f * -14.5f + 225.0f" to 225.0f.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181715 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-13 18:03:12 +00:00
Andrew Kaylor
50be71d182 Fix MCJITCAPITest.cpp unit test on Windows.
MCJIT on Windows requires an explicit target triple with "-elf" appended to generate objects in ELF format.  The common test framework was setting up this triple, but it wasn't passed to the C API in the test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181614 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 17:58:41 +00:00
Rafael Espindola
e449654815 Remove exception handling support from the old JIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181354 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-07 20:53:59 +00:00
Andrew Trick
61e0172197 Implemented public interface for modifying registered (not positional or sink options) command line options at runtime.
Patch by Dan Liew!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 21:56:35 +00:00
Andrew Trick
b7ad33b719 Support command line option categories.
Patch by Dan Liew!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181253 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 21:56:23 +00:00
Ulrich Weigand
7207285e65 [SystemZ] Set up JIT/MCJIT test cases
This patch adds the necessary configuration bits and #ifdef's to set up
the JIT/MCJIT test cases for SystemZ.  Like other recent targets, we do
fully support MCJIT, but do not support the old JIT at all.  Set up the
lit config files accordingly, and disable old-JIT unit tests.

Patch by Richard Sandiford.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181207 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 16:21:50 +00:00
Ulrich Weigand
1218bc4fe6 Simplify JIT unit test #ifdefs
Several platforms need to disable all old-JIT unit tests, since they only
support the new MCJIT.  This currently done via #ifdef'ing out those tests
in the ExecutionEngine/JIT/*.cpp files.  As those #ifdef's have grown
historically, we now have a number of repeated directives which -in total-
cover nearly the whole file, but leave a couple of helper functions out.
When building the tests with clang itself, those helper functions now
cause spurious "unused function" warnings.

To fix those warnings, and also to remove the duplicate #ifdef conditions
and make it easier to disable the tests for a new target, this patch
consolidates the #ifdefs into a single one per file, which covers all
the tests including all helper routines.

Tested on PowerPC and SystemZ.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181200 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 16:10:35 +00:00
Arnold Schwaighofer
46e7e6f39e Add missing PatternMatch.cpp to CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181147 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05 02:14:28 +00:00
Arnold Schwaighofer
e79d92c592 PatternMatch: Matcher for (un)ordered floating point min/max
Add support for matching 'ordered' and 'unordered' floating point min/max
constructs.

In LLVM we can express min/max functions as a combination of compare and select.
We have support for matching such constructs for integers but not for floating
point. In floating point math there is no total order because of the presence of
'NaN'. Therefore, we have to be careful to preserve the original fcmp semantics
when interpreting floating point compare select combinations as a minimum or
maximum function. The resulting 'ordered/unordered' floating point maximum
function has to select the same value as the select/fcmp combination it is based
on.

 ordered_max(x,y)   = max(x,y) iff x and y are not NaN, y otherwise
 unordered_max(x,y) = max(x,y) iff x and y are not NaN, x otherwise
 ordered_min(x,y)   = min(x,y) iff x and y are not NaN, y otherwise
 unordered_min(x,y) = min(x,y) iff x and y are not NaN, x otherwise

This matches the behavior of the underlying select(fcmp(olt/ult/.., L, R), L, R)
construct.

Any code using this predicate has to preserve this semantics.

A follow-up patch will use this to implement floating point min/max reductions
in the vectorizer.

radar://13723044

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181143 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-05 01:54:46 +00:00
Filip Pizlo
0e1327e4aa This exposes more MCJIT options via the C API:
CodeModel: It's now possible to create an MCJIT instance with any CodeModel you like.  Previously it was only possible to 
create an MCJIT that used CodeModel::JITDefault.

EnableFastISel: It's now possible to turn on the fast instruction selector.

The CodeModel option required some trickery.  The problem is that previously, we were ensuring future binary compatibility in 
the MCJITCompilerOptions by mandating that the user bzero's the options struct and passes the sizeof() that he saw; the 
bindings then bzero the remaining bits.  This works great but assumes that the bitwise zero equivalent of any field is a 
sensible default value.

But this is not the case for LLVMCodeModel, or its internal equivalent, llvm::CodeModel::Model.  In both of those, the default 
for a JIT is CodeModel::JITDefault (or LLVMCodeModelJITDefault), which is not bitwise zero.

Hence this change introduces LLVMInitializeMCJITCompilerOptions(), which will initialize the user's options struct with
defaults. The user will use this in the same way that they would have previously used memset() or bzero(). MCJITCAPITest.cpp
illustrates the change, as does the comment in ExecutionEngine.h.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180893 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-01 22:58:00 +00:00
Filip Pizlo
a4fa74e381 Wrap some lines to bring MCJITCAPITest into conformance with the 80 column limit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180839 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-01 06:46:59 +00:00
Reid Kleckner
2a83943855 Try to fix ProgramTest on FreeBSD
This seemed like the cleanest way to find the test executable.  Also fix
the file mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180770 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30 04:30:41 +00:00
Andrew Kaylor
d2755af8bd Exposing MCJIT through C API
Re-submitting with fix for OCaml dependency problems (removing dependency on SectionMemoryManager when it isn't used).

Patch by Fili Pizlo



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180720 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29 17:49:40 +00:00
Andrew Kaylor
1c489455ea Re-enabling MCJIT object caching with memory leak fixed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180575 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25 21:02:36 +00:00
Rafael Espindola
06fd5bf4ea Revert "Adding object caching support to MCJIT"
This reverts commit 07f0392313.

Looks like it broke the valgrind bot:

http://lab.llvm.org:8011/builders/llvm-x86_64-linux-vg_leak/builds/649

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180249 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25 03:47:41 +00:00
Rafael Espindola
7467e5ed1c Revert "Exposing MCJIT through C API"
This reverts commit 8c31b29814.

It looks like this commit broke some bots:

http://lab.llvm.org:8011/builders/llvm-ppc64-linux2/builds/5209

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180248 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25 03:19:12 +00:00
Andrew Kaylor
8c31b29814 Exposing MCJIT through C API
Patch by Filip Pizlo



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180229 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24 23:33:53 +00:00
Reid Kleckner
268adf2a03 Don't forward declare environ on Windows
That seems to interact poorly with the environ and _environ macros
defined in MSVC's <stdlib.h>.

Also remove the incorrect comment about _NSGetEnviron().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180200 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24 17:50:30 +00:00
Andrew Kaylor
26b222e19e Fixing cmake build for MCJIT unit tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180150 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 21:46:56 +00:00
Andrew Kaylor
07f0392313 Adding object caching support to MCJIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180146 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 21:26:38 +00:00
Reid Kleckner
8eca677afe Un-revert the environ copy in ProgramTest after fixing it on OS X
This was r180041 and r180046, which was reverted in r180066.
Re-committing this should fix the dragonegg bootstrap, which I presume
needs LD_LIBRARY_PATH to be propagated to the child.

Tested on Linux, Windows, and Mac OS 10.6.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180099 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 13:15:51 +00:00
Alexey Samsonov
a0bd5df086 Add more guards around zlib-dependent code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180084 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 08:57:30 +00:00
Alexey Samsonov
ee03c949b8 Add basic zlib support to LLVM. This would allow to use compression/uncompression in selected LLVM tools.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180083 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 08:28:39 +00:00
Michael Gottesman
2c8dc64357 Revert "Add a missing reference on a std::vector<> out param"
Revert "[Support] Propagate the environment into the test child process"

This reverts commit r180046.
This reverts commit r180041.

These have broken buildbots for ~3 hours:

http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/763

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180066 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 22:51:55 +00:00
Reid Kleckner
0af5493701 Add a missing reference on a std::vector<> out param
Pointed out by Eli.  The test passes for me either way, so I missed
this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180046 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 20:58:09 +00:00
Reid Kleckner
6641fa7c6c [Support] Propagate the environment into the test child process
Should fix the dragonegg bootstrap builder, which reasonably needs
LD_LIBRARY_PATH to be set.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180041 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 20:23:41 +00:00
Reid Kleckner
0b675d8830 [Support] Fix argv string escape bug on Windows
Summary:
This is http://llvm.org/PR15802.  Backslashes preceding double quotes in
arguments must be escaped.  The interesting bit is that all other
backslashes should *not* be escaped, because the un-escaping logic is
only triggered by the presence of a double quote character.

Reviewers: Bigcheese

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D705

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180035 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 19:03:55 +00:00
Alexey Samsonov
cd61455798 Create a stub for DWARF parser unittests
Moves one DWARF-specific header to include/llvm/DebugInfo from lib/.
Add a short unittest for r179095.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179678 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-17 08:29:02 +00:00
Benjamin Kramer
71c1b22855 Fix a disconcerting bug in Value::isUsedInBasicBlock, which gave wrong answers for blocks larger than 3 instrs.
Also add a unit test. PR15727.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179370 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-12 08:33:11 +00:00
Joey Gouly
bb5cbd86a4 Delete the functions F1 and F2 to appease the valgrind bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179239 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-10 23:21:26 +00:00
Joey Gouly
0f57a98a65 Change CloneFunctionInto to always clone Argument attributes induvidually,
rather than checking if the source and destination have the same number of
arguments and copying the attributes over directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179169 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-10 10:37:38 +00:00
Michael J. Spencer
c0a74e28cf [Support][FileSystem] Fix identify_magic for big endian ELF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178905 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05 20:10:04 +00:00
Jyotsna Verma
332edeb1dc Enable JIT/MCJIT unit tests for targets with JIT support.
Change unittests/ExecutionEngine/Makefile to include Makefile.config before
TARGET_HAS_JIT flag is checked.

Fixes bug: http://llvm.org/bugs/show_bug.cgi?id=15669



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178871 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05 14:26:16 +00:00
Rafael Espindola
b8bfb62e85 Explicitly add -Wl,--export-all-symbols on mingw/cygwin.
Looks like cmake on windows is not expanding ENABLE_EXPORTS to
-Wl,--export-all-symbols on mingw or cygwin, so add this back.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-04 01:19:55 +00:00
Rafael Espindola
436633e2a2 Don't export symbols in every binary on linux.
On freebsd this makes sure that symbols are exported on the binaries that need
them. The net result is that we should get symbols in the binaries that need
them on every platform.

On linux x86-64 this reduces the size of the bin directory from 262MB to 250MB.

Patch by Stephen Checkoway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178725 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-04 01:01:32 +00:00
Jean-Luc Duprat
e1e9366281 SmallVector and SmallPtrSet allocations now power-of-two aligned.
This time tested on both OSX and Linux.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178377 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 22:07:12 +00:00
Rafael Espindola
ef484a376c Revert "Fix allocations of SmallVector and SmallPtrSet so they are more prone to"
This reverts commit 617330909f.

It broke the bots:

/home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:150: PushPopTest
/home/clangbuild2/clang-ppc64-2/llvm.src/unittests/ADT/SmallVectorTest.cpp:118: Failure
Value of: v[i].getValue()
  Actual: 0
Expected: value
Which is: 2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178334 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 07:11:21 +00:00
Jean-Luc Duprat
617330909f Fix allocations of SmallVector and SmallPtrSet so they are more prone to
being power-of-two sized.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178332 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 05:45:22 +00:00
Jyotsna Verma
9f41d22467 Disable JIT/MCJIT tests in unittests/ExecutionEngine for the targets that don't support JIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178221 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 03:38:29 +00:00
Evgeniy Stepanov
d6d0ebbed7 Disable Initialize.MultipleThreads test under MemorySanitizer.
Fails due to insufficient thread stack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178135 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-27 12:50:49 +00:00
Aaron Ballman
551152f7d8 Test case for graceful handling of long file names on Windows. Patch thanks to Paul Robinson!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177223 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-16 15:00:51 +00:00
Michael J. Spencer
d483d2813c [Support][Test] Missed this in the API change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176996 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 00:33:37 +00:00
Michael J. Spencer
9b4886ee55 [Support][ErrorOr] Add support for implicit conversion from error code/condition enums.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176228 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 01:44:26 +00:00
David Blaikie
485740205b Only include move-related Optional<T> tests when rvalue references are available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 07:58:45 +00:00
David Blaikie
ea72255f5b Add move ctor/assignment to Optional<T>
Code review feedback for r175580 by Jordan Rose.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175729 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 07:55:39 +00:00
Benjamin Kramer
ad4da0fc32 Move the SplatByte helper to APInt and generalize it a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175621 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 13:00:06 +00:00
David Blaikie
4318fc5e1e Rename llvm::Optional<T>::Reset to 'reset' as per LLVM naming conventions.
Code review feedback on r175580 from Jordan Rose.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175595 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 06:25:36 +00:00
David Blaikie
a28eda7e40 Allow llvm::Optional to work with types without default constructors.
This generalizes Optional to require less from the T type by using aligned
storage for backing & placement new/deleting the T into it when necessary.

Also includes unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175580 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 00:26:04 +00:00
Douglas Gregor
1f1713ff7a Remove my bogus MapVector::erase() with a narrower ::pop_back(), and add a unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175538 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19 18:26:07 +00:00
Meador Inge
35b1423ee6 ADT: Correct APInt::getActiveWords for zero values
PR15138 was opened because of a segfault in the Bitcode writer.
The actual issue ended up being a bug in APInt where calls to
APInt::getActiveWords returns a bogus value when the APInt value
is 0.  This patch fixes the problem by ensuring that getActiveWords
returns 1 for 0 valued APInts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174641 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 18:36:50 +00:00
Michael J. Spencer
780e9004c8 [Support][ErrorOr] Add support for convertable types.
Thanks to Andrew, David, and Aaron for helping fix this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174552 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 22:28:53 +00:00
Andrew Trick
2a78bb961a Revert "[Support][ErrorOr] Add support for convertable types."
This reverts commit a33e1fafac.

This unit test crashes on Darwon. It needs to be temporarily reverted
to unblock the test infrastructure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174458 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 22:50:20 +00:00
Michael J. Spencer
a33e1fafac [Support][ErrorOr] Add support for convertable types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174357 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 08:22:27 +00:00
Dan Gohman
a070d2a035 Change GetPointerBaseWithConstantOffset's DataLayout argument from a
reference to a pointer, so that it can handle the case where DataLayout
is not available and behave conservatively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174024 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 02:00:45 +00:00
Michael Gottesman
69f60e7c4a Added a unit test for r173983 that verifies that Target.isiOS() works correctly.
As a bonus I put in some extra checks to make sure that we are identifying the
machine word of various Mac OS X/iOS targets appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173994 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30 23:48:13 +00:00
Andrew Kaylor
710cb0c782 Add support for source and line information to IntelJITEventListener for object emitted by MCJIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173712 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28 19:52:37 +00:00
Bill Wendling
c83f6212a7 Fix test to not use the AttributeSet's AttributeWithIndex creation method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173608 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27 03:39:10 +00:00
Dmitri Gribenko
c73b7f7022 Add file to CMakeLists (file added in r173505)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173513 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 22:29:23 +00:00
Nick Lewycky
6bbf4ff9c5 Add an insert() method to MapVector. Adds the first MapVector unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173505 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 22:11:02 +00:00
Benjamin Kramer
bd7561ea29 APFloat: Make sure that we get a well-formed x87 NaN when converting from a smaller type.
Fixes PR15054.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173459 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25 17:01:00 +00:00
NAKAMURA Takumi
41d35a335e unittests/SupportTests/Initialize.MultipleThreads: Enable pthread_attr_setstack(3) only on Linux.
I got blamed on darwin11;
unittests/Support/ManagedStatic.cpp:35: error: 'pthread_attr_setstack' was not declared in this scope

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173355 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24 15:29:27 +00:00
NAKAMURA Takumi
91e22b0dd3 unittests/SupportTests/Initialize.MultipleThreads: Appease --vg-leak to allocate stack explicitly for glibc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173350 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24 14:44:02 +00:00
NAKAMURA Takumi
023d97d703 llvm/unittests: Use OwningPtr to fix --vg-leak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173240 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 08:33:13 +00:00
NAKAMURA Takumi
d422e9f114 IRTests/WaymarkTest.cpp: Fix in --vg-leak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173239 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 08:33:05 +00:00
NAKAMURA Takumi
e82a5fae03 IRTests/IRBuilderTest.cpp: GetIntTy: Delete DL at yourself since it is not linked.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173238 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 08:31:28 +00:00
NAKAMURA Takumi
f25b003523 IRTests/IRBuilderTest.cpp: Let GV added to the module.
It fixes --vg-leak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173237 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 08:30:39 +00:00
NAKAMURA Takumi
6bf3e46aa8 IRTests/ConstantsTest.cpp: AsInstructionsTest: Delete each instruction immediately if it is not linked.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173236 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 08:30:26 +00:00
NAKAMURA Takumi
bde0f0f225 Untabify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173235 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 08:30:21 +00:00
NAKAMURA Takumi
3fe36d0fdd Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173234 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 08:30:15 +00:00
NAKAMURA Takumi
1a5812d7da DominatorTreeTest.cpp: Add the file header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173233 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 08:30:10 +00:00
Michael J. Spencer
bdd4e13118 [Support][ErrorOr] Add optimized specialization of ErrorOr<void>.
ErrorOr<void> represents an operation that returns nothing, but can still fail.
It should be used in cases where you need the aditional user data that ErrorOr
provides over error_code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173209 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 00:18:31 +00:00
NAKAMURA Takumi
421db34270 ADT/SparseMultiSetTest.cpp: Try to appease cygwin-clang on stage2, take two. [-Wsign-compare]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173144 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 10:39:31 +00:00
NAKAMURA Takumi
19f24454b5 ADT/SparseMultiSetTest.cpp: Try to appease cygwin-clang (libstdc++-4.5) on stage2. [-Wsign-compare]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173127 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 05:30:15 +00:00
NAKAMURA Takumi
93d61374f3 ErrorOrTest.cpp: Check existence of EXPECT_DEBUG_DEATH. It is not always available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173123 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 04:02:41 +00:00
Michael Ilseman
afe77f33b2 Introduce a new data structure, the SparseMultiSet, and changes to the MI scheduler to use it.
A SparseMultiSet adds multiset behavior to SparseSet, while retaining SparseSet's desirable properties. Essentially, SparseMultiSet provides multiset behavior by storing its dense data in doubly linked lists that are inlined into the dense vector. This allows it to provide good data locality as well as vector-like constant-time clear() and fast constant time find(), insert(), and erase(). It also allows SparseMultiSet to have a builtin recycler rather than keeping SparseSet's behavior of always swapping upon removal, which allows it to preserve more iterators. It's often a better alternative to a SparseSet of a growable container or vector-of-vector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173064 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 18:18:53 +00:00
Michael J. Spencer
7babd25ae4 [Support] Make test C++03.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173004 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 05:39:07 +00:00
Benjamin Kramer
c052d5b047 Disable test that fails due to lack of std::true_type in C++03.
Michael, can this test be ported to C++03?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172996 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 21:52:27 +00:00
Michael J. Spencer
01812bebcc [Support] Port ErrorOr<T> from lld to C++03.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172991 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 20:32:30 +00:00
Peter Collingbourne
fbb662f840 Introduce llvm::sys::getProcessTriple() function.
In r143502, we renamed getHostTriple() to getDefaultTargetTriple()
as part of work to allow the user to supply a different default
target triple at configure time.  This change also affected the JIT.
However, it is inappropriate to use the default target triple in the
JIT in most circumstances because this will not necessarily match
the current architecture used by the process, leading to illegal
instruction and other such errors at run time.

Introduce the getProcessTriple() function for use in the JIT and
its clients, and cause the JIT to use it.  On architectures with a
single bitness, the host and process triples are identical.  On other
architectures, the host triple represents the architecture of the
host CPU, while the process triple represents the architecture used
by the host CPU to interpret machine code within the current process.
For example, when executing 32-bit code on a 64-bit Linux machine,
the host triple may be 'x86_64-unknown-linux-gnu', while the process
triple may be 'i386-unknown-linux-gnu'.

This fixes JIT for the 32-on-64-bit (and vice versa) build on non-Apple
platforms.

Differential Revision: http://llvm-reviews.chandlerc.com/D254

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172627 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 17:27:22 +00:00
Evgeniy Stepanov
655578f8b5 Allow vectors in CreatePointerCast of constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172615 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 14:41:46 +00:00
Evgeniy Stepanov
4802b9d6dc A test for r172535.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172614 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 14:38:50 +00:00
Dmitri Gribenko
31659fa066 Improve r172464: const_cast is not needed if the variable is not const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172474 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 21:23:37 +00:00
David Greene
c8be88ab56 Fix Casts
Use const_cast<> to avoid cast-away-const errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172464 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 21:04:35 +00:00
Benjamin Kramer
8591fa38e6 Add a unit test to verifies that attribute uniquing works so it doesn't break again.
The folding set details can be subtle and broke twice in the last couple of weeks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172313 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12 14:13:45 +00:00
Eli Bendersky
dced3cdb04 Fix bug in exception table allocation (PR13678)
Patch by Michael Muller.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172214 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11 16:33:30 +00:00
Dmitri Gribenko
f6b6c37ca2 Replace memcpys by a static_cast and an integral promotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172108 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10 21:21:32 +00:00
Dmitri Gribenko
197616adda Fix coding style
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172107 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10 21:10:44 +00:00
Jakub Staszak
ff5ed5e2b4 Unbreak tests after regression from r172081.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172105 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10 21:02:05 +00:00
David Greene
5e1b31bf55 Fix Alias Bug
Use memcpy to do type punning instead of a cast.  A cast or similar
operation through a union breaks strict aliasing rules.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-10 18:17:54 +00:00
Shuxin Yang
7aa1c321f0 Implement APFloat::isDenormal()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171764 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 18:59:35 +00:00
Chandler Carruth
c779e96158 Rename the VMCore unittest tree to IR. Somehow was missed when doing the
library rename.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171747 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 15:35:46 +00:00
Chandler Carruth
3251e81d79 Move CallGraphSCCPass.h into the Analysis tree; that's where the
implementation lives already.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171746 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-07 15:26:48 +00:00
Chandler Carruth
61e7ff907a Rename the unittest from ArrayRecylerTest.cpp to ArrayRecyclerTest.cpp.
Fixes the CMake build. It took me cutting and pasting this before
I managed to see the missing character. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171589 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 02:08:43 +00:00
Jakob Stoklund Olesen
8a0631a35e Add an ArrayRecycler class.
This is similar to the existing Recycler allocator, but instead of
recycling individual objects from a BumpPtrAllocator, arrays of
different sizes can be allocated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171581 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 00:57:11 +00:00
Chandler Carruth
73c35d86b9 Add time getters to the process interface for requesting the elapsed
wall time, user time, and system time since a process started.

For walltime, we currently use TimeValue's interface and a global
initializer to compute a close approximation of total process runtime.

For user time, this adds support for an somewhat more precise timing
mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock
selected.

For system time, we have to do a full getrusage call to extract the
system time from the OS. This is expensive but unavoidable.

In passing, clean up the implementation of the old APIs and fix some
latent bugs in the Windows code. This might have manifested on Windows
ARM systems or other systems with strange 64-bit integer behavior.

The old API for this both user time and system time simultaneously from
a single getrusage call. While this results in fewer system calls, it
also results in a lower precision user time and if only user time is
desired, it introduces a higher overhead. It may be worthwhile to switch
some of the pass timers to not track system time and directly track user
and wall time. The old API also tracked walltime in a confusing way --
it just set it to the current walltime rather than providing any measure
of wall time since the process started the way buth user and system time
are tracked. The new API is more consistent here.

The plan is to eventually implement these methods for a *child* process
by using the wait3(2) system call to populate an rusage struct
representing the whole subprocess execution. That way, after waiting on
a child process its stats will become accurate and cheap to query.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171551 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 23:19:55 +00:00
Jakob Stoklund Olesen
7c5c12bd4d Add an iplist::clearAndLeakNodesUnsafely() function.
The iplist::clear() function can be quite expensive because it traverses
the entire list, calling deleteNode() and removeNodeFromList() on each
element. If node destruction and deallocation can be handled some other
way, clearAndLeakNodesUnsafely() can be used to jettison all nodes
without bringing them into cache.

The function name is meant to be ominous.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171540 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 22:35:42 +00:00
Nick Kledzik
50c3042740 Fix how YAML I/O detects flow sequences.
Update test case to verify flow sequence is
written as a flow sequence.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 19:32:00 +00:00
Michael J. Spencer
c8b18df9a7 [Support][Endian] Add support for specifying the alignment and native unaligned types.
* Add support for specifying the alignment to use.
* Add the concept of native endianness. Used for unaligned native types.

The native alignment and read/write simplification is based on a patch by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171406 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 20:14:11 +00:00
Chandler Carruth
0b8c9a80f2 Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 11:36:10 +00:00
Chandler Carruth
7f00f87767 Sort a few more #include lines in tools/... unittests/... and utils/...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171363 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 10:26:28 +00:00
Chandler Carruth
f5867ab717 Go ahead and get rid of the old page size interface and convert all the
users over to the new one. No sense maintaining this "compatibility"
layer it seems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171331 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 23:31:56 +00:00
Chandler Carruth
814afe91cc Flesh out a page size accessor in the new API.
Implement the old API in terms of the new one. This simplifies the
implementation on Windows which can now re-use the self_process's once
initialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171330 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 23:23:35 +00:00
Michael J. Spencer
3c6f89aa2e [AlignOf] Add AlignedCharArray and refactor AlignedCharArrayUnion.
This adds AlignedCharArray<Alignment, Size>. A templated struct that contains
a member named buffer of type char[Size] that is aligned to Alignment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171319 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 19:54:45 +00:00
Chandler Carruth
0184a841d3 Begin sketching out the process interface.
The coding style used here is not LLVM's style because this is modeled
after a Boost interface and thus done in the style of a candidate C++
standard library interface. I'll probably end up proposing it as
a standard C++ library if it proves to be reasonably portable and
useful.

This is just the most basic parts of the interface -- getting the
process ID out of it. However, it helps sketch out some of the boiler
plate such as the base class, derived class, shared code, and static
factory function. It also introduces a unittest so that I can
incrementally ensure this stuff works.

However, I've not even compiled this code for Windows yet. I'll try to
fix any Windows fallout from the bots, and if I can't fix it I'll revert
and get someone on Windows to help out. There isn't a lot more that is
mandatory, so soon I'll switch to just stubbing out the Windows side and
get Michael Spencer to help with implementation as he can test it
directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 11:17:50 +00:00
Duncan Sands
6e591ea0b9 Test that a landingpad gets the name provided when it was created (see commit
170318).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-21 12:03:03 +00:00
Jakob Stoklund Olesen
7f1d6d688f Add an assertion for a likely ilist::splice() contract violation.
The single-element ilist::splice() function supports a noop move:

  List.splice(I, List, I);

The corresponding std::list function doesn't allow that, so add a unit
test to document that behavior.

This also means that

  List.splice(I, List, F);

is somewhat surprisingly not equivalent to

  List.splice(I, List, F, next(F));

This patch adds an assertion to catch the illegal case I == F above.
Alternatively, we could make I == F a legal noop, but that would make
ilist differ even more from std::list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170443 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 19:28:37 +00:00
Nick Kledzik
82612a6d73 Fix some integer constant warnings by using a suffix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170376 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-17 22:11:17 +00:00
Nick Kledzik
c83b8fec01 re-enable test cases now that traits work with g++. Fix some g++ warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170369 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-17 20:43:53 +00:00
Nick Kledzik
3cf080df36 Temporarily disable test cases until they compile with g++ too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170035 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-12 22:39:45 +00:00
David Blaikie
f2150b6857 Unbreak the build. Fallout from r170019.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170033 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-12 22:14:32 +00:00
Nick Kledzik
8ceb8b764f Initial implementation of a utility for converting native data
structures to and from YAML using traits.  The first client will
be the test suite of lld.  The documentation will show up at:

   http://llvm.org/docs/YamlIO.html




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170019 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-12 20:46:15 +00:00
Michael Ilseman
1638b83909 Reorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-09 21:12:04 +00:00
Bill Wendling
99faa3b4ec s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169651 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-07 23:16:57 +00:00
Akira Hatanaka
c4c14a7b4a Do not run tests MappedMemoryTest.BasicWrite and MultipleWrite unless both
MF_READ and MF_WRITE are set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169439 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 22:43:07 +00:00
Michael J. Spencer
96a564f2be Copy clang/Driver/<Option parsing stuff> to llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169344 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 00:29:32 +00:00
Chandler Carruth
5a88dda4be Sort the #include lines for unittest/...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169250 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 10:23:08 +00:00
NAKAMURA Takumi
4cd0a82fbf VMCoreTests/PassManagerTest.cpp: Appease msvc not to do "using llvm::Pass" in class template.
FIXME: I have not checked whether to be compiled on msvc11.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169225 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 07:25:24 +00:00
Matt Beaumont-Gay
ee72115670 Add 'using' declarations to suppress -Woverloaded-virtual warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169214 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 05:41:27 +00:00
Michael J. Spencer
6bc86018d1 [Support] Make FileOutputBuffer work on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169167 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 22:09:52 +00:00
Chandler Carruth
4334dd96a9 Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES.
Rationale:
1) This was the name in the comment block. ;]
2) It matches Clang's __has_feature naming convention.
3) It matches other compiler-feature-test conventions.

Sorry for the noise. =]

I've also switch the comment block to use a \brief tag and not duplicate
the name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168996 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 11:45:22 +00:00
Michael Ilseman
4b896dd613 copyFastMathFlags utility and test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168943 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 21:25:12 +00:00
Michael Ilseman
3d15a91777 Whoops, fixed bad merge
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168816 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 21:21:18 +00:00
Michael Ilseman
9eec659952 Fixed bad test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168815 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 21:19:52 +00:00
Michael Ilseman
f564e9ff2d Fast-math: IRBuilder test for creating instructions with fast-math flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168814 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 21:17:34 +00:00
Eli Bendersky
6b731486d4 Add backreference matching capabilities to Support/Regex, with
appropriate unit tests. This change in itself is not expected to
affect any functionality at this point, but it will serve as a
stepping stone to improve FileCheck's variable matching capabilities.

Luckily, our regex implementation already supports backreferences,
although a bit of hacking is required to enable it. It supports both
Basic Regular Expressions (BREs) and Extended Regular Expressions
(EREs), without supporting backrefs for EREs, following POSIX strictly
in this respect. And EREs is what we actually use (rightly). This is
contrary to many implementations (including the default on Linux) of
POSIX regexes, that do allow backrefs in EREs.

Adding backref support to our EREs is a very simple change in the
regcomp parsing code. I fail to think of significant cases where it
would clash with existing things, and can bring more versatility to
the regexes we write. There's always the danger of a backref in a
specially crafted regex causing exponential matching times, but since
we mainly use them for testing purposes I don't think it's a big
problem. [it can also be placed behind a flag specific to FileCheck,
if needed].

For more details, see:

* http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-November/055840.html
* http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121126/156878.html



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168802 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 19:00:02 +00:00
Andrew Kaylor
927ba6a0b3 Moving SectionMemoryManager into RuntimeDyld and adding unit tests for it.
The SectionMemoryManager now supports (and requires) applying section-specific page permissions.  Clients using this memory manager must call either MCJIT::finalizeObject() or SectionMemoryManager::applyPermissions() before executing JITed code.

See r168718 for changes from the previous implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168721 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 19:42:02 +00:00
Andrew Kaylor
cc7773bdcb Implementing page permission setting in MCJIT unit test SectionMemoryManager.cpp
This commit is primarily here for the revision history.  I'm about to move the SectionMemoryManager into the RuntimeDyld library, but I wanted to check the changes in here so people could see the differences in the updated implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168718 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 19:00:17 +00:00
Sean Silva
525398e137 Allow using MemoryBuffers with yaml::Stream directly.
The rationale is to get YAML filenames in diagnostics from
yaml::Stream::printError -- currently the filename is hard-coded as
"YAML" because there's no buffer information available.

Patch by Kim Gräsman!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168341 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19 23:21:47 +00:00
James Molloy
b9478c2aef Add a new function to ConstantExpr - getAsInstruction. This returns its Instruction* corollary, which may be useful if a user
wishes to transform a ConstantExpr so that one of its operands is no longer constant.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168262 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 17:56:30 +00:00
Joe Abbey
0f5720f85b Removing utf-8 smart quote and trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168253 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 05:13:16 +00:00
Joe Abbey
e68d743753 Suppressing the 'direct base ‘{anonymous}::S1’ inaccessible in ‘{anonymous}::D9’
due to ambiguity' warning.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168251 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-17 04:54:22 +00:00
Andrew Kaylor
53608a34ce Interface changes to allow RuntimeDyld memory managers to set memory permissions after an object has been loaded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168114 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 23:50:01 +00:00
Jakub Staszak
de7c8530c8 Remove DOS line endings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167968 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14 20:18:34 +00:00
Gabor Greif
d54393153a do not play preprocessor tricks with 'private', use public interfaces instead; this appeases the VC++ buildbots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167724 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 13:34:59 +00:00
Gabor Greif
9a5f90a170 add unit test for waymarking algorithm (Use::getUser)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167720 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 10:01:17 +00:00
Benjamin Kramer
23280ffb90 Provide definitions for all functions.
ICC refuses to compile a class in an anonymous namespace if some functions
aren't defined. Fixes PR13477.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167676 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-10 16:10:16 +00:00
Benjamin Kramer
6b370e615c Drop the limitation to IEEE floating point types from the fdiv of pow2 -> fmul transform.
This is safe for x87 long doubles and ppc double doubles too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-08 13:58:10 +00:00
Amara Emerson
b586aae15e MCJIT unit test: add calls to ensure that instruction caches are properly invalidated before code execution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167146 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-31 17:44:16 +00:00
Amara Emerson
a25ad19a23 Port lli bug fix from r166920 to MCJIT unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167145 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-31 17:41:51 +00:00
Amara Emerson
9f74bc9e77 Commit access test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167144 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-31 17:35:12 +00:00
Ulrich Weigand
f772f07802 Disable all old-JIT unit tests on PowerPC.
These tests were all failing since the old JIT doesn't work
for PowerPC (any more), and there are no plans to attempt to
fix it again (instead, work focuses on MCJIT).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167133 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-31 16:18:02 +00:00
Evgeniy Stepanov
0ceb855d52 Add IRBuilderBase::getIntPtrTy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167111 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-31 09:50:01 +00:00
Duncan Sands
446cf94cdb Fix isEliminableCastPair to work correctly in the presence of pointers
with different sizes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167018 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 16:03:32 +00:00
Ulrich Weigand
69c9c8c4cf Implement arithmetic on APFloat with PPCDoubleDouble semantics by
treating it as if it were an IEEE floating-point type with 106-bit
mantissa.

This makes compile-time arithmetic on "long double" for PowerPC
in clang (in particular parsing of floating point constants)
work, and fixes all "long double" related failures in the test
suite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166951 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-29 18:09:01 +00:00
Pete Cooper
fbaf206f47 Fixed bug in SmallDenseMap where it wouldn't leave enough space for an empty bucket if the number of values was exactly equal to the small capacity. This led to an infinite loop when finding a non-existent element
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-23 18:47:35 +00:00
Bob Wilson
974b190717 Use an export list when building JIT unittests. <rdar://problem/12473675>
When building with LTO, the internalize pass is hiding some global symbols
that are necessary for the JIT unittests. It seems like that may be a bug in
LTO to do that by default, but until that gets fixed, this change makes sure
that we export the necessary symbols for the tests to pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166220 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 20:25:36 +00:00
Bill Wendling
80668fbc09 Marked this variable as 'used' so that LTO doesn't get rid of it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166092 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 08:08:06 +00:00