llvm/lib/Analysis
Peter Collingbourne df2206086c IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI.
When profiling a no-op incremental link of Chromium I found that the functions
computeImportForFunction and computeDeadSymbols were consuming roughly 10% of
the profile. The goal of this change is to improve the performance of those
functions by changing the map lookups that they were previously doing into
pointer dereferences.

This is achieved by changing the ValueInfo data structure to be a pointer to
an element of the global value map owned by ModuleSummaryIndex, and changing
reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs.
This means that a ValueInfo will take a client directly to the summary list
for a given GUID.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302108 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 03:36:16 +00:00
..
AliasAnalysis.cpp [IR] Make paramHasAttr to use arg indices instead of attr indices 2017-04-14 20:19:02 +00:00
AliasAnalysisEvaluator.cpp
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp
Analysis.cpp MemorySSA: Move to Analysis, from Transforms/Utils. It's used as 2017-04-11 20:06:36 +00:00
AssumptionCache.cpp Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
BasicAliasAnalysis.cpp Handle invariant.group.barrier in BasicAA 2017-04-24 19:37:17 +00:00
BlockFrequencyInfo.cpp
BlockFrequencyInfoImpl.cpp
BranchProbabilityInfo.cpp [BPI] NFC: reorder ifs to bail out earlier 2017-04-17 06:39:47 +00:00
CallGraph.cpp
CallGraphSCCPass.cpp Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
CallPrinter.cpp
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp
CFLAndersAliasAnalysis.cpp
CFLGraph.h [IR] Abstract away ArgNo+1 attribute indexing as much as possible 2017-05-03 18:17:31 +00:00
CFLSteensAliasAnalysis.cpp
CGSCCPassManager.cpp
CMakeLists.txt MemorySSA: Move to Analysis, from Transforms/Utils. It's used as 2017-04-11 20:06:36 +00:00
CodeMetrics.cpp
ConstantFolding.cpp [KnownBits] Add methods for determining if KnownBits is a constant value 2017-05-03 23:12:29 +00:00
CostModel.cpp [SystemZ] TargetTransformInfo cost functions implemented. 2017-04-12 11:49:08 +00:00
Delinearization.cpp
DemandedBits.cpp [APInt] Add clearSignBit method. Use it and setSignBit in a few places. NFCI 2017-04-28 16:58:05 +00:00
DependenceAnalysis.cpp
DivergenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp [DomPrinter] Add a way to programmatically dump a dot representation. 2017-04-24 17:48:44 +00:00
EHPersonalities.cpp
GlobalsModRef.cpp
IndirectCallPromotionAnalysis.cpp
InlineCost.cpp Refactor callsite cost computation into a helper function /NFC 2017-05-02 05:38:41 +00:00
InstCount.cpp
InstructionSimplify.cpp [KnownBits] Add methods for determining if KnownBits is a constant value 2017-05-03 23:12:29 +00:00
Interval.cpp
IntervalPartition.cpp
IteratedDominanceFrontier.cpp
IVUsers.cpp [IVUsers] Don't bail out of normalizing non-affine add recs 2017-04-25 06:53:25 +00:00
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp
LazyValueInfo.cpp [LazyValueInfo] Fix typo in comment. NFC 2017-04-28 16:57:59 +00:00
Lint.cpp Kill off the old SimplifyInstruction API by converting remaining users. 2017-04-28 19:55:38 +00:00
LLVMBuild.txt
Loads.cpp Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue. NFCI 2017-03-19 15:27:52 +00:00
LoopAccessAnalysis.cpp [LAA] Correctly return a half-open range in expandBounds 2017-04-05 09:24:26 +00:00
LoopAnalysisManager.cpp
LoopInfo.cpp
LoopPass.cpp
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp [MemoryBuiltins] Add isMallocOrCallocLikeFn so BasicAA can check for both at the same time 2017-04-18 21:43:46 +00:00
MemoryDependenceAnalysis.cpp
MemoryLocation.cpp
MemorySSA.cpp MemorySSA: Stop tracking def-or-use blocks. 2017-04-16 19:45:51 +00:00
MemorySSAUpdater.cpp [MSSA] Clean up the updater a bit. NFC 2017-04-21 04:54:52 +00:00
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI. 2017-05-04 03:36:16 +00:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp
OptimizationDiagnosticInfo.cpp
OrderedBasicBlock.cpp
PHITransAddr.cpp PHITransAddr: Use new SimplifyQuery based API. 2017-04-26 20:56:13 +00:00
PostDominators.cpp
ProfileSummaryInfo.cpp Use isFunctionHotInCallGraph to set the function section prefix. 2017-03-23 23:14:11 +00:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp [SCEV] createAddRecFromPHI: Optimize for the most common case. 2017-05-03 23:53:38 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
ScalarEvolutionNormalization.cpp Teach SCEV normalization to de/normalize non-affine add recs 2017-04-25 00:09:19 +00:00
ScopedNoAliasAA.cpp
SparsePropagation.cpp [IR] Redesign the case iterator in SwitchInst to actually be an iterator 2017-04-12 07:27:28 +00:00
StratifiedSets.h
TargetLibraryInfo.cpp
TargetTransformInfo.cpp [InlineCost] Improve the cost heuristic for Switch 2017-04-28 16:04:03 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp
TypeMetadataUtils.cpp
ValueTracking.cpp [ValueTracking] Remove handling for BitWidth being 0 in ComputeSignBit and isKnownNonZero. 2017-05-03 22:25:19 +00:00
VectorUtils.cpp

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))

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