llvm-6502/lib/Analysis
Benjamin Kramer e749325463 [CallSite] Make construction from Value* (or Instruction*) explicit.
CallSite roughly behaves as a common base CallInst and InvokeInst. Bring
the behavior closer to that model by making upcasts explicit. Downcasts
remain implicit and work as before.

Following dyn_cast as a mental model checking whether a Value *V isa
CallSite now looks like this: 
  if (auto CS = CallSite(V)) // think dyn_cast
instead of:
  if (CallSite CS = V)

This is an extra token but I think it is slightly clearer. Making the
ctor explicit has the advantage of not accidentally creating nullptr
CallSites, e.g. when you pass a Value * to a function taking a CallSite
argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234601 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 14:50:08 +00:00
..
IPA [CallSite] Make construction from Value* (or Instruction*) explicit. 2015-04-10 14:50:08 +00:00
AliasAnalysis.cpp
AliasAnalysisCounter.cpp
AliasAnalysisEvaluator.cpp [CallSite] Make construction from Value* (or Instruction*) explicit. 2015-04-10 14:50:08 +00:00
AliasDebugger.cpp
AliasSetTracker.cpp [CallSite] Make construction from Value* (or Instruction*) explicit. 2015-04-10 14:50:08 +00:00
Analysis.cpp Divergence analysis for GPU programs 2015-04-10 05:03:50 +00:00
AssumptionCache.cpp
BasicAliasAnalysis.cpp [opaque pointer type] Change GetElementPtrInst::getIndexedType to take the pointee type 2015-03-30 21:41:43 +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 Purge unused includes throughout libSupport. 2015-03-23 18:07:13 +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 Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used. 2015-03-23 19:32:43 +00:00
CGSCCPassManager.cpp
CMakeLists.txt Divergence analysis for GPU programs 2015-04-10 05:03:50 +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 [opaque pointer type] API migration for GEP constant factories 2015-04-02 18:55:32 +00:00
CostModel.cpp
Delinearization.cpp
DependenceAnalysis.cpp
DivergenceAnalysis.cpp Divergence analysis for GPU programs 2015-04-10 05:03:50 +00:00
DominanceFrontier.cpp
DomPrinter.cpp
InstCount.cpp
InstructionSimplify.cpp [opaque pointer type] API migration for GEP constant factories 2015-04-02 18:55:32 +00:00
Interval.cpp
IntervalPartition.cpp
IVUsers.cpp
LazyCallGraph.cpp
LazyValueInfo.cpp [ConstantRange] Split makeICmpRegion in two. 2015-03-18 00:41:24 +00:00
LibCallAliasAnalysis.cpp
LibCallSemantics.cpp
Lint.cpp Fix doxygen comments from r232268 2015-03-16 17:49:03 +00:00
LLVMBuild.txt
Loads.cpp
LoopAccessAnalysis.cpp [LoopAccesses] Allow analysis to complete in the presence of uniform stores 2015-04-08 17:48:40 +00:00
LoopInfo.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
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
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp [CallSite] Make construction from Value* (or Instruction*) explicit. 2015-04-10 14:50:08 +00:00
ModuleDebugInfoPrinter.cpp Transforms: Stop using DIDescriptor::is*() and auto-casting 2015-04-06 23:27:00 +00:00
NoAliasAnalysis.cpp
PHITransAddr.cpp [opaque pointer type] more gep API migration 2015-03-14 19:53:33 +00:00
PostDominators.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.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
RegionPrinter.cpp
ScalarEvolution.cpp [opaque pointer type] API migration for GEP constant factories 2015-04-02 18:55:32 +00:00
ScalarEvolutionAliasAnalysis.cpp
ScalarEvolutionExpander.cpp [opaque pointer type] More GEP API migrations in IRBuilder uses 2015-04-03 19:41:44 +00:00
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp
SparsePropagation.cpp
StratifiedSets.h
TargetLibraryInfo.cpp [WinEH] Run cleanup handlers when an exception is thrown 2015-03-30 22:58:10 +00:00
TargetTransformInfo.cpp Divergence analysis for GPU programs 2015-04-10 05:03:50 +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 [CallSite] Make construction from Value* (or Instruction*) explicit. 2015-04-10 14:50:08 +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))

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