1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/include/llvm/Transforms/Utils
Chandler Carruth 74eb1e2070 [PM] Provide an initial, minimal port of the inliner to the new pass manager.
This doesn't implement *every* feature of the existing inliner, but
tries to implement the most important ones for building a functional
optimization pipeline and beginning to sort out bugs, regressions, and
other problems.

Notable, but intentional omissions:
- No alloca merging support. Why? Because it isn't clear we want to do
  this at all. Active discussion and investigation is going on to remove
  it, so for simplicity I omitted it.
- No support for trying to iterate on "internally" devirtualized calls.
  Why? Because it adds what I suspect is inappropriate coupling for
  little or no benefit. We will have an outer iteration system that
  tracks devirtualization including that from function passes and
  iterates already. We should improve that rather than approximate it
  here.
- Optimization remarks. Why? Purely to make the patch smaller, no other
  reason at all.

The last one I'll probably work on almost immediately. But I wanted to
skip it in the initial patch to try to focus the change as much as
possible as there is already a lot of code moving around and both of
these *could* be skipped without really disrupting the core logic.

A summary of the different things happening here:

1) Adding the usual new PM class and rigging.

2) Fixing minor underlying assumptions in the inline cost analysis or
   inline logic that don't generally hold in the new PM world.

3) Adding the core pass logic which is in essence a loop over the calls
   in the nodes in the call graph. This is a bit duplicated from the old
   inliner, but only a handful of lines could realistically be shared.
   (I tried at first, and it really didn't help anything.) All told,
   this is only about 100 lines of code, and most of that is the
   mechanics of wiring up analyses from the new PM world.

4) Updating the LazyCallGraph (in the new PM) based on the *newly
   inlined* calls and references. This is very minimal because we cannot
   form cycles.

5) When inlining removes the last use of a function, eagerly nuking the
   body of the function so that any "one use remaining" inline cost
   heuristics are immediately refined, and queuing these functions to be
   completely deleted once inlining is complete and the call graph
   updated to reflect that they have become dead.

6) After all the inlining for a particular function, updating the
   LazyCallGraph and the CGSCC pass manager to reflect the
   function-local simplifications that are done immediately and
   internally by the inline utilties. These are the exact same
   fundamental set of CG updates done by arbitrary function passes.

7) Adding a bunch of test cases to specifically target CGSCC and other
   subtle aspects in the new PM world.

Many thanks to the careful review from Easwaran and Sanjoy and others!

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

llvm-svn: 290161
2016-12-20 03:15:32 +00:00
..
AddDiscriminators.h Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
ASanStackFrameLayout.h [asan] Simplify calculation of stack frame layout extraction calculation of stack description into separate function. 2016-10-18 23:29:52 +00:00
BasicBlockUtils.h Misleading comments of SplitBlockAndInsertIfThenElse in BasicBlockUtils.h 2016-09-19 21:26:05 +00:00
BreakCriticalEdges.h [PM] Port BreakCriticalEdges to the new PM. 2016-07-22 18:04:25 +00:00
BuildLibCalls.h [TLI] Unify LibFunc attribute inference. NFCI. 2016-04-27 19:04:40 +00:00
BypassSlowDivision.h Clarify that the bypassSlowDivision optimization operates on a single BB [v2] 2016-01-04 23:18:58 +00:00
Cloning.h [PM] Provide an initial, minimal port of the inliner to the new pass manager. 2016-12-20 03:15:32 +00:00
CmpInstAnalysis.h move decomposeBitTestICmp() to Transforms/Utils; NFC 2016-07-20 17:18:45 +00:00
CodeExtractor.h CodeExtractor : Add ability to preserve profile data. 2016-08-02 02:15:45 +00:00
CtorUtils.h
EscapeEnumerator.h [tsan] Add support for C++ exceptions into TSan (call __tsan_func_exit during unwinding), LLVM part 2016-11-14 21:41:13 +00:00
Evaluator.h Transforms: Move GlobalOpt's Evaluator to Utils where it can be reused. 2016-02-03 02:51:00 +00:00
FunctionComparator.h [IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC). 2016-12-06 22:00:57 +00:00
FunctionImportUtils.h [ThinLTO] Rename doPromoteLocalToGlobal to shouldPromoteLocalToGlobal (NFC) 2016-10-29 21:52:23 +00:00
GlobalStatus.h
ImportedFunctionsInliningStatistics.h Do a sweep over move ctors and remove those that are identical to the default. 2016-10-20 12:20:28 +00:00
IntegerDivision.h
LCSSA.h Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
LibCallsShrinkWrap.h Conditionally eliminate library calls where the result value is not used 2016-10-18 21:36:27 +00:00
Local.h Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
LoopSimplify.h Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
LoopUtils.h Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
LoopVersioning.h Remove some 'const' specifiers that do nothing but prevent moving the argument. 2016-05-29 10:46:35 +00:00
LowerInvoke.h [PM] Port LowerInvoke to the new pass manager 2016-08-12 17:28:27 +00:00
Mem2Reg.h Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
MemorySSA.h Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
ModuleUtils.h Utility functions for appending to llvm.used/llvm.compiler.used. 2016-10-25 23:53:31 +00:00
NameAnonGlobals.h Rename NameAnonFunctions to NameAnonGlobals to match what it is doing (NFC) 2016-09-16 16:56:30 +00:00
PromoteMemToReg.h Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
SanitizerStats.h Introduce sanstats tool and llvm::CreateSanitizerStatReport function. 2016-01-16 00:31:11 +00:00
SimplifyIndVar.h [IndVars] Remove -liv-reduce 2016-06-05 18:01:12 +00:00
SimplifyInstructions.h Consistently use FunctionAnalysisManager 2016-08-09 00:28:15 +00:00
SimplifyLibCalls.h [SimplifyLibCalls] Use a lambda. NFCI. 2016-12-16 02:28:38 +00:00
SplitModule.h Move instances of std::function. 2016-06-12 16:13:55 +00:00
SSAUpdater.h [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
SSAUpdaterImpl.h Retire llvm::alignOf in favor of C++11 alignof. 2016-10-20 15:02:18 +00:00
SymbolRewriter.h Do a sweep over move ctors and remove those that are identical to the default. 2016-10-20 12:20:28 +00:00
UnifyFunctionExitNodes.h
UnrollLoop.h Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
ValueMapper.h ValueMaterializer: rename materializeDeclFor() to materialize() 2016-05-25 21:03:21 +00:00