#
b32febe4 |
| 07-Mar-2016 |
Chandler Carruth <chandlerc@gmail.com> |
[memdep] Switch a function to return true on success instead of false.
This is much more clear and less surprising IMO. It also makes things more consistent with the increasingly large chunk of LLVM
[memdep] Switch a function to return true on success instead of false.
This is much more clear and less surprising IMO. It also makes things more consistent with the increasingly large chunk of LLVM code that assumes true-on-success.
llvm-svn: 262826
show more ...
|
#
40e21f2a |
| 07-Mar-2016 |
Chandler Carruth <chandlerc@gmail.com> |
[memdep] Cleanup the implementation doxygen comments and remove duplicated comments.
In several cases these had diverged making them especially nice to canonicalize. I checked to make sure we weren'
[memdep] Cleanup the implementation doxygen comments and remove duplicated comments.
In several cases these had diverged making them especially nice to canonicalize. I checked to make sure we weren't losing important information of course.
llvm-svn: 262825
show more ...
|
#
60fb1b4b |
| 07-Mar-2016 |
Chandler Carruth <chandlerc@gmail.com> |
[memdep] Run clang-format over the header before porting it to the new pass manager.
The port will involve substantial edits here, and would likely introduce bad formatting if formatted in isolation
[memdep] Run clang-format over the header before porting it to the new pass manager.
The port will involve substantial edits here, and would likely introduce bad formatting if formatted in isolation, so just get all the formatting up to snuff. I'll also go through and try to freshen the doxygen here as well as modernizing some of the code.
llvm-svn: 262821
show more ...
|
Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3 |
|
#
e261e5ac |
| 22-Feb-2016 |
Krzysztof Parzyszek <kparzysz@codeaurora.org> |
More detailed dependence test between volatile and non-volatile accesses
Differential Revision: http://reviews.llvm.org/D16857
llvm-svn: 261589
|
#
36894dcf |
| 20-Feb-2016 |
Joerg Sonnenberger <joerg@bec.de> |
When MemoryDependenceAnalysis hits a CFG with many transparent blocks, the algorithm easily degrades into quadratic memory and time complexity. The easiest example is a long chain of BBs that don't o
When MemoryDependenceAnalysis hits a CFG with many transparent blocks, the algorithm easily degrades into quadratic memory and time complexity. The easiest example is a long chain of BBs that don't otherwise use a location. The caching will add an entry for every intermediate block and limiting the number of results doesn't help as no results are produced until a definition is found.
Introduce a limit similar to the existing instructions-per-block limit. This limit counts the total number of blocks checked. If the limit is reached, entries are considered unknown. The initial value is 1000, which avoids regressions for normal sized functions while still limiting edge cases to reasnable memory consumption and execution time.
Differential Revision: http://reviews.llvm.org/D16123
llvm-svn: 261430
show more ...
|
Revision tags: llvmorg-3.8.0-rc2 |
|
#
b30f2f51 |
| 30-Jan-2016 |
Matthias Braun <matze@braunis.de> |
Avoid overly large SmallPtrSet/SmallSet
These sets perform linear searching in small mode so it is never a good idea to use SmallSize/N bigger than 32.
llvm-svn: 259283
|
Revision tags: llvmorg-3.8.0-rc1 |
|
#
a694a0b1 |
| 05-Jan-2016 |
Philip Reames <listmail@philipreames.com> |
[MDA] Don't be quite as conservative for noalias functions
If we encounter a noalias call that alias analysis can't analyse, we can fall down into the generic call handling rather than giving up ent
[MDA] Don't be quite as conservative for noalias functions
If we encounter a noalias call that alias analysis can't analyse, we can fall down into the generic call handling rather than giving up entirely. I noticed this while reading through the code for another purpose.
I can't seem to write a test case which changes; that sorta makes sense given any test case would have to be an inconsistency in AA. Suggestions welcome.
Differential Revision: http://reviews.llvm.org/D15825
llvm-svn: 256802
show more ...
|
#
947ca8ac |
| 04-Jan-2016 |
Nick Lewycky <nicholas@mxc.ca> |
Fix comment in typo. NFC
llvm-svn: 256761
|
#
e30b8ca1 |
| 03-Jan-2016 |
Craig Topper <craig.topper@gmail.com> |
Use std::is_sorted and std::none_of instead of manual loops. NFC
llvm-svn: 256719
|
Revision tags: llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1 |
|
#
5a82c916 |
| 10-Oct-2015 |
Duncan P. N. Exon Smith <dexonsmith@apple.com> |
Analysis: Remove implicit ilist iterator conversions
Remove implicit ilist iterator conversions from LLVMAnalysis.
I came across something really scary in `llvm::isKnownNotFullPoison()` which relie
Analysis: Remove implicit ilist iterator conversions
Remove implicit ilist iterator conversions from LLVMAnalysis.
I came across something really scary in `llvm::isKnownNotFullPoison()` which relied on `Instruction::getNextNode()` being completely broken (not surprising, but scary nevertheless). This function is documented (and coded to) return `nullptr` when it gets to the sentinel, but with an `ilist_half_node` as a sentinel, the sentinel check looks into some other memory and we don't recognize we've hit the end.
Rooting out these scary cases is the reason I'm removing the implicit conversions before doing anything else with `ilist`; I'm not at all surprised that clients rely on badness.
I found another scary case -- this time, not relying on badness, just bad (but I guess getting lucky so far) -- in `ObjectSizeOffsetEvaluator::compute_()`. Here, we save out the insertion point, do some things, and then restore it. Previously, we let the iterator auto-convert to `Instruction*`, and then set it back using the `Instruction*` version:
Instruction *PrevInsertPoint = Builder.GetInsertPoint();
/* Logic that may change insert point */
if (PrevInsertPoint) Builder.SetInsertPoint(PrevInsertPoint);
The check for `PrevInsertPoint` doesn't protect correctly against bad accesses. If the insertion point has been set to the end of a basic block (i.e., `SetInsertPoint(SomeBB)`), then `GetInsertPoint()` returns an iterator pointing at the list sentinel. The version of `SetInsertPoint()` that's getting called will then call `PrevInsertPoint->getParent()`, which explodes horribly. The only reason this hasn't blown up is that it's fairly unlikely the builder is adding to the end of the block; usually, we're adding instructions somewhere before the terminator.
llvm-svn: 249925
show more ...
|
#
dc9b2cfc |
| 02-Oct-2015 |
Piotr Padlewski <prazek@google.com> |
inariant.group handling in GVN
The most important part required to make clang devirtualization works ( ͡°͜ʖ ͡°). The code is able to find non local dependencies, but unfortunatelly because the calle
inariant.group handling in GVN
The most important part required to make clang devirtualization works ( ͡°͜ʖ ͡°). The code is able to find non local dependencies, but unfortunatelly because the caller can only handle local dependencies, I had to add some restrictions to look for dependencies only in the same BB.
http://reviews.llvm.org/D12992
llvm-svn: 249196
show more ...
|
#
7b560d40 |
| 09-Sep-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible with the new pass manager, and no longer relying on analysis groups.
This builds essentially a ground-up new AA infrastructur
[PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible with the new pass manager, and no longer relying on analysis groups.
This builds essentially a ground-up new AA infrastructure stack for LLVM. The core ideas are the same that are used throughout the new pass manager: type erased polymorphism and direct composition. The design is as follows:
- FunctionAAResults is a type-erasing alias analysis results aggregation interface to walk a single query across a range of results from different alias analyses. Currently this is function-specific as we always assume that aliasing queries are *within* a function.
- AAResultBase is a CRTP utility providing stub implementations of various parts of the alias analysis result concept, notably in several cases in terms of other more general parts of the interface. This can be used to implement only a narrow part of the interface rather than the entire interface. This isn't really ideal, this logic should be hoisted into FunctionAAResults as currently it will cause a significant amount of redundant work, but it faithfully models the behavior of the prior infrastructure.
- All the alias analysis passes are ported to be wrapper passes for the legacy PM and new-style analysis passes for the new PM with a shared result object. In some cases (most notably CFL), this is an extremely naive approach that we should revisit when we can specialize for the new pass manager.
- BasicAA has been restructured to reflect that it is much more fundamentally a function analysis because it uses dominator trees and loop info that need to be constructed for each function.
All of the references to getting alias analysis results have been updated to use the new aggregation interface. All the preservation and other pass management code has been updated accordingly.
The way the FunctionAAResultsWrapperPass works is to detect the available alias analyses when run, and add them to the results object. This means that we should be able to continue to respect when various passes are added to the pipeline, for example adding CFL or adding TBAA passes should just cause their results to be available and to get folded into this. The exception to this rule is BasicAA which really needs to be a function pass due to using dominator trees and loop info. As a consequence, the FunctionAAResultsWrapperPass directly depends on BasicAA and always includes it in the aggregation.
This has significant implications for preserving analyses. Generally, most passes shouldn't bother preserving FunctionAAResultsWrapperPass because rebuilding the results just updates the set of known AA passes. The exception to this rule are LoopPass instances which need to preserve all the function analyses that the loop pass manager will end up needing. This means preserving both BasicAAWrapperPass and the aggregating FunctionAAResultsWrapperPass.
Now, when preserving an alias analysis, you do so by directly preserving that analysis. This is only necessary for non-immutable-pass-provided alias analyses though, and there are only three of interest: BasicAA, GlobalsAA (formerly GlobalsModRef), and SCEVAA. Usually BasicAA is preserved when needed because it (like DominatorTree and LoopInfo) is marked as a CFG-only pass. I've expanded GlobalsAA into the preserved set everywhere we previously were preserving all of AliasAnalysis, and I've added SCEVAA in the intersection of that with where we preserve SCEV itself.
One significant challenge to all of this is that the CGSCC passes were actually using the alias analysis implementations by taking advantage of a pretty amazing set of loop holes in the old pass manager's analysis management code which allowed analysis groups to slide through in many cases. Moving away from analysis groups makes this problem much more obvious. To fix it, I've leveraged the flexibility the design of the new PM components provides to just directly construct the relevant alias analyses for the relevant functions in the IPO passes that need them. This is a bit hacky, but should go away with the new pass manager, and is already in many ways cleaner than the prior state.
Another significant challenge is that various facilities of the old alias analysis infrastructure just don't fit any more. The most significant of these is the alias analysis 'counter' pass. That pass relied on the ability to snoop on AA queries at different points in the analysis group chain. Instead, I'm planning to build printing functionality directly into the aggregation layer. I've not included that in this patch merely to keep it smaller.
Note that all of this needs a nearly complete rewrite of the AA documentation. I'm planning to do that, but I'd like to make sure the new design settles, and to flesh out a bit more of what it looks like in the new pass manager first.
Differential Revision: http://reviews.llvm.org/D12080
llvm-svn: 247167
show more ...
|
Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4 |
|
#
19ac7d5b |
| 12-Aug-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM/AA] Add missing static dependency edges from DSE and memdep to TLI.
I forgot to add these in r244780 and r244778. Sorry about that.
Also order the static dependencies in a lexicographical order
[PM/AA] Add missing static dependency edges from DSE and memdep to TLI.
I forgot to add these in r244780 and r244778. Sorry about that.
Also order the static dependencies in a lexicographical order.
llvm-svn: 244787
show more ...
|
#
d06034d2 |
| 12-Aug-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM/AA] Have memdep explicitly get and use TargetLibraryInfo rather than relying on sneaking it out of its AliasAnalysis.
This abuse of AA (to shuffle TLI around rather than explicitly depending on
[PM/AA] Have memdep explicitly get and use TargetLibraryInfo rather than relying on sneaking it out of its AliasAnalysis.
This abuse of AA (to shuffle TLI around rather than explicitly depending on it) is going away with my refactor of AA.
llvm-svn: 244778
show more ...
|
#
dfc1d96e |
| 31-Jul-2015 |
Bruno Cardoso Lopes <bruno.cardoso@gmail.com> |
[CaptureTracker] Provide an ordered basic block to PointerMayBeCapturedBefore
This patch is a follow up from r240560 and is a step further into mitigating the compile time performance issues in Capt
[CaptureTracker] Provide an ordered basic block to PointerMayBeCapturedBefore
This patch is a follow up from r240560 and is a step further into mitigating the compile time performance issues in CaptureTracker.
By providing the CaptureTracker with a "cached ordered basic block" instead of computing it every time, MemDepAnalysis can use this cache throughout its calls to AA->callCapturesBefore, avoiding to recompute it for every scanned instruction. In the same testcase used in r240560, compile time is reduced from 2min to 30s.
This also fixes PR22348.
rdar://problem/19230319 Differential Revision: http://reviews.llvm.org/D11364
llvm-svn: 243750
show more ...
|
Revision tags: llvmorg-3.7.0-rc2 |
|
#
194f59ca |
| 22-Jul-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM/AA] Extract the ModRef enums from the AliasAnalysis class in preparation for de-coupling the AA implementations.
In order to do this, they had to become fake-scoped using the traditional LLVM pa
[PM/AA] Extract the ModRef enums from the AliasAnalysis class in preparation for de-coupling the AA implementations.
In order to do this, they had to become fake-scoped using the traditional LLVM pattern of a leading initialism. These can't be actual scoped enumerations because they're bitfields and thus inherently we use them as integers.
I've also renamed the behavior enums that are specific to reasoning about the mod/ref behavior of functions when called. This makes it more clear that they have a very narrow domain of applicability.
I think there is a significantly cleaner API for all of this, but I don't want to try to do really substantive changes for now, I just want to refactor the things away from analysis groups so I'm preserving the exact original design and just cleaning up the names, style, and lifting out of the class.
Differential Revision: http://reviews.llvm.org/D10564
llvm-svn: 242963
show more ...
|
#
a1032a0f |
| 22-Jul-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM/AA] Remove the last of the legacy update API from AliasAnalysis as part of simplifying its interface and usage in preparation for porting to work with the new pass manager.
Note that this will l
[PM/AA] Remove the last of the legacy update API from AliasAnalysis as part of simplifying its interface and usage in preparation for porting to work with the new pass manager.
Note that this will likely expose that we have dead arguments, members, and maybe even pass requirements for AA. I'll be cleaning those up in seperate patches. This just zaps the actual update API.
Differential Revision: http://reviews.llvm.org/D11325
llvm-svn: 242881
show more ...
|
#
d058ea92 |
| 21-Jul-2015 |
Jingyue Wu <jingyue@google.com> |
[MDA] change BlockScanLimit into a command line option.
Summary: In the benchmark (https://github.com/vetter/shoc) we are researching, the duplicated load is not eliminated because MemoryDependenceA
[MDA] change BlockScanLimit into a command line option.
Summary: In the benchmark (https://github.com/vetter/shoc) we are researching, the duplicated load is not eliminated because MemoryDependenceAnalysis hit the BlockScanLimit. This patch change it into a command line option instead of a hardcoded value.
Patched by Xuetian Weng.
Test Plan: test/Analysis/MemoryDependenceAnalysis/memdep-block-scan-limit.ll
Reviewers: jingyue, reames
Subscribers: reames, llvm-commits
Differential Revision: http://reviews.llvm.org/D11366
llvm-svn: 242842
show more ...
|
Revision tags: llvmorg-3.7.0-rc1, llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
#
c3f49eb4 |
| 22-Jun-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM/AA] Hoist the AliasResult enum out of the AliasAnalysis class.
This will allow classes to implement the AA interface without deriving from the class or referencing an internal enum of some other
[PM/AA] Hoist the AliasResult enum out of the AliasAnalysis class.
This will allow classes to implement the AA interface without deriving from the class or referencing an internal enum of some other class as their return types.
Also, to a pretty fundamental extent, concepts such as 'NoAlias', 'MayAlias', and 'MustAlias' are first class concepts in LLVM and we aren't saving anything by scoping them heavily.
My mild preference would have been to use a scoped enum, but that feature is essentially completely broken AFAICT. I'm extremely disappointed. For example, we cannot through any reasonable[1] means construct an enum class (or analog) which has scoped names but converts to a boolean in order to test for the possibility of aliasing.
[1]: Richard Smith came up with a "solution", but it requires class templates, and lots of boilerplate setting up the enumeration multiple times. Something like Boost.PP could potentially bundle this up, but even that would be quite painful and it doesn't seem realistically worth it. The enum class solution would probably work without the need for a bool conversion.
Differential Revision: http://reviews.llvm.org/D10495
llvm-svn: 240255
show more ...
|
#
ac80dc75 |
| 17-Jun-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM/AA] Remove the Location typedef from the AliasAnalysis class now that it is its own entity in the form of MemoryLocation, and update all the callers.
This is an entirely mechanical change. Refer
[PM/AA] Remove the Location typedef from the AliasAnalysis class now that it is its own entity in the form of MemoryLocation, and update all the callers.
This is an entirely mechanical change. References to "Location" within AA subclases become "MemoryLocation", and elsewhere "AliasAnalysis::Location" becomes "MemoryLocation". Hope that helps out-of-tree folks update.
llvm-svn: 239885
show more ...
|
#
70c61c1a |
| 04-Jun-2015 |
Chandler Carruth <chandlerc@gmail.com> |
[PM/AA] Start refactoring AliasAnalysis to remove the analysis group and port it to the new pass manager.
All this does is extract the inner "location" class used by AA into its own full fledged typ
[PM/AA] Start refactoring AliasAnalysis to remove the analysis group and port it to the new pass manager.
All this does is extract the inner "location" class used by AA into its own full fledged type. This seems *much* cleaner as MemoryDependence and soon MemorySSA also use this heavily, and it doesn't make much sense being inside the AA infrastructure.
This will also make it much easier to break apart the AA infrastructure into something that stands on its own rather than using the analysis group design.
There are a few places where this makes APIs not make sense -- they were taking an AliasAnalysis pointer just to build locations. I'll try to clean those up in follow-up commits.
Differential Revision: http://reviews.llvm.org/D10228
llvm-svn: 239003
show more ...
|
#
7666be70 |
| 01-Jun-2015 |
David Majnemer <david.majnemer@gmail.com> |
[PHITransAddr] Don't translate unreachable values
Unreachable values may use themselves in strange ways due to their dominance property. Attempting to translate through them can lead to infinite re
[PHITransAddr] Don't translate unreachable values
Unreachable values may use themselves in strange ways due to their dominance property. Attempting to translate through them can lead to infinite recursion, crashing LLVM. Instead, claim that we weren't able to translate the value.
This fixes PR23096.
llvm-svn: 238702
show more ...
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1 |
|
#
b4e7a4a4 |
| 21-Apr-2015 |
Daniel Berlin <dberlin@dberlin.org> |
Revamp PredIteratorCache interface to be cleaner.
Summary: This lets us use range based for loops.
Reviewers: chandlerc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9
Revamp PredIteratorCache interface to be cleaner.
Summary: This lets us use range based for loops.
Reviewers: chandlerc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9169
llvm-svn: 235416
show more ...
|
#
b8a4d413 |
| 13-Apr-2015 |
Daniel Berlin <dberlin@dberlin.org> |
Common some code from MemoryDependenceAnalysis that will be used in MemorySSA
llvm-svn: 234813
|
#
3a09ef64 |
| 10-Apr-2015 |
Benjamin Kramer <benny.kra@googlemail.com> |
[CallSite] Make construction from Value* (or Instruction*) explicit.
CallSite roughly behaves as a common base CallInst and InvokeInst. Bring the behavior closer to that model by making upcasts expl
[CallSite] Make construction from Value* (or Instruction*) explicit.
CallSite roughly behaves as a common base CallInst and InvokeInst. Bring the behavior closer to that model by making upcasts explicit. Downcasts remain implicit and work as before.
Following dyn_cast as a mental model checking whether a Value *V isa CallSite now looks like this: if (auto CS = CallSite(V)) // think dyn_cast instead of: if (CallSite CS = V)
This is an extra token but I think it is slightly clearer. Making the ctor explicit has the advantage of not accidentally creating nullptr CallSites, e.g. when you pass a Value * to a function taking a CallSite argument.
llvm-svn: 234601
show more ...
|