llvm-6502/lib/Analysis
Bjorn Steinbrink 53a7b568b2 Fix a crash in the assumption cache when inlining indirect function calls
Summary:
Instances of the AssumptionCache are per function, so we can't re-use
the same AssumptionCache instance when recursing in the CallAnalyzer to
analyze a different function. Instead we have to pass the
AssumptionCacheTracker to the CallAnalyzer so it can get the right
AssumptionCache on demand.

Reviewers: hfinkel

Subscribers: llvm-commits, hans

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228957 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-12 21:04:22 +00:00
..
IPA Fix a crash in the assumption cache when inlining indirect function calls 2015-02-12 21:04:22 +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
Delinearization.cpp
DependenceAnalysis.cpp
DominanceFrontier.cpp
DomPrinter.cpp
InstCount.cpp
InstructionSimplify.cpp [InstSimplify] Add SimplifyFPBinOp function. 2015-02-06 20:02:51 +00:00
Interval.cpp
IntervalPartition.cpp
IVUsers.cpp
JumpInstrTableInfo.cpp
LazyCallGraph.cpp
LazyValueInfo.cpp
LibCallAliasAnalysis.cpp
LibCallSemantics.cpp Don't promote asynch EH invokes of nounwind functions to calls 2015-02-11 01:23:16 +00:00
Lint.cpp Adding support for llvm.eh.begincatch and llvm.eh.endcatch intrinsics and beginning the documentation of native Windows exception handling. 2015-02-10 19:52:43 +00:00
LLVMBuild.txt
Loads.cpp
LoopAccessAnalysis.cpp [LV] Move addRuntimeCheck to LoopAccessAnalysis 2015-02-06 18:31:04 +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 Whitespace. 2015-02-06 14:14:41 +00:00
ModuleDebugInfoPrinter.cpp
NoAliasAnalysis.cpp
PHITransAddr.cpp
PostDominators.cpp
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ScalarEvolution.cpp Bugfix: SCEV incorrectly marks certain add recurrences as nsw 2015-02-09 18:34:55 +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))

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