Commit Graph

1627 Commits

Author SHA1 Message Date
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
Duncan P. N. Exon Smith
727176d00e IR: Add MDNode::getDistinct()
Allow distinct `MDNode`s to be explicitly created.  There's no way (yet)
of representing their distinctness in assembly/bitcode, however, so this
still isn't first-class.

Part of PR22111.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225406 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 22:24:46 +00:00
Duncan P. N. Exon Smith
ee06e126b7 IR: Add MDNode::isDistinct()
Add API to indicate whether an `MDNode` is distinct.  A distinct node is
not stored in the MDNode uniquing tables, and will never be returned by
`MDNode::get()`.

Although distinct nodes are only currently created by uniquing
collisions (when operands change), PR22111 will allow these nodes to be
explicitly created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225401 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 21:35:38 +00:00
Duncan P. N. Exon Smith
97d1c07c15 IR: Don't drop MDNode uniquing on null operands
Now that `LLVMContextImpl` can call `MDNode::dropAllReferences()` to
prevent teardown madness, stop dropping uniquing just because an operand
drops to null.

Part of PR21532.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225223 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-05 23:31:54 +00:00
Frederic Riss
0c36e97b78 Make DIE.h a public CodeGen header.
dsymutil would like to use all the AsmPrinter/MCStreamer infrastructure
to stream out the DWARF. In order to do so, it will reuse the DIE object
and so this header needs to be public.

The interface exposed here has some corners that cannot be used without a
DwarfDebug object, but clients that want to stream Dwarf can just avoid
these.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225208 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-05 21:29:41 +00:00
Chandler Carruth
040ca449b2 [PM] Add names and debug logging for analysis passes to the new pass
manager.

This starts to allow us to test analyses more easily, but it's really
only the beginning. Some of the code here is still untestable without
manual changes to create analysis passes, but I wanted to factor it into
a small of chunks as possible.

Next up in order to be able to test things are, in no particular order:
- No-op analyses passes so we don't have to use real ones to exercise
  the pass maneger itself.
- Automatic way of generating dummy passes that require an analysis be
  run, including a variant that calls a 'print' method on a pass to make
  it even easier to print out the results of an analysis.
- Dummy passes that invalidate all analyses for their IR unit so we can
  test invalidation and re-runs.
- Automatic way to print each analysis pass as it is re-run.
- Automatic but optional verification of analysis passes everywhere
  possible.

I'm not claiming I'll get to all of these immediately, but that's what
is in the pipeline at some stage. I'm fleshing out exactly what I need
and what to prioritize by working on converting analyses and then trying
to test the conversion. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225162 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-05 12:21:44 +00:00
Chandler Carruth
b246acebf4 [PM] Switch the new pass manager to use a reference-based API for IR
units.

This was debated back and forth a bunch, but using references is now
clearly cleaner. Of all the code written using pointers thus far, in
only one place did it really make more sense to have a pointer. In most
cases, this just removes immediate dereferencing from the code. I think
it is much better to get errors on null IR units earlier, potentially
at compile time, than to delay it.

Most notably, the legacy pass manager uses references for its routines
and so as more and more code works with both, the use of pointers was
likely to become really annoying. I noticed this when I ported the
domtree analysis over and wrote the entire thing with references only to
have it fail to compile. =/ It seemed better to switch now than to
delay. We can, of course, revisit this is we learn that references are
really problematic in the API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225145 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-05 02:47:05 +00:00
Lang Hames
a46dd583d6 [APFloat][ADT] Fix sign handling logic for FMA results that truncate to zero.
This patch adds a check for underflow when truncating results back to lower
precision at the end of an FMA. The additional sign handling logic in
APFloat::fusedMultiplyAdd should only be performed when the result of the
addition step of the FMA (in full precision) is exactly zero, not when the
result underflows to zero.

Unit tests for this case and related signed zero FMA results are included.

Fixes <rdar://problem/18925551>.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225123 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-04 01:20:55 +00:00
Chandler Carruth
4b77e07165 Revert r225053: Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> where T is a base of U.
This appears to have broken at least the windows build bots due to
compile errors in the predicate that didn't simply supress the overload.
I'm not sure what the fix is, and the bots have been broken for a long
time now so I'm just reverting until Michael can figure out a fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225064 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-01 13:01:25 +00:00
Michael Gottesman
69338a993e Add 2x constructors for TinyPtrVector, one that takes in one elemenet and the other that takes in an ArrayRef<EltTy>
Currently one can only construct an empty TinyPtrVector. These are just missing
elements of the API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225055 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-31 23:33:24 +00:00
Michael Gottesman
4ba553c0f3 Add a SmallMapVector class that is a MapVector with a Map of SmallDenseMap and a Vector of SmallVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225054 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-31 23:33:21 +00:00
Michael Gottesman
735f1df049 Add an ArrayRef upcasting constructor from ArrayRef<U*> -> ArrayRef<T*> where T is a base of U.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225053 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-31 23:33:18 +00:00
Chandler Carruth
7c150bae21 [cmake] Start making LLVM_LIBDIR_SUFFIX effective by adding it to
*numerous* places where it was missing in the CMake build. The primary
change here is that the suffix is now actually used for all of the lib
directories in the LLVM project's CMake. The various subprojects still
need similar treatment.

This is the first of a series of commits to try to make LLVM's cmake
effective in a multilib Linux installation. I don't think many people
are seriously using this variable so I'm hoping the fallout will be
minimal. A somewhat unfortunate consequence of the nature of these
commits is that until I land all of them, they will in part make the
brokenness of our multilib support more apparant. At the end, things
should actually work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224919 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-29 11:16:19 +00:00
Rafael Espindola
1871cba561 Fix a leak found by asan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224773 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-23 17:20:23 +00:00
Peter Zotov
7bfc61dfe3 [C API] Expose LLVMGetGlobalValueAddress and LLVMGetFunctionAddress.
Patch by Ramkumar Ramachandra <artagnon@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224720 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22 18:53:11 +00:00
Rafael Espindola
ada5f24b5f The leak detector is dead, long live asan and valgrind.
In resent times asan and valgrind have found way more memory management bugs
in llvm than the special purpose leak detector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224703 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-22 13:00:36 +00:00
Duncan P. N. Exon Smith
9e2c0f95fe Remove 'metadata' from comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224328 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 07:45:05 +00:00
Duncan P. N. Exon Smith
02a8d1bcfd IR: Stop printing 'metadata' in Metadata::print()
Stop printing `metadata` in `Metadata::print()` and
`Metadata::printAsOperand()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224327 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 07:40:31 +00:00