1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/lib/Analysis
bmahjour 9ac7f74e54 [DDG] Data Dependence Graph - Topological Sort
Summary:
In this patch the DDG DAG is sorted topologically to put the
nodes in the graph in the order that would satisfy all
dependencies. This helps transformations that would like to
generate code based on the DDG. Since the DDG is a DAG a
reverse-post-order traversal would give us the topological
ordering. This patch also sorts the basic blocks passed to
the builder based on program order to ensure that the
dependencies are computed in the correct direction.

Authored By: bmahjour

Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert

Reviewed By: Meinersbur

Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto, ppc-slack

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70609
2019-11-25 11:28:58 -05:00
..
AliasAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
AliasAnalysisEvaluator.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Analysis.cpp
AssumptionCache.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
BasicAliasAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
BlockFrequencyInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
BlockFrequencyInfoImpl.cpp
BranchProbabilityInfo.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
CallGraph.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CallGraphSCCPass.cpp
CallPrinter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CaptureTracking.cpp
CFG.cpp
CFGPrinter.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
CFLAndersAliasAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CFLGraph.h
CFLSteensAliasAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CGSCCPassManager.cpp
CMakeLists.txt [cmake] Explicitly mark libraries defined in lib/ as "Component Libraries" 2019-11-21 10:48:08 -08:00
CmpInstAnalysis.cpp
CodeMetrics.cpp
ConstantFolding.cpp
CostModel.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DDG.cpp [DDG] Data Dependence Graph - Topological Sort 2019-11-25 11:28:58 -05:00
Delinearization.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DemandedBits.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DependenceAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DependenceGraphBuilder.cpp [DDG] Data Dependence Graph - Topological Sort 2019-11-25 11:28:58 -05:00
DivergenceAnalysis.cpp
DominanceFrontier.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DomPrinter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DomTreeUpdater.cpp
EHPersonalities.cpp
GlobalsModRef.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
GuardUtils.cpp Slightly speculative buildbot fix for issue reported in 8293f74 commit thread 2019-11-22 11:37:17 -08:00
IndirectCallPromotionAnalysis.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
InlineCost.cpp Revert "[InlineCost] Fix infinite loop in indirect call evaluation" 2019-11-23 20:16:08 +02:00
InstCount.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
InstructionPrecedenceTracking.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
InstructionSimplify.cpp Revert 57dd4b0 "[ValueTracking] Allow context-sensitive nullness check for non-pointers" 2019-11-13 12:19:02 +01:00
Interval.cpp
IntervalPartition.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
IVDescriptors.cpp Recommit f0c2a5a "[LV] Generalize conditions for sinking instrs for first order recurrences." 2019-11-24 21:21:55 +00:00
IVUsers.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LazyBlockFrequencyInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LazyBranchProbabilityInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LazyCallGraph.cpp
LazyValueInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LegacyDivergenceAnalysis.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
Lint.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LLVMBuild.txt
Loads.cpp [InstCombine] Skip scalable vectors in combineLoadToOperationType 2019-11-12 12:27:09 +01:00
LoopAccessAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopAnalysisManager.cpp
LoopCacheAnalysis.cpp [LoopCacheAnalysis]: Fix assertion failure during cost computation 2019-11-15 14:56:26 -05:00
LoopInfo.cpp [MemorySSA] Moving at the end often means before terminator. 2019-11-20 17:11:00 -08:00
LoopPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopUnrollAnalyzer.cpp
MemDepPrinter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MemDerefPrinter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp Revert "[DependenceAnalysis] Dependecies for loads marked with "ivnariant.load" should not be shared with general accesses. Fix for https://bugs.llvm.org/show_bug.cgi?id=42151" 2019-11-21 11:40:15 +01:00
MemoryLocation.cpp
MemorySSA.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MemorySSAUpdater.cpp [MemorySSA] Moving at the end often means before terminator. 2019-11-20 17:11:00 -08:00
ModuleDebugInfoPrinter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ModuleSummaryAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MustExecute.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp
OptimizationRemarkEmitter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
OrderedBasicBlock.cpp
OrderedInstructions.cpp
PHITransAddr.cpp
PhiValues.cpp [PhiValues] Remove redundant map searches 2019-11-23 10:32:56 +02:00
PostDominators.cpp [CodeMoverUtils] Added an API to check if an instruction can be safely 2019-11-22 21:29:08 +00:00
ProfileSummaryInfo.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
RegionPass.cpp
RegionPrinter.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ScalarEvolution.cpp [SCEV] Add a mode to skip classification when printing analysis 2019-11-21 10:24:19 -08:00
ScalarEvolutionAliasAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
ScalarEvolutionExpander.cpp
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
StackSafetyAnalysis.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
StratifiedSets.h
SyncDependenceAnalysis.cpp
SyntheticCountsUtils.cpp
TargetLibraryInfo.cpp [SVFS] Inject TLI Mappings in VFABI attribute. 2019-11-15 18:42:56 +00:00
TargetTransformInfo.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Trace.cpp
TypeBasedAliasAnalysis.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
TypeMetadataUtils.cpp
ValueLattice.cpp
ValueLatticeUtils.cpp
ValueTracking.cpp [ValueTracking] Add a basic version of isKnownNonInfinity and use it to detect more NoNaNs 2019-11-19 22:24:46 +01:00
VectorUtils.cpp [SVFS] Inject TLI Mappings in VFABI attribute. 2019-11-15 18:42:56 +00:00
VFABIDemangling.cpp [VFABI] Add LLVM internal mangling for vector functions. 2019-11-13 03:26:39 +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))

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