llvm-6502/lib/Analysis
Chandler Carruth e3a8e534e1 [LCG] Re-organize the methods for mutating a call graph to make their
API requirements much more obvious.

The key here is that there are two totally different use cases for
mutating the graph. Prior to doing any SCC formation, it is very easy to
mutate the graph. There may be users that want to do small tweaks here,
and then use the already-built graph for their SCC-based operations.
This method remains on the graph itself and is documented carefully as
being cheap but unavailable once SCCs are formed.

Once SCCs are formed, and there is some in-flight DFS building them, we
have to be much more careful in how we mutate the graph. These mutation
operations are sunk onto the SCCs themselves, which both simplifies
things (the code was already there!) and helps make it obvious that
these interfaces are only applicable within that context. The other
primary constraint is that the edge being mutated is actually related to
the SCC on which we call the method. This helps make it obvious that you
cannot arbitrarily mutate some other SCC.

I've tried to write much more complete documentation for the interesting
mutation API -- intra-SCC edge removal. Currently one aspect of this
documentation is a lie (the result list of SCCs) but we also don't even
have tests for that API. =[ I'm going to add tests and fix it to match
the documentation next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207339 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-27 01:59:50 +00:00
..
IPA SCC: Change clients to use const, NFC 2014-04-25 18:24:50 +00:00
AliasAnalysis.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
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 [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-05 07:30:04 +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 [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
Analysis.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
BasicAliasAnalysis.cpp Remove a couple of redundant copies of SmallVector::operator==. 2014-04-18 19:48:03 +00:00
BlockFrequencyInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
BlockFrequencyInfoImpl.cpp Revert "blockfreq: Approximate irreducible control flow" 2014-04-25 23:16:58 +00:00
BranchProbabilityInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
CaptureTracking.cpp [C++11] Add range based accessors for the Use-Def chain of a Value. 2014-03-09 03:16:01 +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 [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
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 Reapply "blockfreq: Rewrite BlockFrequencyInfoImpl" 2014-04-21 17:57:07 +00:00
CodeMetrics.cpp Consistent use of the noduplicate attribute. 2014-03-17 16:19:07 +00:00
ConstantFolding.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
CostModel.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
Delinearization.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
DependenceAnalysis.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
DominanceFrontier.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
DomPrinter.cpp
InstCount.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
InstructionSimplify.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
Interval.cpp [Modules] Move CFG.h to the IR library as it defines graph traits over 2014-03-04 11:45:46 +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 [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
LazyCallGraph.cpp [LCG] Re-organize the methods for mutating a call graph to make their 2014-04-27 01:59:50 +00:00
LazyValueInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +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 [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
LLVMBuild.txt
Loads.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
LoopInfo.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
LoopPass.cpp [Modules] Make Support/Debug.h modular. This requires it to not change 2014-04-21 22:55:11 +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 [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
ModuleDebugInfoPrinter.cpp [C++11] Change DebugInfoFinder to use range-based loops 2014-03-18 09:41:07 +00:00
NoAliasAnalysis.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
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 [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
RegionPass.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
RegionPrinter.cpp Use unique_ptr to manage ownership of child Regions within llvm::Region 2014-04-15 18:32:43 +00:00
ScalarEvolution.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
ScalarEvolutionAliasAnalysis.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
ScalarEvolutionExpander.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
ScalarEvolutionNormalization.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
SparsePropagation.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
TargetTransformInfo.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:48:03 +00:00
Trace.cpp
TypeBasedAliasAnalysis.cpp remove some dead code 2014-04-17 22:26:44 +00:00
ValueTracking.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

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))

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