llvm-6502/include/llvm/Analysis
Adam Nemet 50b9e7f7d4 [getUnderlyingOjbects] Analyze loop PHIs further to remove false positives
Specifically, if a pointer accesses different underlying objects in each
iteration, don't look through the phi node defining the pointer.

The motivating case is the underlyling-objects-2.ll testcase.  Consider
the loop nest:

  int **A;
  for (i)
    for (j)
       A[i][j] = A[i-1][j] * B[j]

This loop is transformed by Load-PRE to stash away A[i] for the next
iteration of the outer loop:

  Curr = A[0];          // Prev_0
  for (i: 1..N) {
    Prev = Curr;        // Prev = PHI (Prev_0, Curr)
    Curr = A[i];
    for (j: 0..N)
       Curr[j] = Prev[j] * B[j]
  }

Since A[i] and A[i-1] are likely to be independent pointers,
getUnderlyingObjects should not assume that Curr and Prev share the same
underlying object in the inner loop.

If it did we would try to dependence-analyze Curr and Prev and the
analysis of the corresponding SCEVs would fail with non-constant
distance.

To fix this, the getUnderlyingObjects API is extended with an optional
LoopInfo parameter.  This is effectively what controls whether we want
the above behavior or the original.  Currently, I only changed to use
this approach for LoopAccessAnalysis.

The other testcase is to guard the opposite case where we do want to
look through the loop PHI.  If we step through an array by incrementing
a pointer, the underlying object is the incoming value of the phi as the
loop is entered.

Fixes rdar://problem/19566729

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235634 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-23 20:09:20 +00:00
..
AliasAnalysis.h Add new getModRefInfo API to determine whether an Instruction and a call modify the same memory 2015-04-13 23:25:41 +00:00
AliasSetTracker.h
AssumptionCache.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
BlockFrequencyInfo.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
BlockFrequencyInfoImpl.h Remove 4,096 loop scale limitation. 2015-04-01 17:42:27 +00:00
BranchProbabilityInfo.h
CallGraph.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
CallGraphSCCPass.h
CallPrinter.h
CaptureTracking.h
CFG.h
CFGPrinter.h
CGSCCPassManager.h
CodeMetrics.h
ConstantFolding.h DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
DependenceAnalysis.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
DominanceFrontier.h
DominanceFrontierImpl.h Fix ODR violations caused by putting anonymous namespaces in header files (and 2015-03-17 02:36:51 +00:00
DomPrinter.h
DOTGraphTraitsPass.h
InlineCost.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
InstructionSimplify.h DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
Interval.h
IntervalIterator.h Remove use of reserved identifier 2015-03-15 01:37:01 +00:00
IntervalPartition.h
IteratedDominanceFrontier.h Move IDF Calculation to a separate file, expose an interface to it. 2015-04-21 19:13:02 +00:00
IVUsers.h DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
JumpInstrTableInfo.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
LazyCallGraph.h
LazyValueInfo.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
LibCallAliasAnalysis.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
LibCallSemantics.h Stop calling DwarfEHPrepare from WinEHPrepare 2015-03-12 00:36:20 +00:00
Lint.h
Loads.h DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
LoopAccessAnalysis.h [getUnderlyingOjbects] Analyze loop PHIs further to remove false positives 2015-04-23 20:09:20 +00:00
LoopInfo.h Transforms: Use the new DebugLoc API, NFC 2015-03-30 19:49:49 +00:00
LoopInfoImpl.h Replace loop doing postorder walk with postorder iterator 2015-04-16 04:28:32 +00:00
LoopIterator.h
LoopPass.h
MemoryBuiltins.h DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
MemoryDependenceAnalysis.h Revamp PredIteratorCache interface to be cleaner. 2015-04-21 21:11:50 +00:00
Passes.h Divergence analysis for GPU programs 2015-04-10 05:03:50 +00:00
PHITransAddr.h DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
PostDominators.h Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
PtrUseVisitor.h
RegionInfo.h Remove empty non-virtual destructors or mark them =default when non-public 2015-04-11 15:32:26 +00:00
RegionInfoImpl.h Make it obvious that we're iterating over a range of pointers. 2015-04-16 12:43:07 +00:00
RegionIterator.h
RegionPass.h
RegionPrinter.h
ScalarEvolution.h [SCEV] Look at backedge dominating conditions (re-land r233447). 2015-04-01 18:24:06 +00:00
ScalarEvolutionExpander.h [SCEVExpander] Fix comments for functions. NFC. 2015-04-14 03:20:40 +00:00
ScalarEvolutionExpressions.h
ScalarEvolutionNormalization.h
SparsePropagation.h
TargetFolder.h [opaque pointer types] Push explicit type parameter for geps through the constant folders 2015-04-03 01:15:16 +00:00
TargetLibraryInfo.def
TargetLibraryInfo.h TLI: Add addVectorizableFunctionsFromVecLib. 2015-03-17 19:50:55 +00:00
TargetTransformInfo.h [LoopUnrollRuntime] Avoid high-cost trip count computation. 2015-04-14 03:20:38 +00:00
TargetTransformInfoImpl.h [CallSite] Make construction from Value* (or Instruction*) explicit. 2015-04-10 14:50:08 +00:00
Trace.h
ValueTracking.h [getUnderlyingOjbects] Analyze loop PHIs further to remove false positives 2015-04-23 20:09:20 +00:00