Commit Graph

155 Commits

Author SHA1 Message Date
Michael Kuperstein
69f04075f8 [PM] Port LowerInvoke to the new pass manager
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278531 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 17:28:27 +00:00
Teresa Johnson
7be175919a [PM] Port NameAnonFunction pass to new pass manager
Summary:
Port the NameAnonFunction pass and add a test.

Depends on D23439.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278509 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 14:03:36 +00:00
Teresa Johnson
3143f33d96 [PM] Port ModuleSummaryIndex analysis to new pass manager
Summary:
Port the ModuleSummaryAnalysisWrapperPass to the new pass manager.
Use it in the ported BitcodeWriterPass (similar to how we use the
legacy ModuleSummaryAnalysisWrapperPass in the legacy WriteBitcodePass).

Also, pass the -module-summary opt flag through to the new pass
manager pipeline and through to the bitcode writer pass, and add
a test that uses it.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278508 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 13:53:02 +00:00
Sean Silva
2058f10aaa Consistently use CGSCCAnalysisManager
Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278080 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09 00:28:56 +00:00
Sean Silva
a4f9d70f9b Consistently use LoopAnalysisManager
One exception here is LoopInfo which must forward-declare it (because
the typedef is in LoopPassManager.h which depends on LoopInfo).

Also, some includes for LoopPassManager.h were needed since that file
provides the typedef.

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278079 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09 00:28:52 +00:00
Sean Silva
2fb9a98752 Consistently use ModuleAnalysisManager
Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09 00:28:38 +00:00
Sean Silva
20b343c051 Consistently use FunctionAnalysisManager
Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09 00:28:15 +00:00
Chandler Carruth
411e616ba3 [PM] Change the name of the repeating utility to something less
overloaded (and simpler).

Sean rightly pointed out in code review that we've started using
"wrapper pass" as a specific part of the old pass manager, and in fact
it is more applicable there. Here, we really have a pass *template* to
build a repeated pass, so call it that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277689 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-04 03:52:53 +00:00
Chandler Carruth
d4bcc6c7a1 [PM] Fix a mis-named parameter in parseLoopPass -- the pass manager was
called "FPM" instead of "LPM" in a hold-over from when the code was
modeled on that used to parse function passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277584 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 09:14:03 +00:00
Chandler Carruth
91b6bfa061 [PM] Add a generic 'repeat N times' pass wrapper to the new pass
manager.

While this has some utility for debugging and testing on its own, it is
primarily intended to demonstrate the technique for adding custom
wrappers that can provide more interesting interation behavior in
a nice, orthogonal, and composable layer.

Being able to write these kinds of very dynamic and customized controls
for running passes was one of the motivating use cases of the new pass
manager design, and this gives a hint at how they might look. The actual
logic is tiny here, and most of this is just wiring in the pipeline
parsing so that this can be widely used.

I'm adding this now to show the wiring without a lot of business logic.
This is a precursor patch for showing how a "iterate up to N times as
long as we devirtualize a call" utility can be added as a separable and
composable component along side the CGSCC pass management.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 07:44:48 +00:00
Chandler Carruth
0f1f98257c [PM] Remove the NDEBUG condition around isModulePassName.
I forgot to do this initially, and added when I saw this fail in
a no-asserts build, but managed to loose the diff from the actual patch
that got submitted. Very sorry.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277562 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 03:26:09 +00:00
Chandler Carruth
3d1a470319 [PM] Significantly refactor the pass pipeline parsing to be easier to
reason about and less error prone.

The core idea is to fully parse the text without trying to identify
passes or structure. This is done with a single state machine. There
were various bugs in the logic around this previously that were repeated
and scattered across the code. Having a single routine makes it much
easier to fix and get correct. For example, this routine doesn't suffer
from PR28577.

Then the actual pass construction is handled using *much* easier to read
code and simple loops, with particular pass manager construction sunk to
live with other pass construction. This is especially nice as the pass
managers *are* in fact passes.

Finally, the "implicit" pass manager synthesis is done much more simply
by forming "pre-parsed" structures rather than having to duplicate tons
of logic.

One of the bugs fixed by this was evident in the tests where we accepted
a pipeline that wasn't really well formed. Another bug is PR28577 for
which I have added a test case.

The code is less efficient than the previous code but I'm really hoping
that's not a priority. ;]

Thanks to Sean for the review!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 03:21:41 +00:00
Michael Kuperstein
3a6d437582 [PM] Port SpeculativeExecution to the new PM
Differential Revision: https://reviews.llvm.org/D23033


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277393 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 21:48:33 +00:00
Michael Kuperstein
093715aad1 [PM] Port LowerGuardIntrinsic to the new PM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-28 22:08:41 +00:00
Michael Kuperstein
b3391842c6 [PM] Port SymbolRewriter to the new PM
Differential Revision: https://reviews.llvm.org/D22703


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276687 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 20:52:00 +00:00
Jordan Rose
569213a17c StringSwitch cannot be copied (take 2).
This prevents StringSwitch from being used with 'auto', which is
important because the inferred type is StringSwitch rather than the
result type. This is a problem because StringSwitch stores addresses
of temporary values rather than copying or moving the value into its
own storage.

