Commit Graph

196433 Commits

Author SHA1 Message Date
Shankar Easwaran 729a79a1c4 [ELF] Simplify appending chunks to segments.
The Segment Chunk had two functions one to append a section and one to append a
chunk. A section is a subclass of a chunk and clearly this can be merged into
one single function.

llvm-svn: 232249
2015-03-14 05:26:50 +00:00
Chandler Carruth 0d745bcf66 [modules] Teach the AST reader to handle the case of importing a module
with a subset of the existing target CPU features or mismatched CPU
names.

While we can't check that the CPU name used to build the module will end
up being able to codegen correctly for the translation unit, we actually
check that the imported features are a subset of the existing features.

While here, rewrite the code to use std::set_difference and have it
diagnose all of the differences found.

Test case added which walks the set relationships and ensures we
diagnose all the right cases and accept the others.

No functional change for implicit modules here, just better diagnostics.

llvm-svn: 232248
2015-03-14 04:47:43 +00:00
Zachary Turner 2c04f79b01 [gtest] Fix gtest failures on Windows.
On Windows, you need to call WSAStartup() before making any socket
calls, and WSACleanup() before you shutdown.  This wasn't being
done, so all of the socket tests were failing.  This fixes
that, which brings the unit test suite to a fully working state
on Windows.

llvm-svn: 232247
2015-03-14 04:19:32 +00:00
Frederic Riss 563b1b057a [dsymutil] Generate debug_aranges section.
This actually shares most of its implementation with the  generation
of the debug_ranges (the absence of 'a' is not a typo) contribution
for the unit's DW_AT_ranges attribute.

llvm-svn: 232246
2015-03-14 03:46:51 +00:00
Frederic Riss 3cced05a44 [dsymutil] Identify each CompileUnit with a unique ID.
The ID can eg. de used in MCSymbol names to differentiate the ones
that need to be created for every unit.
The ID is a constructor parameter and not a static class member so
there is no issue with counter updates if we decide to thread that
code.

llvm-svn: 232245
2015-03-14 03:46:40 +00:00
Zachary Turner f4a501a5f3 [CMake] Convert TABs to spaces.
This file had been using TAB all along, but my recent change that
used spaces exposed the issue.

llvm-svn: 232244
2015-03-14 03:10:51 +00:00
Ed Maste ea627d728b Skip additional lldb-mi tests that failed on FreeBSD
llvm-svn: 232243
2015-03-14 02:54:57 +00:00
Peter Collingbourne 678e78ca95 CFI: Add test for bad cast checks.
llvm-svn: 232242
2015-03-14 02:42:39 +00:00
Peter Collingbourne d2926c91d5 Implement bad cast checks using control flow integrity information.
This scheme checks that pointer and lvalue casts are made to an object of
the correct dynamic type; that is, the dynamic type of the object must be
a derived class of the pointee type of the cast. The checks are currently
only introduced where the class being casted to is a polymorphic class.

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

llvm-svn: 232241
2015-03-14 02:42:25 +00:00
David Blaikie 741c8f81e4 [opaque pointer type] Start migrating GEP creation to explicitly specify the pointee type
I'm just going to migrate these in a pretty ad-hoc & incremental way -
providing the backwards compatible API for now, then locally removing
it, fixing a few callers, adding it back in and commiting those callers.
Rinse, repeat.

The assertions should ensure that if I get this wrong we'll find out
about it and not just have one giant patch to revert, recommit, revert,
recommit, etc.

llvm-svn: 232240
2015-03-14 01:53:18 +00:00
Ahmed Bougacha 082c5c707a Add a bunch of CHECK missing colons in tests. NFC.
Some wouldn't pass;  fixed most, the rest will be fixed separately.

llvm-svn: 232239
2015-03-14 01:43:57 +00:00
Peter Collingbourne ca1c7793b1 CFI: Add a test for distinguishing between non-overriding siblings.
llvm-svn: 232238
2015-03-14 01:35:33 +00:00
Ahmed Bougacha 5a4aa42a59 Add a bunch of missing "CHECK" colons in tests. NFC.
llvm-svn: 232237
2015-03-14 01:10:19 +00:00
Benjamin Kramer bd5ee505c9 CommandLine: Replace cold std::sort with array_pod_sort.
Also replace an old use of qsort with it. Compiles down to the same thing but
gives us some type safety. Safes a couple of kb on CommandLine.o.

