llvm-6502/lib/Analysis
Sebastian Pop 5026b2cc8b split delinearization pass in 3 steps
To compute the dimensions of the array in a unique way, we split the
delinearization analysis in three steps:

- find parametric terms in all memory access functions
- compute the array dimensions from the set of terms
- compute the delinearized access functions for each dimension

The first step is executed on all the memory access functions such that we
gather all the patterns in which an array is accessed. The second step reduces
all this information in a unique description of the sizes of the array. The
third step is delinearizing each memory access function following the common
description of the shape of the array computed in step 2.

This rewrite of the delinearization pass also solves a problem we had with the
previous implementation: because the previous algorithm was by induction on the
structure of the SCEV, it would not correctly recognize the shape of the array
when the memory access was not following the nesting of the loops: for example,
see polly/test/ScopInfo/multidim_only_ivs_3d_reverse.ll

; void foo(long n, long m, long o, double A[n][m][o]) {
;
;   for (long i = 0; i < n; i++)
;     for (long j = 0; j < m; j++)
;       for (long k = 0; k < o; k++)
;         A[i][k][j] = 1.0;

Starting with this patch we no longer delinearize access functions that do not
contain parameters, for example in test/Analysis/DependenceAnalysis/GCD.ll

;;  for (long int i = 0; i < 100; i++)
;;    for (long int j = 0; j < 100; j++) {
;;      A[2*i - 4*j] = i;
;;      *B++ = A[6*i + 8*j];

these accesses will not be delinearized as the upper bound of the loops are
constants, and their access functions do not contain SCEVUnknown parameters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208232 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 18:01:20 +00:00
..
IPA [inliner] Significantly improve the compile time in cases like PR19499 2014-04-28 08:52:44 +00:00
AliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
AliasAnalysisCounter.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
AliasAnalysisEvaluator.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 07:30:04 +00:00
AliasDebugger.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 07:30:04 +00:00
AliasSetTracker.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
Analysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
BasicAliasAnalysis.cpp Remove a couple of redundant copies of SmallVector::operator==. 2014-04-18 19:48:03 +00:00
BlockFrequencyInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
BlockFrequencyInfoImpl.cpp blockfreq: Move include to .cpp 2014-05-06 01:57:42 +00:00
BranchProbabilityInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
CaptureTracking.cpp [C++11] Add range based accessors for the Use-Def chain of a Value. 2014-03-09 03:16:01 +00:00
CFG.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
CFGPrinter.cpp raw_ostream: Forward declare OpenFlags and include FileSystem.h only where necessary. 2014-04-29 23:26:49 +00:00
CGSCCPassManager.cpp [PM] Add a new-PM-style CGSCC pass manager using the newly added 2014-04-21 11:12:00 +00:00
CMakeLists.txt Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl" 2014-04-21 17:57:07 +00:00
CodeMetrics.cpp Consistent use of the noduplicate attribute. 2014-03-17 16:19:07 +00:00
ConstantFolding.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
CostModel.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
Delinearization.cpp split delinearization pass in 3 steps 2014-05-07 18:01:20 +00:00
DependenceAnalysis.cpp split delinearization pass in 3 steps 2014-05-07 18:01:20 +00:00
DominanceFrontier.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
DomPrinter.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
InstCount.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
InstructionSimplify.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
Interval.cpp [Modules] Move CFG.h to the IR library as it defines graph traits over 2014-03-04 11:45:46 +00:00
IntervalPartition.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
IVUsers.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
LazyCallGraph.cpp [LCG] Add the last (and most complex) of the edge insertion mutation 2014-05-04 09:38:32 +00:00
LazyValueInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
LibCallAliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LibCallSemantics.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
Lint.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LLVMBuild.txt
Loads.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LoopInfo.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LoopPass.cpp [Modules] Make Support/Debug.h modular. This requires it to not change 2014-04-21 22:55:11 +00:00
Makefile
MemDepPrinter.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
MemoryBuiltins.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
MemoryDependenceAnalysis.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
ModuleDebugInfoPrinter.cpp [C++11] Change DebugInfoFinder to use range-based loops 2014-03-18 09:41:07 +00:00
NoAliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
PHITransAddr.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
PostDominators.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
PtrUseVisitor.cpp [C++11] Add range based accessors for the Use-Def chain of a Value. 2014-03-09 03:16:01 +00:00
README.txt
RegionInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
RegionPass.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
RegionPrinter.cpp Use unique_ptr to manage ownership of child Regions within llvm::Region 2014-04-15 18:32:43 +00:00
ScalarEvolution.cpp split delinearization pass in 3 steps 2014-05-07 18:01:20 +00:00
ScalarEvolutionAliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
ScalarEvolutionExpander.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
ScalarEvolutionNormalization.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
SparsePropagation.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
TargetTransformInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
Trace.cpp Put the functionality for printing a value to a raw_ostream as an 2014-01-09 02:29:41 +00:00
TypeBasedAliasAnalysis.cpp [TBAA] Fix handling of mixed TBAA (path-aware and non-path-aware TBAA). 2014-05-03 22:32:52 +00:00
ValueTracking.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +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))

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