llvm-6502/lib/Analysis
Alexey Samsonov 881c8e0c9a [GVN] Set proper debug locations for some instructions created by GVN.
Determining proper debug locations for instructions created in
PHITransAddr is tricky. We use a simple approach here and simply copy
debug locations from instructions computing load address to
"corresponding" instructions re-creating the address computation
in predecessor basic blocks.

This may not always be correct, given all the rearrangement and
simplification going on, and debug locations may jump around a lot,
as the basic blocks we copy locations between may be very far from
each other.

Still, this would work good in most simple cases (e.g. when chain
of address computing instruction is short, or our mapping turns out
to be 1-to-1), and we desire to have *some* reasonable debug locations
associated with newly inserted instructions.

See http://reviews.llvm.org/D10351 review thread for more details.

Test Plan: regression test suite

Reviewers: spatel, dblaikie

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10351

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-10 17:37:38 +00:00
..
IPA [inliner] Fix the early-exit of the inline cost analysis to correctly 2015-05-27 02:49:05 +00:00
AliasAnalysis.cpp [PM/AA] Start refactoring AliasAnalysis to remove the analysis group and 2015-06-04 02:03:15 +00:00
AliasAnalysisCounter.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
AliasAnalysisEvaluator.cpp [PM/AA] Start refactoring AliasAnalysis to remove the analysis group and 2015-06-04 02:03:15 +00:00
AliasDebugger.cpp Make DataLayout Non-Optional in the Module 2015-03-04 18:43:29 +00:00
AliasSetTracker.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:43:39 +00:00
Analysis.cpp Divergence analysis for GPU programs 2015-04-10 05:03:50 +00:00
AssumptionCache.cpp
BasicAliasAnalysis.cpp Revert r236894 "[BasicAA] Fix zext & sext handling" 2015-05-22 01:27:37 +00:00
BlockFrequencyInfo.cpp Remove superfluous .str() and replace std::string concatenation with Twine. 2015-03-27 17:51:30 +00:00
BlockFrequencyInfoImpl.cpp Remove 4,096 loop scale limitation. 2015-04-01 17:42:27 +00:00
BranchProbabilityInfo.cpp Add BranchProbabilityInfo::releaseMemory to clear the Weights field. 2015-05-28 19:43:06 +00:00
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp Remove superfluous .str() and replace std::string concatenation with Twine. 2015-03-27 17:51:30 +00:00
CFLAliasAnalysis.cpp Convert PHI getIncomingValue() to foreach over incoming_values(). NFC. 2015-05-12 20:05:31 +00:00
CGSCCPassManager.cpp
CMakeLists.txt [PM/AA] Start refactoring AliasAnalysis to remove the analysis group and 2015-06-04 02:03:15 +00:00
CodeMetrics.cpp Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used. 2015-03-23 19:32:43 +00:00
ConstantFolding.cpp [ConstantFolding] Fix wrong folding of intrinsic 'convert.from.fp16'. 2015-05-14 18:01:48 +00:00
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 [DependenceAnalysis] Extend unifySubscriptType for handling coupled subscript groups. 2015-05-29 16:58:08 +00:00
DivergenceAnalysis.cpp Divergence analysis for GPU programs 2015-04-10 05:03:50 +00:00
DominanceFrontier.cpp
DomPrinter.cpp
InstCount.cpp
InstructionSimplify.cpp [InstCombine, InstSimplify] Move xforms from Combine to Simplify 2015-06-06 22:40:21 +00:00
Interval.cpp
IntervalPartition.cpp
IteratedDominanceFrontier.cpp Move IDF Calculation to a separate file, expose an interface to it. 2015-04-21 19:13:02 +00:00
IVUsers.cpp DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
LazyCallGraph.cpp
LazyValueInfo.cpp [ConstantRange] Split makeICmpRegion in two. 2015-03-18 00:41:24 +00:00
LibCallAliasAnalysis.cpp Make DataLayout Non-Optional in the Module 2015-03-04 18:43:29 +00:00
LibCallSemantics.cpp [WinEH] Start EH preparation for 32-bit x86, it uses no arguments 2015-04-29 22:49:54 +00:00
Lint.cpp Fix doxygen comments from r232268 2015-03-16 17:49:03 +00:00
LLVMBuild.txt
Loads.cpp DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
LoopAccessAnalysis.cpp [LAA] Fix estimation of number of memchecks 2015-06-08 10:27:06 +00:00
LoopInfo.cpp Add llvm::all_of which wraps std::all_of. 2015-05-13 22:19:13 +00:00
LoopPass.cpp Purge unused includes throughout libSupport. 2015-03-23 18:07:13 +00:00
Makefile
MemDepPrinter.cpp [CallSite] Make construction from Value* (or Instruction*) explicit. 2015-04-10 14:50:08 +00:00
MemDerefPrinter.cpp Test commit. Fix typo in MemDerefPrinter.cpp comment. 2015-05-21 11:57:38 +00:00
MemoryBuiltins.cpp DataLayout is mandatory, update the API to reflect it with references. 2015-03-10 02:37:25 +00:00
MemoryDependenceAnalysis.cpp [PM/AA] Start refactoring AliasAnalysis to remove the analysis group and 2015-06-04 02:03:15 +00:00
MemoryLocation.cpp [PM/AA] Start refactoring AliasAnalysis to remove the analysis group and 2015-06-04 02:03:15 +00:00
ModuleDebugInfoPrinter.cpp IR: Give 'DI' prefix to debug info metadata 2015-04-29 16:38:44 +00:00
NoAliasAnalysis.cpp Make DataLayout Non-Optional in the Module 2015-03-04 18:43:29 +00:00
PHITransAddr.cpp [GVN] Set proper debug locations for some instructions created by GVN. 2015-06-10 17:37:38 +00:00
PostDominators.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp Change range-based for-loops to be -Wrange-loop-analysis clean. 2015-04-15 01:21:15 +00:00
RegionPrinter.cpp One more -Wrange-loop-analysis cleanup. 2015-04-15 21:40:50 +00:00
ScalarEvolution.cpp [ScalarEvolution] refactor: extract interface getGEPExpr 2015-05-18 17:03:25 +00:00
ScalarEvolutionAliasAnalysis.cpp Make DataLayout Non-Optional in the Module 2015-03-04 18:43:29 +00:00
ScalarEvolutionExpander.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:43:39 +00:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp Make DataLayout Non-Optional in the Module 2015-03-04 18:43:29 +00:00
SparsePropagation.cpp
StratifiedSets.h
TargetLibraryInfo.cpp Populate list of vectorizable functions for Accelerate library. 2015-05-07 17:11:51 +00:00
TargetTransformInfo.cpp [LoopVectorize] Teach Loop Vectorizor about interleaved memory accesses. 2015-06-08 06:39:56 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp Teach TBAA analysis to report errors on cyclic TBAA metadata rather than hanging. 2015-03-13 07:09:33 +00:00
ValueTracking.cpp Minor refactoring of GEP handling in isDereferenceablePointer 2015-06-08 11:58:13 +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))

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