This is a compromise that still allows wrapping StringSwitch in other
temporary structures, which (unlike StringSwitch) may be non-trivial
to set up and therefore want to at least be movable. (For an example,
see QueryParser.cpp in clang-tools-extra.)

Changing this uncovered the bug in PassBuilder, also in this patch.
Clang doesn't seem to have any occurrences of the issue.

Re-commit of r276652.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 18:34:51 +00:00
Jordan Rose
c0eeb4bf36 Revert "StringSwitch cannot be copied or moved."
This reverts commit r276652. The clang-query tool is currently
relying on this behavior. I'll try again later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276661 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 17:28:33 +00:00
Jordan Rose
04a86972ba StringSwitch cannot be copied or moved.
...but most importantly, it cannot be used well with 'auto', because
the inferred type is StringSwitch rather than the result type. This
is a problem because StringSwitch stores addresses of temporary
values rather than copying or moving the value into its own storage.

Changing this uncovered the bug in PassBuilder, also in this patch.
Clang doesn't seem to have any occurrences of the issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276652 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25 17:08:24 +00:00
Wei Mi
a6c7a032fe [PM] Port BreakCriticalEdges to the new PM.
Differential Revision: https://reviews.llvm.org/D22688


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276449 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22 18:04:25 +00:00
Wei Mi
3a4fa31d34 [PM] Port NaryReassociate to the new PM
Differential Revision: https://reviews.llvm.org/D22648


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276349 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21 22:28:52 +00:00
Sean Silva
d8c90ea6b8 [PM] Port LoopUnroll.
We just set PreserveLCSSA to always true since we don't have an
analogous method `mustPreserveAnalysisID(LCSSA)`.

Also port LoopInfo verifier pass to test LoopUnrollPass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-19 23:54:23 +00:00
Dehao Chen
e7eb2d5c54 [PM] Convert Loop Strength Reduce pass to new PM
Summary: Convert Loop String Reduce pass to new PM

Reviewers: davidxl, silvas

Subscribers: junbuml, sanjoy, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 21:41:50 +00:00
Teresa Johnson
385d70633e [PM] Port FunctionImport Pass to new PM
Summary: Port FunctionImport Pass to new PM.

Reviewers: mehdi_amini, davide

Subscribers: davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275916 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 21:22:24 +00:00
Adam Nemet
9b7ecbef6d [LoopDist] Port to new PM
Summary:
The direct motivation for the port is to ensure that the OptRemarkEmitter
tests work with the new PM.

This remains a function pass because we not only create multiple loops
but could also version the original loop.

In the test I need to invoke opt
with -passes='require<aa>,loop-distribute'.  LoopDistribute does not
directly depend on AA however LAA does.  LAA uses getCachedResult so
I *think* we need manually pull in 'aa'.

Reviewers: davidxl, silvas

Subscribers: sanjoy, llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275811 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 16:29:27 +00:00
Adam Nemet
c7b8b5e22d [OptRemarkEmitter] Port to new PM
Summary:
The main goal is to able to start using the new OptRemarkEmitter
analysis from the LoopVectorizer.  Since the vectorizer was recently
converted to the new PM, it makes sense to convert this analysis as
well.

This pass is currently tested through the LoopDistribution pass, so I am
also porting LoopDistribution to get coverage for this analysis with the
new PM.

Reviewers: davidxl, silvas

Subscribers: llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275810 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 16:29:21 +00:00
Adam Nemet
c476e1701d Sort include headers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275809 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 16:29:17 +00:00
Dehao Chen
78ee4b6ec0 [PM] Convert IVUsers analysis to new pass manager.
Summary: Convert IVUsers analysis to new pass manager.

Reviewers: davidxl, silvas

Subscribers: junbuml, sanjoy, llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275698 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-16 22:51:33 +00:00
Dehao Chen
ca28eb1502 [PM] Convert LoopInstSimplify Pass to new PM
Summary: Convert LoopInstSimplify to new PM. Unfortunately there is no exisiting unittest for this pass.

Reviewers: davidxl, silvas

Subscribers: silvas, llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 16:42:11 +00:00
Sebastian Pop
9c2e9dc782 code hoisting pass based on GVN
This pass hoists duplicated computations in the program. The primary goal of
gvn-hoist is to reduce the size of functions before inline heuristics to reduce
the total cost of function inlining.

Pass written by Sebastian Pop, Aditya Kumar, Xiaoyu Hu, and Brian Rzycki.
Important algorithmic contributions by Daniel Berlin under the form of reviews.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 13:45:20 +00:00
Jun Bum Lim
fa907d312a [PM] Port Dead Loop Deletion Pass to the new PM
Summary: Port Dead Loop Deletion Pass to the new pass manager.

