1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/lib/Analysis
Bardia Mahjour 4af1e9e981 [DA] Delinearization of fixed-size multi-dimensional arrays
Summary:
Currently the dependence analysis in LLVM is unable to compute accurate
dependence vectors for multi-dimensional fixed size arrays.
This is mainly because the delinearization algorithm in scalar evolution
relies on parametric terms to be present in the access functions. In the
case of fixed size arrays such parametric terms are not present, but we
can use the indexes from GEP instructions to recover the subscripts for
each dimension of the arrays. This patch adds this ability under the
existing option `-da-disable-delinearization-checks`.

Authored By: bmahjour

Reviewer: Meinersbur, sebpop, fhahn, dmgreen, grosser, etiotto, bollu

Reviewed By: Meinersbur

Subscribers: hiraditya, arphaman, Whitney, ppc-slack, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D72178
2020-02-27 10:29:01 -05:00
..
AliasAnalysis.cpp [IR] Lazily number instructions for local dominance queries 2020-02-18 14:44:24 -08:00
AliasAnalysisEvaluator.cpp
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
Analysis.cpp
AssumptionCache.cpp
BasicAliasAnalysis.cpp [BasicAA] Make BasicAA a cfg pass. 2020-02-11 11:30:08 -08:00
BlockFrequencyInfo.cpp
BlockFrequencyInfoImpl.cpp [BFI] Add a debug check for unknown block queries. 2020-02-04 10:05:28 -08:00
BranchProbabilityInfo.cpp
CallGraph.cpp Introduce a CallGraph updater helper class 2020-02-08 14:16:48 -06:00
CallGraphSCCPass.cpp Introduce a CallGraph updater helper class 2020-02-08 14:16:48 -06:00
CallPrinter.cpp
CaptureTracking.cpp [IR] Lazily number instructions for local dominance queries 2020-02-18 14:44:24 -08:00
CFG.cpp
CFGPrinter.cpp Flags for displaying only hot nodes in CFGPrinter graph 2020-02-21 17:20:00 -08:00
CFLAndersAliasAnalysis.cpp
CFLGraph.h
CFLSteensAliasAnalysis.cpp
CGSCCPassManager.cpp Add PassManagerImpl.h to hide implementation details 2020-02-03 11:15:55 -08:00
CMakeLists.txt [IR] Lazily number instructions for local dominance queries 2020-02-18 14:44:24 -08:00
CmpInstAnalysis.cpp
CodeMetrics.cpp
ConstantFolding.cpp [AMDGPU][ConstantFolding] Fold llvm.amdgcn.fract intrinsic 2020-02-27 14:37:53 +00:00
CostModel.cpp
DDG.cpp [DDG] Data Dependence Graph - Graph Simplification 2020-02-19 13:41:51 -05:00
Delinearization.cpp
DemandedBits.cpp
DependenceAnalysis.cpp [DA] Delinearization of fixed-size multi-dimensional arrays 2020-02-27 10:29:01 -05:00
DependenceGraphBuilder.cpp [DDG] Data Dependence Graph - Graph Simplification 2020-02-19 13:41:51 -05:00
DivergenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp
DomTreeUpdater.cpp
EHPersonalities.cpp
GlobalsModRef.cpp
GuardUtils.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
IndirectCallPromotionAnalysis.cpp
InlineCost.cpp Cost Annotation Writer for InlineCost 2020-02-26 17:03:52 -08:00
InstCount.cpp
InstructionPrecedenceTracking.cpp [IR] Lazily number instructions for local dominance queries 2020-02-18 14:44:24 -08:00
InstructionSimplify.cpp Reapply: [SVE] Fix bug in simplification of scalable vector instructions 2020-02-05 10:00:09 -08:00
Interval.cpp
IntervalPartition.cpp
IVDescriptors.cpp
IVUsers.cpp
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp [LazyCallGraph] Fix ambiguous index value 2020-02-18 23:32:55 -05:00
LazyValueInfo.cpp
LegacyDivergenceAnalysis.cpp
Lint.cpp
LLVMBuild.txt
Loads.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
LoopAccessAnalysis.cpp
LoopAnalysisManager.cpp Add PassManagerImpl.h to hide implementation details 2020-02-03 11:15:55 -08:00
LoopCacheAnalysis.cpp [LoopCacheAnalysis]: Add support for negative stride 2020-02-10 13:22:35 -05:00
LoopInfo.cpp
LoopPass.cpp
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp [DependenceAnalysis] Memory dependence analysis internal caching mechanism is broken in presence of TBAA (PR42733). 2020-02-21 20:20:36 +07:00
MemoryLocation.cpp
MemorySSA.cpp [MemorySSA] Don't verify MemorySSA unless VerifyMemorySSA enabled 2020-02-13 18:46:58 +01:00
MemorySSAUpdater.cpp
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
MustExecute.cpp [MustExecute] Add backward exploration for must-be-executed-context 2020-02-20 14:49:30 +09:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp
OptimizationRemarkEmitter.cpp Compute ORE, BPI, BFI in Loop passes. 2020-02-12 09:15:18 -08:00
OrderedInstructions.cpp [IR] Lazily number instructions for local dominance queries 2020-02-18 14:44:24 -08:00
PHITransAddr.cpp
PhiValues.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp [NFC] [DA] Refactoring getIndexExpressionsFromGEP 2020-02-24 17:32:30 -05:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp [SCEV][IndVars] Always provide insertion point to the SCEVExpander::isHighCostExpansion() 2020-02-25 23:05:59 +03:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp
StackSafetyAnalysis.cpp
StratifiedSets.h
SyncDependenceAnalysis.cpp
SyntheticCountsUtils.cpp
TargetLibraryInfo.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
TargetTransformInfo.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
Trace.cpp
TypeBasedAliasAnalysis.cpp
TypeMetadataUtils.cpp
ValueLattice.cpp
ValueLatticeUtils.cpp
ValueTracking.cpp [ValueTracking] Improve isKnownNonNaN() to recognize zero splats. 2020-02-19 09:35:36 -08:00
VectorUtils.cpp [VectorUtils] Accept IRBuilderBase; NFC 2020-02-18 18:02:04 +01:00
VFABIDemangling.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))

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