NFC.

llvm-svn: 232236
2015-03-14 00:20:13 +00:00
Peter Collingbourne c9f277f754 LowerBitSets: Do not export symbols for bit set referenced globals on Darwin.
The linker on that platform may re-order symbols or strip dead symbols, which
will break bit set checks. Avoid this by hiding the symbols from the linker.

llvm-svn: 232235
2015-03-14 00:00:49 +00:00
Frederic Riss 5c9c706ab2 [dsymutil] Fix typo in comment.
Next time, when I fix a typo, I'll take the time to reread the whole
comment instead of waiting for the commit email to realize that there
is another one two words later...

llvm-svn: 232234
2015-03-13 23:55:29 +00:00
Frederic Riss c2607ef392 [dsymutil] Fix typo in doxygen comment.
llvm-svn: 232233
2015-03-13 23:51:06 +00:00
Frederic Riss 25440876b0 [dsymutil] Implement DW_AT_ranges linking.
Nothing fancy, just a straightforward offset to apply to the original
debug_ranges entries to get them in line with the linked addresses.

llvm-svn: 232232
2015-03-13 23:30:31 +00:00
Frederic Riss 9552948aef [dsymutil] Move a function declaration closer to its peers.
llvm-svn: 232231
2015-03-13 23:30:27 +00:00
Frederic Riss e357d4fd31 DWARFDebugRangeList: make the list of entries available to clients.
For users like llvm-dsymutil that want to have access to the encoded
debug_ranges entries.

llvm-svn: 232230
2015-03-13 23:30:07 +00:00
David Majnemer 37fd66e78b MS ABI: Generate default constructor closures
The MS ABI utilizes a compiler generated function called the "vector
constructor iterator" to construct arrays of objects with
non-trivial constructors/destructors.  For this to work, the constructor
must follow a specific calling convention.  A thunk must be created if
the default constructor has default arguments, is variadic or is
otherwise incompatible.  This thunk is called the default constructor
closure.

N.B.  Default constructor closures are only generated if the default
constructor is exported because clang itself does not utilize vector
constructor iterators.  Failing to export the default constructor
closure will result in link/load failure if a translation unit compiled
with MSVC is on the import side.

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

llvm-svn: 232229
2015-03-13 22:36:55 +00:00
Enrico Granata 9370d2784f If creating a Python command via a class, the help text is handled directly by the class object, no need for setting it manually via the cmdline
llvm-svn: 232228
2015-03-13 22:35:44 +00:00
Vince Harron e72b71ff08 Revert test/Makefile to state before r232205
llvm-svn: 232227
2015-03-13 22:33:42 +00:00
Enrico Granata cc342da574 Add accessors on SBCommand to get and set the help texts for a command
llvm-svn: 232226
2015-03-13 22:32:11 +00:00
Enrico Granata 2fc62ed37d Introduce documentation for Python command objects
llvm-svn: 232225
2015-03-13 22:27:36 +00:00
Enrico Granata 6f79bb2d57 Add support for Python object commands to return custom short and long help by implementing
def get_short_help(self)
def get_long_help(self)

methods on the command object

Also, add a test case for this feature

llvm-svn: 232224
2015-03-13 22:22:28 +00:00
Rafael Espindola e7ce9ec398 Use add32ri8 and friends on fast isel.
This fixes pr22854.

The core issue on the bug is that there are multiple instructions that
print the same in assembly. In fact, there doesn't seem to be any
syntax for specifying that a constant that fits in 8 bits should use a 32 bit
immediate.

The attached patch changes fast isel to consider i16immSExt8,
i32immSExt8, and i64immSExt8. They were disabled because fastisel didn’t know
to call the predicate back in the day.

llvm-svn: 232223
2015-03-13 22:18:18 +00:00
Alexei Starovoitov 58a615f9d0 bpf: turn on HasJIT flag in BPF backend
basic tests that use BPF backend to produce code in memory are passing.

llvm-svn: 232222
2015-03-13 22:03:25 +00:00
Rafael Espindola cba833a09d Be lazy about loading metadata in IRObjectFile.
This speeds up llvm-ar building lib64/libclangSema.a with debug IR files
from 8.658015807 seconds to just 0.351036519 seconds :-)