Reviewers: silvas, davide

Subscribers: llvm-commits, sanjoy, mcrosier

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275453 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 18:28:29 +00:00
Nico Weber
037f8a7c73 Revert r275401, it caused PR28551.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275420 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:41:25 +00:00
Sebastian Pop
16129fc15d code hoisting pass based on GVN
This pass hoists duplicated computations in the program. The primary goal of
gvn-hoist is to reduce the size of functions before inline heuristics to reduce
the total cost of function inlining.

Pass written by Sebastian Pop, Aditya Kumar, Xiaoyu Hu, and Brian Rzycki.
Important algorithmic contributions by Daniel Berlin under the form of reviews.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275401 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 12:18:53 +00:00
Dehao Chen
e06fe02dcc Add missing files for r275222
New pass manager for LICM.

Summary: Port LICM to the new pass manager.

Reviewers: davidxl, silvas

Subscribers: krasin, vitalybuka, silvas, davide, sanjoy, llvm-commits, mehdi_amini

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275224 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 22:42:24 +00:00
Dehao Chen
2ba4d7a7ea [PM] Port LoopIdiomRecognize Pass to new PM
Summary: Port LoopIdiomRecognize Pass to new PM

Reviewers: davidxl

Subscribers: davide, sanjoy, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275202 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 18:45:51 +00:00
Vitaly Buka
c0c43ac164 Revert "New pass manager for LICM."
Summary: This reverts commit r275118.

Subscribers: sanjoy, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275156 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 06:25:32 +00:00
Dehao Chen
f84fc6de4f New pass manager for LICM.
Summary: Port LICM to the new pass manager.

Reviewers: davidxl, silvas

Subscribers: silvas, davide, sanjoy, llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275118 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11 22:45:24 +00:00
Davide Italiano
eb0664013d [PM/IPO] Port LowerTypeTests to the new PassManager.
There's a little bit of churn in this patch because the initialization
mechanism is now shared between the old and the new PM. Other than
that, it's just a pretty mechanical translation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275082 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11 18:10:06 +00:00
Sean Silva
89419a6ccc [PM] Port LoopVectorize to the new PM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275000 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-09 22:56:50 +00:00
Davide Italiano
0dd611bd69 [PM] Port CrossDSOCFI to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274962 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-09 03:25:35 +00:00
Sean Silva
eb2d4257f4 [PM] Fix a think-o. mv {Scalar,Vectorize}/SLPVectorize.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274960 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-09 03:11:29 +00:00
Davide Italiano
fff81b23a8 [PM] Port LoopSimplify to the new pass manager.
While here move simplifyLoop() function to the new header, as
suggested by Chandler in the review.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274959 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-09 03:03:01 +00:00
Xinliang David Li
fd5a3b4bf8 [PM] name the new PM LAA class LoopAccessAnalysis (LAA) /NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274934 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 21:21:44 +00:00
Wei Mi
302c35d621 [PM] Port UnreachableBlockElim to the new Pass Manager
Differential Revision: http://reviews.llvm.org/D22124


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274824 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-08 03:32:49 +00:00
Davide Italiano
d0de2d93f5 [PM] Port InstSimplify to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274796 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-07 21:14:36 +00:00
Sean Silva
f79d978b96 [PM] Port TailCallElim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274708 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06 23:48:41 +00:00
Sean Silva
9afbd6ffb9 [PM] Port CorrelatedValuePropagation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274705 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06 23:26:29 +00:00
George Burgess IV
3b5b98a488 [CFLAA] Split into Anders+Steens analysis.
StratifiedSets (as implemented) is very fast, but its accuracy is also
limited. If we take a more aggressive andersens-like approach, we can be
way more accurate, but we'll also end up being slower.

So, we've decided to split CFLAA into CFLSteensAA and CFLAndersAA.

Long-term, we want to end up in a place where CFLSteens is queried
first; if it can provide an answer, great (since queries are basically
map lookups). Otherwise, we'll fall back to CFLAnders, BasicAA, etc.

This patch splits everything out so we can try to do something like
that when we get a reasonable CFLAnders implementation.

Patch by Jia Chen.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274589 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-06 00:26:41 +00:00
Xinliang David Li
10b22c8894 [PM] Port LoopAccessInfo analysis to new PM
It is implemented as a LoopAnalysis pass as 
discussed and agreed upon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02 21:18:40 +00:00
Michael Kuperstein
3fae04db50 [PM] Port ConstantHoisting to the new Pass Manager
Differential Revision: http://reviews.llvm.org/D21945


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274411 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-02 00:16:47 +00:00
Duncan P. N. Exon Smith
d88fd1226e Revert "code hoisting pass based on GVN"
This reverts commit r274305, since it breaks self-hosting:
  http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/22349/
  http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/17232

Note that the blamelist on lab.llvm.org:8011 is incorrect.  The previous
build was r274299, but somehow r274305 wasn't included in the blamelist:
  http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274320 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-01 01:51:40 +00:00