Commit Graph

425 Commits

Author SHA1 Message Date
Chandler Carruth
3c0d60785c Re-sort #include lines for unittests. This uses a slightly modified
clang-format (https://reviews.llvm.org/D33932) to keep primary headers
at the top and handle new utility headers like 'gmock' consistently with
other utility headers.

No other change was made. I did no manual edits, all of this is
clang-format.

This should allow other changes to have more clear and focused diffs,
and is especially motivated by moving some headers into more focused
libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304786 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 11:06:56 +00:00
Adam Nemet
8008a8a954 Handle non-unique edges in edge-dominance
This removes a quadratic behavior in assert-enabled builds.

GVN propagates the equivalence from a condition into the blocks guarded by the
condition.  E.g. for 'if (a == 7) { ... }', 'a' will be replaced in the block
with 7.  It does this by replacing all the uses of 'a' that are dominated by
the true edge.

For a switch with N cases and U uses of the value, this will mean N * U calls
to 'dominates'.  Asserting isSingleEdge in 'dominates' make this N^2 * U
because this function checks for the uniqueness of the edge. I.e. traverses
each edge between the SwitchInst's block and the cases.

The change removes the assert and makes 'dominates' works correctly in the
presence of non-unique edges.

This brings build time down by an order of magnitude for an input that has
~10k cases in a switch statement.

Differential Revision: https://reviews.llvm.org/D33584

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304721 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-05 16:27:09 +00:00
Craig Topper
843f0af293 [ConstantRange] Add another truncate unittest for wrapped set staying a wrapped set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304695 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-04 23:07:53 +00:00
Craig Topper
014d3cb804 [ConstantRange] Add a few more truncate unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304694 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-04 23:03:54 +00:00
Craig Topper
e6cc2d00d9 [ConstantRange] Add missing result check to the ConstantRange::truncate test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304693 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-04 23:03:52 +00:00
Reid Kleckner
3db1299db9 Fix assertion when merging multiple empty AttributeLists
Patch by Nicholas Wilson!

Differential Revision: https://reviews.llvm.org/D33627

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304300 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-31 14:24:06 +00:00
Adam Nemet
ad7d2c0d6e Rearrange Dom unittest to accommodate multiple tests
I've taken the approach from the LoopInfo test:

* Rather than running in the pass manager just build the analyses manually
* Split out the common parts (makeLLVMModule, runWithDomTree) into helpers

Differential Revision: https://reviews.llvm.org/D33617

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-27 04:05:52 +00:00
Adam Nemet
bfb2ddf65c clang-format DomTree unittest
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304060 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-27 04:05:50 +00:00
Daniel Jasper
0559b4fa45 Remove unnecessary double-assignment triggering -Wsequence-point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303974 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-26 12:07:12 +00:00
Chandler Carruth
a1a0cf0a7b [IR] Add an iterator and range accessor for the PHI nodes of a basic
block.

This allows writing much more natural and readable range based for loops
directly over the PHI nodes. It also takes advantage of the same tricks
for terminating the sequence as the hand coded versions.

I've replaced one example of this mostly to showcase the difference and
I've added a unit test to make sure the facilities really work the way
they're intended. I want to use this inside of SimpleLoopUnswitch but it
seems generally nice.

Differential Revision: https://reviews.llvm.org/D33533

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303964 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-26 03:10:00 +00:00
Xin Tong
fcebfdfa41 Fix test typo. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20 19:40:24 +00:00
Reid Kleckner
e6f2078382 Fix off-by-one bug in AttributeList::addAttributes index handling
getParamAlignment expects an argument number, not an AttributeList
index.

Johan Englan, who works on LDC, found this bug and told me about it off
list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303458 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19 22:23:47 +00:00
Reid Kleckner
816047d44c [IR] De-virtualize ~Value to save a vptr
Summary:
Implements PR889

Removing the virtual table pointer from Value saves 1% of RSS when doing
LTO of llc on Linux. The impact on time was positive, but too noisy to
conclusively say that performance improved. Here is a link to the
spreadsheet with the original data:

https://docs.google.com/spreadsheets/d/1F4FHir0qYnV0MEp2sYYp_BuvnJgWlWPhWOwZ6LbW7W4/edit?usp=sharing

This change makes it invalid to directly delete a Value, User, or
Instruction pointer. Instead, such code can be rewritten to a null check
and a call Value::deleteValue(). Value objects tend to have their
lifetimes managed through iplist, so for the most part, this isn't a big
deal.  However, there are some places where LLVM deletes values, and
those places had to be migrated to deleteValue.  I have also created
llvm::unique_value, which has a custom deleter, so it can be used in
place of std::unique_ptr<Value>.

I had to add the "DerivedUser" Deleter escape hatch for MemorySSA, which
derives from User outside of lib/IR. Code in IR cannot include MemorySSA
headers or call the MemoryAccess object destructors without introducing
a circular dependency, so we need some level of indirection.
Unfortunately, no class derived from User may have any virtual methods,
because adding a virtual method would break User::getHungOffOperands(),
which assumes that it can find the use list immediately prior to the
User object. I've added a static_assert to the appropriate OperandTraits
templates to help people avoid this trap.

Reviewers: chandlerc, mehdi_amini, pete, dberlin, george.burgess.iv

Reviewed By: chandlerc

Subscribers: krytarowski, eraman, george.burgess.iv, mzolotukhin, Prazek, nlewycky, hans, inglorion, pcc, tejohnson, dberlin, llvm-commits

Differential Revision: https://reviews.llvm.org/D31261

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303362 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-18 17:24:10 +00:00
Craig Topper
66563ce6a9 [ConstantRange] Fix what appear to be copy and paste mistakes in the unittest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303033 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15 04:40:19 +00:00
Craig Topper
b97a02c7d3 [ConstantRange] Fix the early out in ConstantRange::multiply for positive numbers to really do what the comment says
r271020 added an early out to skip the signed multiply portion of ConstantRange::multiply. The comment says we don't need to do signed multiply if the range is only positive numbers, but the implemented check only ensures that the start of the range is positive. It doesn't look at the end of the range.

This patch checks the end of the range instead. Because Upper is one more than the end we have to see if its positive or if its one past the last positive number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302717 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 20:01:48 +00:00
Craig Topper
21adc2deca [ConstantRange] Add test case showing a case where we pick too large of a range for multiply after r271020.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302700 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 18:15:06 +00:00
Serge Guelton
d35f86ef8f Suppress all uses of LLVM_END_WITH_NULL. NFC.
Use variadic templates instead of relying on <cstdarg> + sentinel.
This enforces better type checking and makes code more readable.

Differential Revision: https://reviews.llvm.org/D32541


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302571 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-09 19:31:13 +00:00
Zvi Rackover
f4d18ab589 IR: Add a shufflevector mask commutation helper function. NFC.
Summary:
Following up on Sanjay's suggetion in D32955, move this functionality
into ShuffleVectornstruction.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D32956

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302420 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-08 12:40:18 +00:00
Reid Kleckner
dac7487074 Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"
This time, I fixed, built, and tested clang.

This reverts r301712.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301981 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02 22:07:37 +00:00
Sanjoy Das
41673c62ec Add a new WeakVH value handle; NFC
This relands r301425.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 17:07:54 +00:00
Sanjoy Das
399b4d037d Rename WeakVH to WeakTrackingVH; NFC
This relands r301424.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301812 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 17:07:49 +00:00
Sanjoy Das
3284bd7d15 Emulate TrackingVH using WeakVH
Summary:
This frees up one slot in the HandleBaseKind enum, which I will use
later to add a new kind of value handle.  The size of the
HandleBaseKind enum is important because we store a HandleBaseKind in
the low two bits of a (in the worst case) 4 byte aligned pointer.

Reviewers: davide, chandlerc

Subscribers: mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D32634

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301809 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 16:28:58 +00:00
Hans Wennborg
dfc1ffb1c9 Revert r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"
This broke the Clang build. (Clang-side patch missing?)

Original commit message:

> [IR] Make add/remove Attributes use AttrBuilder instead of
> AttributeList
>
> This change cleans up call sites and avoids creating temporary
> AttributeList objects.
>
> NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301712 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 23:01:32 +00:00
Adrian Prantl
841400b968 Remove line and file from DINamespace.
Fixes the issue highlighted in
http://lists.llvm.org/pipermail/cfe-dev/2014-June/037500.html.

The DW_AT_decl_file and DW_AT_decl_line attributes on namespaces can
prevent LLVM from uniquing types that are in the same namespace. They
also don't carry any meaningful information.

rdar://problem/17484998
Differential Revision: https://reviews.llvm.org/D32648

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301706 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 22:25:46 +00:00
Reid Kleckner
fde3916ada [IR] Make add/remove Attributes use AttrBuilder instead of AttributeList
This change cleans up call sites and avoids creating temporary
AttributeList objects.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301697 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 21:48:28 +00:00
Adrian Prantl
1bf6297ee8 Add support for DW_TAG_thrown_type.
For Swift we would like to be able to encode the error types that a
function may throw, so the debugger can display them alongside the
function's return value when finish-ing a function.

DWARF defines DW_TAG_thrown_type (intended to be used for C++ throw()
declarations) that is a perfect fit for this purpose. This patch wires
up support for DW_TAG_thrown_type in LLVM by adding a list of thrown
types to DISubprogram.

To offset the cost of the extra pointer, there is a follow-up patch
that turns DISubprogram into a variable-length node.

rdar://problem/29481673

Differential Revision: https://reviews.llvm.org/D32559

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 22:56:44 +00:00
Sanjoy Das
263da12ab2 Reverts commit r301424, r301425 and r301426
Commits were:

"Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts"
"Add a new WeakVH value handle; NFC"
"Rename WeakVH to WeakTrackingVH; NFC"

The changes assumed pointers are 8 byte aligned on all architectures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301429 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:37:05 +00:00
Sanjoy Das
147a8edb1b Add a new WeakVH value handle; NFC
Summary:
WeakVH nulls itself out if the value it was tracking gets deleted, but
it does not track RAUW.

Reviewers: dblaikie, davide

Subscribers: mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D32267

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301425 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:20:59 +00:00
Sanjoy Das
d0cf26e443 Rename WeakVH to WeakTrackingVH; NFC
Summary:
I plan to use WeakVH to mean "nulls itself out on deletion, but does
not track RAUW" in a subsequent commit.

Reviewers: dblaikie, davide

Reviewed By: davide

Subscribers: arsenm, mehdi_amini, mcrosier, mzolotukhin, jfb, llvm-commits, nhaehnle

Differential Revision: https://reviews.llvm.org/D32266

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301424 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:20:52 +00:00
Craig Topper
119d936828 [APInt] Cast more calls to add/sub/mul overflow functions to void. I missed the unittests in r300758.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300773 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 22:11:05 +00:00
Reid Kleckner
4bc9eb623d Remove buggy 'addAttributes(unsigned, AttrBuilder)' overload
The 'addAttributes(unsigned, AttrBuilder)' overload delegated to 'get'
instead of 'addAttributes'.

Since we can implicitly construct an AttrBuilder from an AttributeSet,
just standardize on AttrBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300651 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19 01:51:13 +00:00
Reid Kleckner
129271c86a Fix crash in AttributeList::addAttributes, add test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300614 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 22:10:18 +00:00
Chandler Carruth
ddfada260a [IR] Redesign the case iterator in SwitchInst to actually be an iterator
and to expose a handle to represent the actual case rather than having
the iterator return a reference to itself.

All of this allows the iterator to be used with common STL facilities,
standard algorithms, etc.

Doing this exposed some missing facilities in the iterator facade that
I've fixed and required some work to the actual iterator to fully
support the necessary API.

Differential Revision: https://reviews.llvm.org/D31548

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300032 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12 07:27:28 +00:00
Adam Nemet
5c57c1108e [IR] Add AllowContract to FastMathFlags
-ffp-contract=fast does not currently work with LTO because it's passed as a
TargetOption to the backend rather than in the IR. This adds it to
FastMathFlags.

This is toward fixing PR25721

Differential Revision: https://reviews.llvm.org/D31164

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298939 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-28 20:11:52 +00:00
Adam Nemet
5fead02594 Make test more robust
Set the flags on FAdd locally rather than assuming nothing will change it from
way earlier in the test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298462 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 23:50:52 +00:00
Reid Kleckner
6707770d48 Rename AttributeSet to AttributeList
Summary:
This class is a list of AttributeSetNodes corresponding the function
prototype of a call or function declaration. This class used to be
called ParamAttrListPtr, then AttrListPtr, then AttributeSet. It is
typically accessed by parameter and return value index, so
"AttributeList" seems like a more intuitive name.

Rename AttributeSetImpl to AttributeListImpl to follow suit.

It's useful to rename this class so that we can rename AttributeSetNode
to AttributeSet later. AttributeSet is the set of attributes that apply
to a single function, argument, or return value.

Reviewers: sanjoy, javed.absar, chandlerc, pete

Reviewed By: pete

Subscribers: pete, jholewinski, arsenm, dschuff, mehdi_amini, jfb, nhaehnle, sbc100, void, llvm-commits

Differential Revision: https://reviews.llvm.org/D31102

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298393 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-21 16:57:19 +00:00
Reid Kleckner
1c19be8a98 Remove getArgumentList() in favor of arg_begin(), args(), etc
Users often call getArgumentList().size(), which is a linear way to get
the number of function arguments. arg_size(), on the other hand, is
constant time.

In general, the fact that arguments are stored in an iplist is an
implementation detail, so I've removed it from the Function interface
and moved all other users to the argument container APIs (arg_begin(),
arg_end(), args(), arg_size()).

Reviewed By: chandlerc

Differential Revision: https://reviews.llvm.org/D31052

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298010 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-16 22:59:15 +00:00
Konstantin Zhuravlyov
2cee5cc825 [DebugInfo] Emit address space with DW_AT_address_class attribute for pointer and reference types
Differential Revision: https://reviews.llvm.org/D29670


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297320 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-08 23:55:44 +00:00
Chandler Carruth
bff5a6eea5 [IR] Add range accessors for the indices of a GEP instruction.
These were noticed as missing in a code review. Add them and the boring
unit test to make sure they compile and DTRT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296444 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 08:04:20 +00:00
Sanjoy Das
9e36975287 [IR] Add a Instruction::dropPoisonGeneratingFlags helper
Summary:
The helper will be used in a later change.  This change itself is NFC
since the only user of this new function is its unit test.

Reviewers: majnemer, efriedma

Reviewed By: efriedma

Subscribers: efriedma, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D30184

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296035 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23 22:50:52 +00:00
Keno Fischer
b863b6b817 [GlobalObject] Fix setSection("")
Summary:
In rL291613, the section name was interned in LLVMContext. However,
this broke the ability to remove the section from a GlobalObject,
because it tried to intern empty strings, which is not allowed.
Fix that and add an appropriate regression test.

Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D29795

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295238 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15 21:42:42 +00:00
Dehao Chen
fe46230d58 Change debug-info-for-profiling from a TargetOption to a function attribute.
Summary: LTO requires the debug-info-for-profiling to be a function attribute.

Reviewers: echristo, mehdi_amini, dblaikie, probinson, aprantl

Reviewed By: mehdi_amini, dblaikie, aprantl

Subscribers: aprantl, probinson, ahatanak, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D29203

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 22:45:09 +00:00
Chandler Carruth
59fff99fc0 [PM] Introduce a PoisoningVH as a (more expensive) alternative to
AssertingVH that delays any reported error until the handle is *used*.

This allows data structures to contain handles which become dangling
provided the data structure is cleaned up afterward rather than used for
anything interesting.

The implementation is moderately horrible in part because it works to
leave AssertingVH in place, undisturbed. If at some point there is
consensus that this is simply how AssertingVH should be used, it can be
substantially simplified.

This remains a boring pointer in a non-asserts build as you would
expect. The only place we pay cost is in asserts builds.

I plan to use this as a basis for replacing the asserting VHs that
currently dangle in the new PM until invalidation occurs in both LVI and
SCEV.

Differential Revision: https://reviews.llvm.org/D29061

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292925 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 12:34:47 +00:00
David Blaikie
28fbf6cb4a Fix some -Wsign-compare warnings by making some integer literals explicitly unsigned
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291776 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12 17:44:32 +00:00
Amjad Aboud
8c4ff10896 [DebugInfo] Added DI macro creation API to DIBuilder.
Differential Revision: https://reviews.llvm.org/D16077

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12 15:49:46 +00:00
Serge Pavlov
b2ae9e2c45 [StructurizeCfg] Update dominator info.
In some cases StructurizeCfg updates root node, but dominator info
remains unchanges, it causes crash when expensive checks are enabled.
To cope with this problem a new method was added to DominatorTreeBase
that allows adding new root nodes, it is called in StructurizeCfg to
put dominator tree in sync.

This change fixes PR27488.

Differential Revision: https://reviews.llvm.org/D28114


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291530 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10 02:50:47 +00:00
Mohammed Agabaria
a2d2e19c17 [IR] Adding const_value_op_iterator for IR/User.h
const value op iterator is missing from User.h class.

Differential Revision: https://reviews.llvm.org/D28464



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291443 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 14:00:57 +00:00
Chandler Carruth
0fc446723e [PM] Introduce the facilities for registering cross-IR-unit dependencies
that require deferred invalidation.

This handles the other real-world invalidation scenario that we have
cases of: a function analysis which caches references to a module
analysis. We currently do this in the AA aggregation layer and might
well do this in other places as well.

Since this is relative rare, the technique is somewhat more cumbersome.
Analyses need to register themselves when accessing the outer analysis
manager's proxy. This proxy is already necessarily present to allow
access to the outer IR unit's analyses. By registering here we can track
and trigger invalidation when that outer analysis goes away.

To make this work we need to enhance the PreservedAnalyses
infrastructure to support a (slightly) more explicit model for "sets" of
analyses, and allow abandoning a single specific analyses even when
a set covering that analysis is preserved. That allows us to describe
the scenario of preserving all Function analyses *except* for the one
where deferred invalidation has triggered.

We also need to teach the invalidator API to support direct ID calls
instead of always going through a template to dispatch so that we can
just record the ID mapping.

I've introduced testing of all of this both for simple module<->function
cases as well as for more complex cases involving a CGSCC layer.

Much like the previous patch I've not tried to fully update the loop
pass management layer because that layer is due to be heavily reworked
to use similar techniques to the CGSCC to handle updates. As that
happens, we'll have a better testing basis for adding support like this.

Many thanks to both Justin and Sean for the extensive reviews on this to
help bring the API design and documentation into a better state.

Differential Revision: https://reviews.llvm.org/D27198

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290594 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27 08:40:39 +00:00
Amjad Aboud
4e2e80b609 [DebugInfo] Added support for Checksum debug info feature.
Differential Revision: https://reviews.llvm.org/D27642

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290514 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-25 10:12:09 +00:00
Adrian Prantl
7b500b4bdf [IR] Remove the DIExpression field from DIGlobalVariable.
This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

This reapplies r289902 with additional testcase upgrades and a change
to the Bitcode record for DIGlobalVariable, that makes upgrading the
old format unambiguous also for variables without DIExpressions.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290153 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-20 02:09:43 +00:00