llvm-svn: 232221
2015-03-13 21:54:20 +00:00
Zachary Turner 794e6a60a8 Fix makefiles to build shared library tests on Windows.
Abstracted away some POSIX-isms that caused MAKE to issue invalid
commands on Windows.  Added a new force-include for the test
programs so that we can use platform-specific macros.

TestSharedLib now builds and cleans up on Windows, though the test
still fails some of the expectations.

Differential Revision: http://reviews.llvm.org/D8277
Patch by: Adrian McCarthy
Issue Tracker: http://llvm.org/pr21727

llvm-svn: 232220
2015-03-13 21:51:11 +00:00
Reid Kleckner a1410321f6 Translate some MSVC CMAKE_*_FLAGS to clang flags in clang_compile
Passing MSVC-style cflags to the gcc-style clang driver will almost
always end badly. Just translate a couple of simple flags used by the
base CMake cflags like /D, /U, and /O.

llvm-svn: 232219
2015-03-13 21:39:29 +00:00
Zachary Turner a6ad7a542b [CMake] Fix unit test build on Linux.
A filename had been misspelled in the CMake.

llvm-svn: 232218
2015-03-13 21:33:34 +00:00
Benjamin Kramer 848c9facc8 BranchFolding: MergePotentialsElt has a total order, just call array_pod_sort.
No functionality change intended.

llvm-svn: 232217
2015-03-13 21:17:02 +00:00
David Blaikie b9263570a5 [opaque pointer type] Bitcode support for explicit type parameter on the gep operator
This happened to be fairly easy to support backwards compatibility based
on the number of operands (old format had an even number, new format has
one more operand so an odd number).

test/Bitcode/old-aliases.ll already appears to test old gep operators
(if I remove the backwards compatibility in the BitcodeReader, this and
another test fail) so I'm not adding extra test coverage here.

llvm-svn: 232216
2015-03-13 21:03:36 +00:00
David Blaikie 4a5c8c602c Turn assertion into bitcode reading error
I don't think we test invalid bitcode records in any detail, so no test
here - just a change for consistency with existing error checks in
surrounding code.

llvm-svn: 232215
2015-03-13 21:03:34 +00:00
David Blaikie 84a2fe141a Simplify expression
llvm-svn: 232214
2015-03-13 21:03:30 +00:00
Zachary Turner 891af04d82 Create a check-lldb-unit target to run unit tests.
llvm-svn: 232212
2015-03-13 20:55:07 +00:00
Zachary Turner 719ec93a74 Rework the gtest directory structure.
This makes the directory structure mirror the canonical LLVM
directory structure for a gtest suite.

Additionally, this patch deletes the xcode project.  Nobody
is currently depending on this, and it would be better to have
gtest unit tests be hand-maintained in the Xcode workspace
rather than using this python test runner.  Patches to that
effect will be submitted as followups.

llvm-svn: 232211
2015-03-13 20:54:57 +00:00
Zachary Turner 26d7fcfc38 Create a CMake build for the gtest unit tests.
llvm-svn: 232210
2015-03-13 20:54:21 +00:00
Robert Lougher 1858ba7626 Reapply "[Reassociate] Add initial support for vector instructions."
This reapplies the patch previously committed at revision 232190.  This was
reverted at revision 232196 as it caused test failures in tests that did not
expect operands to be commuted.  I have made the tests more resilient to
reassociation in revision 232206.

llvm-svn: 232209
2015-03-13 20:53:01 +00:00
Alexei Starovoitov a208faa0a3 bpf: fix build
fix missed bits which were left over after r231987

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
llvm-svn: 232208
2015-03-13 20:49:38 +00:00
Robert Lougher 7607b918a7 Make tests more robust. No functional change.
In preparation for recommit of revision 232190, change tests so that they
are resilient to operands being commuted by the reassociate pass.

