Commit Graph

1644 Commits

Author SHA1 Message Date
Lang Hames
2edbad28d2 Revert r227247 and r227228: "Add weak symbol support to RuntimeDyld".
This has wider implications than I expected when I reviewed the patch: It can
cause JIT crashes where clients have used the default value for AbortOnFailure
during symbol lookup. I'm currently investigating alternative approaches and I
hope to have this back in tree soon.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227287 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-28 01:30:37 +00:00
Chris Bieneman
4990e83b7b Re-landing changes to use ArrayRef instead of SmallVectorImpl, and new API test.
This contains the changes from r227148 & r227154, and also fixes to the test case to properly clean up the stack options.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227255 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 22:21:06 +00:00
Keno Fischer
fb04c23aeb [ExecutionEngine] Fix r227228 tests on Windows
On Windows, we're running MCJIT with ELF, so the module needs to have
its Triple explicitly adjusted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227247 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 21:33:25 +00:00
Keno Fischer
811b152d85 [ExecutionEngine] Add weak symbol support to RuntimeDyld
Support weak symbols by first looking up if there is an externally visible symbol we can find,
and only if that fails using the one in the object file we're loading.

Reviewed By: lhames
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D6950

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227228 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 20:02:31 +00:00
Keno Fischer
99b52293c7 [ExecutionEngine] FindFunctionNamed: Skip declarations
Summary:
Basically all other methods that look up functions by name skip them if they are mere declarations.
Do the same in FindFunctionNamed.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227227 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 19:29:00 +00:00
Richard Trieu
510cadb1c2 Revert r227148 & r227154 which added a test which infinitely loops.
r227148 added test CommandLineTest.HideUnrelatedOptionsMulti which repeatedly
outputs two following lines:

-tool: CommandLine Error: Option 'test-option-1' registered more than once!
-tool: CommandLine Error: Option 'test-option-2' registered more than once!

r227154 depends on changes from r227148


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227167 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 03:03:47 +00:00
Eric Christopher
ec89182585 Fix unsigned/signed comparison warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227158 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 01:01:39 +00:00
Chris Bieneman
57d5adfe15 One more fix to the new API to fix const-correctness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227154 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-27 00:42:00 +00:00
Chris Bieneman
f96362358f Pete Cooper suggested the new API should use ArrayRef instead of SmallVectorImpl. Also adding a test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227148 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 22:50:47 +00:00
Reid Kleckner
91ccead42a Add a UTF8 to UTF16 conversion wrapper for use in the pdb dumper
This can also be used instead of the WindowsSupport.h ConvertUTF8ToUTF16
helpers, but that will require massaging some character types. The
Windows support routines want wchar_t output, but wchar_t is often 32
bits on non-Windows OSs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227122 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 19:51:00 +00:00
Zachary Turner
019c097d1b Teach raw_ostream to support hex formatting without a prefix '0x'.
Previously using format_hex() would always print a 0x prior to the
hex characters.  This allows this to be optional, so that one can
choose to print (e.g.) 255 as either 0xFF or just FF.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227108 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 18:21:33 +00:00
Chris Bieneman
e0c2d280a2 Putting all the standard tool options into a "Generic" category.
Summary:
This puts all the options that CommandLine.cpp implements into a category so that the APIs to hide options can not hide based on the generic category instead of string matching a partial list of argument strings.

This patch is pretty simple and straight forward but it does impact the -help output of all tools using cl::opt. Specifically the options implemented in CommandLine.cpp (help, help-list, help-hidden, help-list-hidden, print-options, print-all-options, version) are all grouped together into an Option category, and these options are never hidden by the cl::HideUnrelatedOptions API.

Reviewers: dexonsmith, chandlerc, majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227093 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 16:56:00 +00:00
Joerg Sonnenberger
d546b25ddb The canonical CPU variant for ARM according to config.guess uses a
suffix it seems:

    # ./config.guess
    earmv7hfeb-unknown-netbsd7.99.4

