1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/lib/Analysis
Easwaran Raman f04207e3b2 Add a pass to generate synthetic function entry counts.
Summary:
This pass synthesizes function entry counts by traversing the callgraph
and using the relative block frequencies of the callsites. The intended
use of these counts is in inlining to determine hot/cold callsites in
the absence of profile information.

The pass is split into two files with the code that propagates the
counts in a callgraph in a Utils file. I plan to add support for
propagation in the thinlto link phase and the propagation code will be
shared and hence this split. I did not add support to the old PM since
hot callsite determination in inlining is not possible in old PM
(although we could use hot callee heuristic with synthetic counts in the
old PM it is not worth the effort tuning it)

Reviewers: davidxl, silvas

Subscribers: mgorny, mehdi_amini, llvm-commits

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

llvm-svn: 322110
2018-01-09 19:39:35 +00:00
..
AliasAnalysis.cpp [ModRefInfo] Add must alias info to ModRefInfo. 2017-12-21 21:41:53 +00:00
AliasAnalysisEvaluator.cpp [ModRefInfo] Add must alias info to ModRefInfo. 2017-12-21 21:41:53 +00:00
AliasAnalysisSummary.cpp Update a comment. 2016-08-25 01:29:55 +00:00
AliasAnalysisSummary.h Make some LLVM_CONSTEXPR variables const. NFC. 2016-08-25 01:05:08 +00:00
AliasSetTracker.cpp Modify ModRefInfo values using static inline method abstractions [NFC]. 2017-12-05 20:12:23 +00:00
Analysis.cpp MemorySSA: Move to Analysis, from Transforms/Utils. It's used as 2017-04-11 20:06:36 +00:00
AssumptionCache.cpp [Analysis, Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-09-01 21:37:29 +00:00
BasicAliasAnalysis.cpp [BasicAA] Fix linearization of shifts beyond the bitwidth. 2018-01-05 16:18:47 +00:00
BlockFrequencyInfo.cpp Revert r320104: infinite loop profiling bug fix 2017-12-08 19:38:07 +00:00
BlockFrequencyInfoImpl.cpp Irreducible loop metadata for more accurate block frequency under PGO. 2017-11-02 22:26:51 +00:00
BranchProbabilityInfo.cpp [BranchProbabilityInfo] Handle irreducible loops. 2017-11-01 15:16:50 +00:00
CallGraph.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
CallGraphSCCPass.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. Also affected in files (NFC). 2017-08-31 21:56:16 +00:00
CallPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
CaptureTracking.cpp fix trivial typos; NFC 2017-07-09 05:54:44 +00:00
CFG.cpp
CFGPrinter.cpp [CFGVPrinter] Fix -dot-cfg-only 2017-12-19 15:20:18 +00:00
CFLAndersAliasAnalysis.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
CFLGraph.h [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
CFLSteensAliasAnalysis.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-08-11 21:30:02 +00:00
CGSCCPassManager.cpp Use a BumpPtrAllocator for Loop objects 2017-09-28 02:45:42 +00:00
CMakeLists.txt Add a pass to generate synthetic function entry counts. 2018-01-09 19:39:35 +00:00
CmpInstAnalysis.cpp [InstCombine][InstSimplify] Teach decomposeBitTestICmp to look through truncate instructions 2017-09-01 21:27:34 +00:00
CodeMetrics.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
ConstantFolding.cpp Revert "Fix typo [NFC]" 2017-10-01 00:09:53 +00:00
CostModel.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
Delinearization.cpp
DemandedBits.cpp Avoid int to string conversion in Twine or raw_ostream contexts. 2017-12-28 16:58:54 +00:00
DependenceAnalysis.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
DivergenceAnalysis.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
DominanceFrontier.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
DomPrinter.cpp [DomPrinter] Add a way to programmatically dump a dot representation. 2017-04-24 17:48:44 +00:00
EHPersonalities.cpp [EH] Recognize __(gxx|gcc)_personality_seh0 as the GNU EH personalities 2017-05-31 22:35:52 +00:00
GlobalsModRef.cpp [ModRefInfo] Add must alias info to ModRefInfo. 2017-12-21 21:41:53 +00:00
IndirectCallPromotionAnalysis.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
InlineCost.cpp [InlineFunction] Inline vararg functions that do not access varargs. 2018-01-06 19:45:40 +00:00
InstCount.cpp [Analysis] RemoveTotalMemInst counting in InstCount to avoid reading back other Statistic variables 2017-07-18 02:41:12 +00:00
InstructionSimplify.cpp [InstSimplify] Missed optimization in math expression: squashing exp(log), log(exp) 2018-01-03 14:37:42 +00:00
Interval.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IntervalPartition.cpp [Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-07-24 23:16:33 +00:00
IteratedDominanceFrontier.cpp [Dominators] Make IsPostDominator a template parameter 2017-07-14 18:26:09 +00:00
IVUsers.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
LazyBlockFrequencyInfo.cpp [LazyBFI] Fix typos 2017-02-14 17:21:12 +00:00
LazyBranchProbabilityInfo.cpp [BPI] Don't assume that strcmp returning >0 is more likely than <0 2017-06-08 09:44:40 +00:00
LazyCallGraph.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
LazyValueInfo.cpp [LVI] Support for ashr in LVI 2017-12-18 14:23:30 +00:00
Lint.cpp [Lint] Don't warn about noalias argument aliasing if other argument is byval 2017-12-27 08:48:33 +00:00
LLVMBuild.txt Update libdeps to add BinaryFormat, introduced in r304864. 2017-06-07 04:48:49 +00:00
Loads.cpp Modify ModRefInfo values using static inline method abstractions [NFC]. 2017-12-05 20:12:23 +00:00
LoopAccessAnalysis.cpp Revert r320548:[SLP] Vectorize jumbled memory loads 2017-12-20 15:26:59 +00:00
LoopAnalysisManager.cpp Add MemorySSA as loop dependency, disabled by default [NFC]. 2017-11-21 15:45:46 +00:00
LoopInfo.cpp IR printing improvement for loop passes - handle -print-module-scope 2017-12-01 18:33:58 +00:00
LoopPass.cpp [PM/Unswitch] Teach SimpleLoopUnswitch to do non-trivial unswitching, 2017-11-17 19:58:36 +00:00
LoopUnrollAnalyzer.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
MemDepPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
MemDerefPrinter.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
MemoryBuiltins.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-16 22:07:40 +00:00
MemoryDependenceAnalysis.cpp Revert "[memcpyopt] Teach memcpyopt to optimize across basic blocks" 2017-12-28 05:10:33 +00:00
MemoryLocation.cpp [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC) 2017-01-23 23:16:46 +00:00
MemorySSA.cpp [MemorySSA] Allow reordering of loads that alias in the presence of volatile loads. 2017-12-22 19:54:03 +00:00
MemorySSAUpdater.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
ModuleDebugInfoPrinter.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
ModuleSummaryAnalysis.cpp [ThinLTO] Don't import functions with noinline attribute 2017-12-25 13:57:24 +00:00
ObjCARCAliasAnalysis.cpp [ModRefInfo] Make enum ModRefInfo an enum class [NFC]. 2017-12-07 22:41:34 +00:00
ObjCARCAnalysisUtils.cpp Mark all library options as hidden. 2017-12-01 00:53:10 +00:00
ObjCARCInstKind.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
OptimizationRemarkEmitter.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
OrderedBasicBlock.cpp [OrderedBasicBlock] Return false for comesBefore(A, A) 2017-06-02 13:10:31 +00:00
PHITransAddr.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
PostDominators.cpp [Dominators] Remove redundant explicit template instantiation. 2017-08-26 21:08:51 +00:00
ProfileSummaryInfo.cpp Add hasProfileData() to check if a function has profile data. NFC. 2017-12-22 01:33:52 +00:00
PtrUseVisitor.cpp [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-08-18 23:51:26 +00:00
README.txt
RegionInfo.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
RegionPass.cpp Remove redundant includes from lib/Analysis. 2017-12-13 21:30:41 +00:00
RegionPrinter.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ScalarEvolution.cpp [SCEV] Do not cache S -> V if S is not equivalent of V 2018-01-09 06:47:14 +00:00
ScalarEvolutionAliasAnalysis.cpp [PM] Change the static object whose address is used to uniquely identify 2016-11-23 17:53:26 +00:00
ScalarEvolutionExpander.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
ScalarEvolutionNormalization.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ScopedNoAliasAA.cpp [ModRefInfo] Make enum ModRefInfo an enum class [NFC]. 2017-12-07 22:41:34 +00:00
StratifiedSets.h Do a sweep over move ctors and remove those that are identical to the default. 2016-10-20 12:20:28 +00:00
SyntheticCountsUtils.cpp Add a pass to generate synthetic function entry counts. 2018-01-09 19:39:35 +00:00
TargetLibraryInfo.cpp [TargetLibraryInfo] fix finite mathlib function availability 2018-01-08 17:38:09 +00:00
TargetTransformInfo.cpp Revert r321377, it causes regression to https://reviews.llvm.org/P8055. 2017-12-28 17:02:34 +00:00
Trace.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
TypeBasedAliasAnalysis.cpp [Analysis] Generate more precise TBAA tags when one access encloses the other 2017-12-18 20:05:20 +00:00
TypeMetadataUtils.cpp Analysis: Add appropriate const qualification to functions in TypeMetadataUtils.cpp. NFC. 2017-01-27 22:55:30 +00:00
ValueLattice.cpp [LVI] Move LVILatticeVal class to separate header file (NFC). 2017-09-28 11:09:22 +00:00
ValueLatticeUtils.cpp [IPSCCP] Move common functions to ValueLatticeUtils (NFC) 2017-10-13 17:53:44 +00:00
ValueTracking.cpp [ValueTracking] remove overzealous assert 2018-01-08 18:31:13 +00:00
VectorUtils.cpp Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00

Analysis Opportunities:

//===---------------------------------------------------------------------===//

In test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll, the
ScalarEvolution expression for %r is this:

  {1,+,3,+,2}<loop>

Outside the loop, this could be evaluated simply as (%n * %n), however
ScalarEvolution currently evaluates it as

  (-2 + (2 * (trunc i65 (((zext i64 (-2 + %n) to i65) * (zext i64 (-1 + %n) to i65)) /u 2) to i64)) + (3 * %n))

In addition to being much more complicated, it involves i65 arithmetic,
which is very inefficient when expanded into code.

//===---------------------------------------------------------------------===//

In formatValue in test/CodeGen/X86/lsr-delayed-fold.ll,

ScalarEvolution is forming this expression:

((trunc i64 (-1 * %arg5) to i32) + (trunc i64 %arg5 to i32) + (-1 * (trunc i64 undef to i32)))

This could be folded to

(-1 * (trunc i64 undef to i32))

//===---------------------------------------------------------------------===//