llvm-6502/lib/Analysis
Hal Finkel bf301d5670 Add a CFL Alias Analysis implementation
This provides an implementation of CFL alias analysis (including some
supporting data structures). Currently, we don't have any extremely fancy
features, sans some interprocedural analysis (i.e. no field sensitivity, etc.),
and we do best sitting behind BasicAA + TBAA. In such a configuration, we take
~0.6-0.8% of total compile time, and give ~7-8% NoAlias responses to queries
TBAA and BasicAA couldn't answer when bootstrapping LLVM. In testing this on
other projects, we've seen up to 10.5% of queries dropped by BasicAA+TBAA
answered with NoAlias by this algorithm.

Patch by George Burgess IV (with minor modifications by me -- mostly adapting
some BasicAA tests), thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216970 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 21:43:13 +00:00
..
IPA Remove Support/IncludeFile.h and its only user. This is actively harmful, since 2014-08-07 20:41:17 +00:00
AliasAnalysis.cpp AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
AliasAnalysisCounter.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
AliasAnalysisEvaluator.cpp AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
AliasDebugger.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 07:30:04 +00:00
AliasSetTracker.cpp AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
Analysis.cpp Add a CFL Alias Analysis implementation 2014-09-02 21:43:13 +00:00
BasicAliasAnalysis.cpp Use range based for loops to avoid needing to re-mention SmallPtrSet size. 2014-08-24 23:23:06 +00:00
BlockFrequencyInfo.cpp Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
BlockFrequencyInfoImpl.cpp BFI: Add constructor for Weight 2014-07-12 00:26:00 +00:00
BranchProbabilityInfo.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
CaptureTracking.cpp Match semantics of PointerMayBeCapturedBefore to its name by default 2014-07-21 21:30:22 +00:00
CFG.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
CFGPrinter.cpp Modernize raw_fd_ostream's constructor a bit. 2014-08-25 18:16:47 +00:00
CFLAliasAnalysis.cpp Add a CFL Alias Analysis implementation 2014-09-02 21:43:13 +00:00
CGSCCPassManager.cpp [PM] Add a new-PM-style CGSCC pass manager using the newly added 2014-04-21 11:12:00 +00:00
CMakeLists.txt Add a CFL Alias Analysis implementation 2014-09-02 21:43:13 +00:00
CodeMetrics.cpp Consistent use of the noduplicate attribute. 2014-03-17 16:19:07 +00:00
ConstantFolding.cpp Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size. 2014-08-21 05:55:13 +00:00
CostModel.cpp [CostModel][x86] Improved cost model for alternate shuffles. 2014-07-03 22:24:18 +00:00
Delinearization.cpp remove BasePointer before delinearizing 2014-05-27 22:41:51 +00:00
DependenceAnalysis.cpp Analysis: cleanup 2014-08-26 02:03:40 +00:00
DominanceFrontier.cpp Templatify DominanceFrontier. 2014-07-12 21:59:52 +00:00
DomPrinter.cpp [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
InstCount.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
InstructionSimplify.cpp InstSimplify: Move a transform from InstCombine to InstSimplify 2014-08-28 03:34:28 +00:00
Interval.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
IntervalPartition.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
IVUsers.cpp Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size. 2014-08-21 05:55:13 +00:00
JumpInstrTableInfo.cpp Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute. 2014-06-05 19:29:43 +00:00
LazyCallGraph.cpp Fix typos 2014-05-15 01:52:21 +00:00
LazyValueInfo.cpp In LVI(Lazy Value Info), originally value on a BB can only be caculated once, 2014-08-11 05:02:04 +00:00
LibCallAliasAnalysis.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
LibCallSemantics.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
Lint.cpp Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size. 2014-08-21 05:55:13 +00:00
LLVMBuild.txt
Loads.cpp AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
LoopInfo.cpp Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges." 2014-07-21 17:06:51 +00:00
LoopPass.cpp Add back functionality removed in r210497. 2014-06-21 02:43:02 +00:00
Makefile
MemDepPrinter.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
MemoryBuiltins.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
MemoryDependenceAnalysis.cpp Fix MemoryDependenceAnalysis in cases where QueryInstr is a CmpXchg or a AtomicRMW 2014-09-02 20:17:52 +00:00
ModuleDebugInfoPrinter.cpp [C++11] Change DebugInfoFinder to use range-based loops 2014-03-18 09:41:07 +00:00
NoAliasAnalysis.cpp Improve BasicAA CS-CS queries (redux) 2014-07-17 01:28:25 +00:00
PHITransAddr.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 04:59:12 +00:00
PostDominators.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
PtrUseVisitor.cpp [C++11] Add range based accessors for the Use-Def chain of a Value. 2014-03-09 03:16:01 +00:00
README.txt
RegionInfo.cpp Fix msc17 build. RegionInfo::RegionInfo::recalculate() doesn't make sense. 2014-07-20 03:57:51 +00:00
RegionPass.cpp Templatify RegionInfo so it works on MachineBasicBlocks 2014-07-19 18:29:29 +00:00
RegionPrinter.cpp Templatify RegionInfo so it works on MachineBasicBlocks 2014-07-19 18:29:29 +00:00
ScalarEvolution.cpp Remove an errant outer loop that contains nothing but an inner loop over exactly the same elements. While no functionality is change intended (and hence there are no changes to tests), you don't want to skip this revision if bisecting for errors. 2014-09-01 05:17:15 +00:00
ScalarEvolutionAliasAnalysis.cpp AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
ScalarEvolutionExpander.cpp Fix ScalarEvolutionExpander when creating a PHI in a block with duplicate predecessors 2014-07-31 19:13:38 +00:00
ScalarEvolutionNormalization.cpp Fix typos in comments, NFC 2014-08-29 21:53:01 +00:00
ScopedNoAliasAA.cpp Simplify and improve scoped-noalias metadata semantics 2014-07-25 15:50:02 +00:00
SparsePropagation.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
StratifiedSets.h Add a CFL Alias Analysis implementation 2014-09-02 21:43:13 +00:00
TargetTransformInfo.cpp Remove 'virtual' keyword from methods markedwith 'override' keyword. 2014-08-30 16:48:34 +00:00
Trace.cpp Put the functionality for printing a value to a raw_ostream as an 2014-01-09 02:29:41 +00:00
TypeBasedAliasAnalysis.cpp Add scoped-noalias metadata 2014-07-24 14:25:39 +00:00
ValueTracking.cpp Make fabs safe to speculatively execute 2014-08-29 16:01:17 +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))

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