llvm-svn: 232206
2015-03-13 20:35:45 +00:00
Vince Harron 8974ce2735 Add support for XFAILing a test on specific clang versions
llvm-svn: 232205
2015-03-13 19:54:54 +00:00
Rui Ueyama 65c1704604 Windows: Include <eh.h> instead of declarating __uncaught_exception.
llvm-svn: 232204
2015-03-13 19:52:39 +00:00
Duncan P. N. Exon Smith be95b4afc6 instcombine: alloca: Canonicalize scalar allocation array size
As a follow-up to r232200, add an `-instcombine` to canonicalize scalar
allocations to `i32 1`.  Since r232200, `iX 1` (for X != 32) are only
created by RAUWs, so this shouldn't fire too often.  Nevertheless, it's
a cheap check and a nice cleanup.

llvm-svn: 232202
2015-03-13 19:42:09 +00:00
Duncan P. N. Exon Smith 07ff9b03f6 instcombine: alloca: Limit array size type promotion
Move type promotion of the size of the array allocation to the end of
`simplifyAllocaArraySize()`.  This avoids promoting the type of the
array size if it's a `ConstantInt`, since the next -instcombine
iteration will drop it to a scalar allocation anyway.  Similarly, this
avoids promoting the type if it's an `UndefValue`, in which case the
alloca gets RAUW'ed.

This is NFC when considered over the lifetime of -instcombine, since
it's just reducing the number of iterations needed to reach fixed point.

llvm-svn: 232201
2015-03-13 19:34:55 +00:00
Duncan P. N. Exon Smith 720762e2c0 AsmWriter: Write alloca array size explicitly (and -instcombine fixup)
Write the `alloca` array size explicitly when it's non-canonical.
Previously, if the array size was `iX 1` (where X is not 32), the type
would mutate to `i32` when round-tripping through assembly.

The testcase I added fails in `verify-uselistorder` (as well as
`FileCheck`), since the use-lists for `i32 1` and `i64 1` change.
(Manman Ren came across this when running `verify-uselistorder` on some
non-trivial, optimized code as part of PR5680.)

The type mutation started with r104911, which allowed array sizes to be
something other than an `i32`.  Starting with r204945, we
"canonicalized" to `i64` on 64-bit platforms -- and then on every
round-trip through assembly, mutated back to `i32`.

I bundled a fixup for `-instcombine` to avoid r204945 on scalar
allocations.  (There wasn't a clean way to sequence this into two
commits, since the assembly change on its own caused testcase churn, and
the `-instcombine` change can't be tested without the assembly changes.)

An obvious alternative fix -- change `AllocaInst::AllocaInst()`,
`AsmWriter` and `LLParser` to treat `intptr_t` as the canonical type for
scalar allocations -- was rejected out of hand, since this required
teaching them each about the data layout.

A follow-up commit will add an `-instcombine` to canonicalize the scalar
allocation array size to `i32 1` rather than leaving `iX 1` alone.

rdar://problem/20075773

llvm-svn: 232200
2015-03-13 19:30:44 +00:00
Duncan P. N. Exon Smith bb730135c9 instcombine: alloca: Remove nesting in simplifyAllocaArraySize(), NFC
llvm-svn: 232199
2015-03-13 19:26:33 +00:00
Manman Ren 4a9b0ebe83 Add a parameter for getLazyBitcodeModule to lazily load Metadata.
We only defer loading metadata inside ParseModule when ShouldLazyLoadMetadata
is true and we have not loaded any Metadata block yet.

This commit implements all-or-nothing loading of Metadata. If there is a
request to load any metadata block, we will load all deferred metadata blocks.

We make sure the deferred metadata blocks are loaded before we materialize any
function or a module.

The default value of the added parameter ShouldLazyLoadMetadata for
getLazyBitcodeModule is false, so the default behavior stays the same.

We only set the parameter to true when creating LTOModule in local contexts.
These can only really be used for parsing symbols, so it's unnecessary to ever
load the metadata blocks.

If we are going to enable lazy-loading of Metadata for other usages of
getLazyBitcodeModule, where deferred metadata blocks need to be loaded, we can
expose BitcodeReader::materializeMetadata to Module, similar to
Module::materialize.

rdar://19804575

llvm-svn: 232198
2015-03-13 19:24:30 +00:00
Duncan P. N. Exon Smith c6820ec1c2 instcombine: alloca: Split out simplifyAllocaArraySize(), NFC
Follow-up commits will change some of the logic here.  Splitting into a
separate function simplifies the logic by allowing early returns instead
of deeper nesting.

llvm-svn: 232197
2015-03-13 19:22:03 +00:00