Extend the triple parsing to support this. Avoid running the ARM parser
multiple times because StringSwitch is not lazy.

Reviewers: Renato Golin, Tim Northover

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227085 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-26 11:41:48 +00:00
Lang Hames
efd63170c8 [ADT] Add move operations to SmallVector<T,N> from SmallVectorImpl<T>.
This makes it possible to move between SmallVectors of different sizes.

Thanks to Dave Blaikie and Duncan Smith for patch feedback.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 06:25:17 +00:00
Duncan P. N. Exon Smith
a791aea5ae IR: Change GenericDwarfNode::getHeader() to StringRef
Simplify the API to use a `StringRef` directly rather than exposing the
`MDString` bits underneath.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226876 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22 23:10:55 +00:00
Duncan P. N. Exon Smith
cee1699e9f IR: DwarfNode => DebugNode, NFC
These things are potentially used for non-DWARF data (see the discussion
in PR22235), so take the `Dwarf` out of the name.  Since the new name
gives fewer clues, update the doxygen to properly describe what they
are.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226874 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22 22:47:44 +00:00
Duncan P. N. Exon Smith
003346177c IR: Update references to temporaries before deleting
During `MDNode::deleteTemporary()`, call `replaceAllUsesWith(nullptr)`
to update all tracking references to `nullptr`.

This fixes PR22280, where inverted destruction order between tracking
references and the temporaries themselves caused a use-after-free in
`LLParser`.

