llvm-6502/lib/Analysis
Adam Nemet 718b023033 [LoopAccesses] Create the analysis pass
This is a function pass that runs the analysis on demand.  The analysis
can be initiated by querying the loop access info via LAA::getInfo.  It
either returns the cached info or runs the analysis.

Symbolic stride information continues to reside outside of this analysis
pass. We may move it inside later but it's not a priority for me right
now.  The idea is that Loop Distribution won't support run-time stride
checking at least initially.

This means that when querying the analysis, symbolic stride information
can be provided optionally.  Whether stride information is used can
invalidate the cache entry and rerun the analysis.  Note that if the
loop does not have any symbolic stride, the entry should be preserved
across Loop Distribution and LV.

Since currently the only user of the pass is LV, I just check that the
symbolic stride information didn't change when using a cached result.

On the LV side, LoopVectorizationLegality requests the info object
corresponding to the loop from the analysis pass.  A large chunk of the
diff is due to LAI becoming a pointer from a reference.

A test will be added as part of the -analyze patch.

Also tested that with AVX, we generate identical assembly output for the
testsuite (including the external testsuite) before and after.

This is part of the patchset that converts LoopAccessAnalysis into an
actual analysis pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229626 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-18 03:43:24 +00:00
..
IPA Analysis: Canonicalize access to function attributes, NFC 2015-02-14 00:12:15 +00:00
AliasAnalysis.cpp
AliasAnalysisCounter.cpp
AliasAnalysisEvaluator.cpp
AliasDebugger.cpp
AliasSetTracker.cpp
Analysis.cpp Introduce print-memderefs to test isDereferenceablePointer 2015-02-06 01:46:42 +00:00
AssumptionCache.cpp
BasicAliasAnalysis.cpp [BasicAA] Try to disambiguate GEPs through arrays of structs into 2015-02-07 17:04:29 +00:00
BlockFrequencyInfo.cpp
BlockFrequencyInfoImpl.cpp
BranchProbabilityInfo.cpp
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp
CFLAliasAnalysis.cpp Fixed a bug where CFLAA would crash the compiler. 2015-02-12 03:07:07 +00:00
CGSCCPassManager.cpp
CMakeLists.txt Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects. 2015-02-11 03:28:02 +00:00
CodeMetrics.cpp
ConstantFolding.cpp
CostModel.cpp [multiversion] Thread a function argument through all the callers of the 2015-02-01 12:01:35 +00:00
Delinearization.cpp
DependenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp
InstCount.cpp
InstructionSimplify.cpp InstCombine: cleanup redundant dyn_cast<> (NFC) 2015-02-13 07:38:04 +00:00
Interval.cpp
IntervalPartition.cpp
IVUsers.cpp
JumpInstrTableInfo.cpp
LazyCallGraph.cpp
LazyValueInfo.cpp
LibCallAliasAnalysis.cpp
LibCallSemantics.cpp Unify the two EH personality classification routines I wrote 2015-02-14 00:21:02 +00:00
Lint.cpp [PM] Remove the old 'PassManager.h' header file at the top level of 2015-02-13 10:01:29 +00:00
LLVMBuild.txt
Loads.cpp
LoopAccessAnalysis.cpp [LoopAccesses] Create the analysis pass 2015-02-18 03:43:24 +00:00
LoopInfo.cpp
LoopPass.cpp
Makefile
MemDepPrinter.cpp MemDepPrinter: cleanup a few loops (NFC) 2015-02-09 19:49:54 +00:00
MemDerefPrinter.cpp MemDerefPrinter: Require DataLayoutPass for higher accuracy 2015-02-09 21:50:03 +00:00
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp Revert 229175 2015-02-15 19:07:31 +00:00
ModuleDebugInfoPrinter.cpp
NoAliasAnalysis.cpp
PHITransAddr.cpp
PostDominators.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp Generalize getExtendAddRecStart to work with both sign and zero 2015-02-18 01:47:07 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp
SparsePropagation.cpp
StratifiedSets.h
TargetLibraryInfo.cpp
TargetTransformInfo.cpp Value soft float calls as more expensive in the inliner. 2015-02-05 02:09:33 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp Correctly combine alias.scope metadata by a union instead of intersecting 2015-02-08 17:07:14 +00:00
ValueTracking.cpp ValueTracking: Make isBytewiseValue simpler and more powerful at the same time. 2015-02-07 19:29:02 +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))

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