An alternative fix would be to add an assertion that there are no users,
and continue to fix inverted destruction order in clients (like
`LLParser`), but instead I decided to make getting-teardown-right easy.
(If someone disagrees let me know.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226866 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22 21:36:45 +00:00
Chris Bieneman
f04568139a Adding a new cl::HideUnrelatedOptions API to allow clang to migrate off cl::getRegisteredOptions.
Summary: cl::getRegisteredOptions really exposes some of the innards of how command line parsing is implemented. Exposing new APIs that allow us to disentangle client code from implementation details will allow us to make more extensive changes to command line parsing.

Reviewers: chandlerc, dexonsmith, beanz

Reviewed By: dexonsmith

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226729 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-21 22:45:52 +00:00
Adrian Prantl
bc1819e62e simplify expression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226701 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-21 21:23:35 +00:00
Adrian Prantl
8737be85f6 Fix a compile issue on MSVC and call finalize().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226694 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-21 19:25:35 +00:00
Adrian Prantl
9dc47c0c4a Let subprograms with instructions without parent scopes fail the
verification. Tested via a unit test.

Follow-up to r226616.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226684 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-21 18:32:56 +00:00
Duncan P. N. Exon Smith
62475afaf2 IR: Canonicalize GenericDwarfNode empty headers to null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226532 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 00:58:46 +00:00
Duncan P. N. Exon Smith
0a9f921686 IR: Introduce GenericDwarfNode
As part of PR22235, introduce `DwarfNode` and `GenericDwarfNode`.  The
former is a metadata node with a DWARF tag.  The latter matches our
current (generic) schema of a header with string (and stringified
integer) data and an arbitrary number of operands.

This doesn't move it into place yet; that change will require a large
number of testcase updates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226529 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 00:01:43 +00:00
Duncan P. N. Exon Smith
37c7ccc40c IR: Allow temporary nodes to become uniqued or distinct
Add `MDNode::replaceWithUniqued()` and `MDNode::replaceWithDistinct()`,
which mutate temporary nodes to become uniqued or distinct.  On uniquing
collisions, the unique version is returned and the node is deleted.

This takes advantage of temporary nodes being folded back in, and should
let me clean up some awkward logic in `MapMetadata()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226510 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 22:24:52 +00:00
Duncan P. N. Exon Smith
f9eaea701d IR: Return unique_ptr from MDNode::getTemporary()
Change `MDTuple::getTemporary()` and `MDLocation::getTemporary()` to
return (effectively) `std::unique_ptr<T, MDNode::deleteTemporary>`, and
clean up call sites.  (For now, `DIBuilder` call sites just call
`release()` immediately.)

There's an accompanying change in each of clang and polly to use the new
API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226504 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 21:30:18 +00:00
Duncan P. N. Exon Smith
a7852bfa47 IR: Add MDLocation::getTemporary()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226502 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 20:37:44 +00:00
Duncan P. N. Exon Smith
8ec0aee3b4 IR: Remove MDNodeFwdDecl
Remove `MDNodeFwdDecl` (as promised in r226481).  Aside from API
changes, there's no real functionality change here.
`MDNode::getTemporary()` now forwards to `MDTuple::getTemporary()`,
which returns a tuple with `isTemporary()` equal to true.

The main point is that we can now add temporaries of other `MDNode`
subclasses, needed for PR22235 (I introduced `MDNodeFwdDecl` in the
first place because I didn't recognize this need, and thought they were
only needed to handle forward references).

A few things left out of (or highlighted by) this commit:

  - I've had to remove the (few) uses of `std::unique_ptr<>` to deal
    with temporaries, since the destructor is no longer public.
    `getTemporary()` should probably return the equivalent of
    `std::unique_ptr<T, MDNode::deleteTemporary>`.
  - `MDLocation::getTemporary()` doesn't exist yet (worse, it actually
    does exist, but does the wrong thing: `MDNode::getTemporary()` is
    inherited and returns an `MDTuple`).
  - `MDNode` now only has one subclass, `UniquableMDNode`, and the
    distinction between them is actually somewhat confusing.

I'll fix those up next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226501 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 20:36:39 +00:00
Duncan P. N. Exon Smith
641414a6c0 IR: Store RAUW support and Context in the same pointer, NFC
Add an `LLVMContext &` to `ReplaceableMetadataImpl`, create a class that
either holds a reference to an `LLVMContext` or owns a
`ReplaceableMetadataImpl`, and use the new class in `MDNode`.

  - This saves a pointer in `UniquableMDNode` at the cost of a pointer
    in `ValueAsMetadata` (which didn't used to store the `LLVMContext`).
    There are far more of the former.
  - Unifies RAUW support between `MDNodeFwdDecl` (which is going away,
    see r226481) and `UniquableMDNode`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226484 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 19:02:06 +00:00
Duncan P. N. Exon Smith
1d72e18caa IR: Add isUniqued() and isTemporary()
Change `MDNode::isDistinct()` to only apply to 'distinct' nodes (not
temporaries), and introduce `MDNode::isUniqued()` and
`MDNode::isTemporary()` for the other two possibilities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226482 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 18:45:35 +00:00
Chandler Carruth
0a506e2f95 Suppress the newly added Clang warning for the inaccessible base in this
test. Do that after we suppress the warnings for unknown pragmas as this
warning flag is quite new in Clang and so old Clang's would warn all the
time on this file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226444 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 10:43:00 +00:00
Michael Gottesman
eb71fa415e [tinyptrvector] Add in a MutableArrayRef implicit conversion operator to complement the ArrayRef implicit conversion operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226428 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 03:25:33 +00:00
Chandler Carruth
de5df29556 [PM] Split the LoopInfo object apart from the legacy pass, creating
a LoopInfoWrapperPass to wire the object up to the legacy pass manager.

This switches all the clients of LoopInfo over and paves the way to port
LoopInfo to the new pass manager. No functionality change is intended
with this iteration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226373 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 14:16:18 +00:00
Duncan P. N. Exon Smith
fb7514fccb IR: Allow 16-bits for column info
Raise the limit for column information from 8 bits to 16 bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226291 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 17:33:08 +00:00
Vasileios Kalintiris
add8f51c26 Fix the C-API MCJIT test for 32-bit big endian machines.
Avoid using unions for storing the return value from
LLVMGetGlobalValueAddress() and LLVMGetFunctionAddress() and accessing it as
a pointer through another pointer member. This causes problems on 32-bit big
endian machines since the pointer gets the higher part of the return value of
the aforementioned functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 15:36:04 +00:00
Duncan P. N. Exon Smith
9e4a11f46c IR: Fix a use-after-free in RAUW
Happened pretty commonly during `LLVMContext` teardown when `clang -g`
hit an error.  This fixes the use-after-free.  Next I'll clean up
teardown so that it's not RAUW'ing when metadata-tracked values are
deleted (only really causes a problem if the graph is mid-construction
when teardown starts, but it's still unnecessary work).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226029 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 19:56:10 +00:00
Chandler Carruth
1b279144ec [cleanup] Re-sort all the #include lines in LLVM using
utils/sort_includes.py.

I clearly haven't done this in a while, so more changed than usual. This
even uncovered a missing include from the InstrProf library that I've
added. No functionality changed here, just mechanical cleanup of the
include order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 11:23:27 +00:00
Richard Trieu
1bcf09e589 Disable -Wunknown-pragmas in a test so that Clang without -Wself-move will not
complain that the flag doesn't exist.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225931 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:50:12 +00:00
Duncan P. N. Exon Smith
d640962656 IR: Add MDLocation class
Add a new subclass of `UniquableMDNode`, `MDLocation`.  This will be the
IR version of `DebugLoc` and `DILocation`.  The goal is to rename this
to `DILocation` once the IR classes supersede the `DI`-prefixed
wrappers.

This isn't used anywhere yet.  Part of PR21433.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 20:44:56 +00:00
Aaron Ballman
df70ab2592 Silence warnings about unknown pragmas for compilers that are not Clang. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225788 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 14:30:07 +00:00
NAKAMURA Takumi
16a6d38e01 IR/MetadataTest.cpp: Appease msc17 to avoid initializer list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225775 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 08:13:46 +00:00
Richard Trieu
cd7eb37ca4 Disable a warning for self move since the test is checking for this behavior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225754 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 02:10:33 +00:00
Duncan P. N. Exon Smith
6e4bbf0390 IR: Use unique_ptr, NFC
Use `std::unique_ptr<>`, as suggested by David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225749 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:57:27 +00:00
Duncan P. N. Exon Smith
698be08c84 IR: Remove an invalid assertion when replacing resolved operands
This adds back the testcase from r225738, and adds to it.  Looks like we
need both sides for now (the assertion was incorrect both ways, and
although it seemed reasonable (when written correctly) it wasn't
particularly important).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225745 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:46:34 +00:00
Duncan P. N. Exon Smith
47952358ce Revert "IR: Fix an inverted assertion when replacing resolved operands"
This reverts commit r225738.  Maybe the assertion is just plain wrong,
but this version fails on WAY more bots.  I'll make sure both ways work
in a follow-up but I want to get bots green in the meantime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225742 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:34:21 +00:00
Duncan P. N. Exon Smith
4fef722974 IR: Fix an inverted assertion when replacing resolved operands
Add a unit test, since this bug was only exposed by clang tests.  Thanks
to Rafael for tracking this down!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225738 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:10:38 +00:00
Duncan P. N. Exon Smith
5e3ba22b3a IR: Fix unit test memory leak reported by ASan
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/603/steps/check-llvm%20asan/logs/stdio

Thanks Alexey for pointing me to this!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225721 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 22:46:15 +00:00
Duncan P. N. Exon Smith
45db33d634 IR: Make MDNodeFwdDecl destructor public
Now that the leak detector is gone, anyone can call this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225689 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 20:19:54 +00:00
Duncan P. N. Exon Smith
728315adf4 IR: Add test for handleChangedOperand() recursion
Turns out this can happen.  Remove the `FIXME` and add a testcase that
crashes without the extra logic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225657 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 19:22:04 +00:00
Duncan P. N. Exon Smith
28184c10c9 IR: Make temporary nodes distinct
Change the return of `MDNode::isDistinct()` for `MDNode::getTemporary()`
to `true`.  They aren't uniqued.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225646 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 18:41:26 +00:00
Dmitri Gribenko
750f3160df ConvertUTFTest: fix misleading empty line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225580 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-10 05:03:29 +00:00