llvm-project/llvm/lib/Analysis
Mircea Trofin e4794ff5c6 [mlgo][nfc] Decouple TensorSpec from tensorflow.
The motivation is twofold:

1) Allow plugging in a different training-time evaluator, e.g.
   TFLite-based, etc.

2) Allow using TensorSpec for AOT, too, to support evolution: we start
   by extracting a superset of the features currently supported by a
   model. For the tensors the model does not support, we just return a
   valid, but useless, buffer. This makes using a 'smaller' model (less
   supported tensors) transparent to the compiler. The key is to
   dimension the buffer appropriately, and we already have TensorSpec
   modeling that info.

The only coupling was due to the reliance of a TF internal API for
getting the element size, but for the types we are interested in,
`sizeof` is sufficient.

A subsequent change will yank out TensorSpec in its own module.

Differential Revision: https://reviews.llvm.org/D124045
2022-04-21 15:37:01 -07:00
..
models [MLGO] ML Regalloc Eviction Advisor 2022-01-19 11:00:32 -08:00
AliasAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
AliasAnalysisEvaluator.cpp Cleanup includes: final pass 2022-03-29 09:00:21 +02:00
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
Analysis.cpp Reapply CycleInfo: Introduce cycles as a generalization of loops 2021-12-10 14:36:43 +05:30
AssumeBundleQueries.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
AssumptionCache.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
BasicAliasAnalysis.cpp [CaptureTracking] Ignore ephemeral values in EarliestEscapeInfo 2022-04-08 10:07:26 -07:00
BlockFrequencyInfo.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
BlockFrequencyInfoImpl.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
BranchProbabilityInfo.cpp [NFC] Add missing <map> includes 2022-01-19 12:29:03 +01:00
CFG.cpp
CFGPrinter.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
CFLAndersAliasAnalysis.cpp
CFLGraph.h
CFLSteensAliasAnalysis.cpp [llvm] Remove redundant member initialization (NFC) 2022-01-07 17:45:09 -08:00
CGSCCPassManager.cpp [CGSCC] Use make_early_inc_range. NFC 2022-03-23 15:31:09 -07:00
CMakeLists.txt [NFC][mlgo]Make the test model generator inlining-specific 2021-12-22 13:38:45 -08:00
CallGraph.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
CallGraphSCCPass.cpp [LegacyPassManager] Move structural hashing into Pass classes. NFC. 2022-03-17 09:51:12 +00:00
CallPrinter.cpp [CallPrinter] Port CallPrinter passes to new pass manager 2022-04-18 10:02:18 -07:00
CaptureTracking.cpp [CaptureTracking] Ignore ephemeral values in EarliestEscapeInfo 2022-04-08 10:07:26 -07:00
CmpInstAnalysis.cpp [InstCombine][Analysis] Move getFCmpCode and getPredForFCmpCode to CmpInstAnalysis. NFC 2022-03-03 09:33:24 -08:00
CodeMetrics.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ConstantFolding.cpp [ConstFold] Don't fold calls with mismatching function type 2022-03-11 14:09:23 +01:00
ConstraintSystem.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
CostModel.cpp [CostModel] Change printer pass wording to work with update_analyze_test_checks.py 2022-03-03 10:10:48 -08:00
CycleAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
DDG.cpp [llvm] Use = default (NFC) 2022-02-06 22:18:35 -08:00
DDGPrinter.cpp
Delinearization.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
DemandedBits.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
DependenceAnalysis.cpp [DA] Refactor with a better API 2022-04-13 14:51:48 -04:00
DependenceGraphBuilder.cpp [NFC] Remove unnecessary #includes 2022-02-04 21:22:41 -08:00
DevelopmentModeInlineAdvisor.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
DivergenceAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
DomPrinter.cpp Introduce NewPM .dot printers for DomTree 2022-01-05 23:25:40 +00:00
DomTreeUpdater.cpp [DomTreeUpdater] Remove deprecated methods 2022-04-20 12:14:29 +02:00
DominanceFrontier.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
EHPersonalities.cpp
FunctionPropertiesAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
GlobalsModRef.cpp [GlobalsModRef][FIX] Ensure we honor synchronizing effects of intrinsics 2022-04-12 16:42:50 -05:00
GuardUtils.cpp
HeatUtils.cpp [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00:00
IRSimilarityIdentifier.cpp [IRSim] Ignore debug instructions when creating canonical numbering 2022-04-19 13:18:28 -05:00
IVDescriptors.cpp [IVDescriptors] Bail out instead of asserting that order is expected. 2022-03-07 19:57:26 +00:00
IVUsers.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ImportedFunctionsInliningStatistics.cpp
IndirectCallPromotionAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
InlineAdvisor.cpp [Analysis] Apply clang-tidy fixes for readability-redundant-smartptr-get (NFC) 2022-03-20 18:21:40 -07:00
InlineCost.cpp [InlineCost] Check that function types match 2022-04-12 11:05:33 +02:00
InlineSizeEstimatorAnalysis.cpp Fix build breaks on ml-* bots introduced by include cleanups 2022-03-01 11:29:18 -08:00
InstCount.cpp
InstructionPrecedenceTracking.cpp Revert "[IPT] Restructure cache to allow lazy update following invalidation [NFC]" 2021-10-21 10:48:41 -07:00
InstructionSimplify.cpp [FPEnv][InstSimplify] Fold fsub -0.0, -X ==> X 2022-04-14 11:48:54 -04:00
Interval.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
IntervalPartition.cpp [llvm] Use range-based for loops (NFC) 2021-11-20 18:42:10 -08:00
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp Add missing include under EXPENSIVE_CHECKS 2022-03-12 18:54:29 +01:00
LazyValueInfo.cpp [NFC] Add LazyValueInfo::clear method 2022-03-15 17:52:50 +07:00
LegacyDivergenceAnalysis.cpp [NFC] Remove unnecessary #includes 2022-02-04 21:22:41 -08:00
Lint.cpp [Lint][Verifier] NFC: Rename 'Assert*' macros to 'Check*'. 2022-04-05 15:34:35 -04:00
Loads.cpp [Loads] Check type size in bits during store to load forwarding 2022-04-08 17:29:29 +02:00
LoopAccessAnalysis.cpp [Analysis] Apply clang-tidy fixes for readability-redundant-smartptr-get (NFC) 2022-03-20 18:21:40 -07:00
LoopAnalysisManager.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
LoopCacheAnalysis.cpp [Analysis] Apply clang-tidy fixes for readability-redundant-smartptr-get (NFC) 2022-03-20 18:21:40 -07:00
LoopInfo.cpp Fix warnings about variables that are set but only used in debug mode 2022-04-06 10:01:46 +03:00
LoopNestAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
LoopPass.cpp [LegacyPassManager] Move structural hashing into Pass classes. NFC. 2022-03-17 09:51:12 +00:00
LoopUnrollAnalyzer.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
MLInlineAdvisor.cpp Fix build breaks on ml-* bots introduced by include cleanups 2022-03-01 11:29:18 -08:00
MemDepPrinter.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
MemDerefPrinter.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
MemoryBuiltins.cpp Revert "[ValueTracking] Make getStringLenth aware of strdup" 2022-04-13 19:17:28 +02:00
MemoryDependenceAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
MemoryLocation.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
MemorySSA.cpp [MSSA] Print memory phis when inspecting walker. 2022-04-06 16:06:14 -07:00
MemorySSAUpdater.cpp Fix MemorySSAUpdater::insertDef for dead code 2022-03-31 16:32:35 -07:00
ModelUnderTrainingRunner.cpp [NFC][MLGO] Remove the word "inliner" in a generic error message. 2022-01-11 12:39:16 -08:00
ModuleDebugInfoPrinter.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ModuleSummaryAnalysis.cpp [LTO] Initialize canAutoHide() using canBeOmittedFromSymbolTable() 2022-03-03 19:04:11 -05:00
MustExecute.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
NoInferenceModelRunner.cpp [NFC][MLGO]Add RTTI support for MLModelRunner and simplify runner setup 2022-01-04 19:46:14 -08:00
ObjCARCAliasAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp [ObjCARC] Use "UnsafeClaimRV" to refer to unsafeClaim in enums. NFC. 2022-01-24 19:37:01 -08:00
OptimizationRemarkEmitter.cpp [Analysis] Apply clang-tidy fixes for readability-redundant-smartptr-get (NFC) 2022-03-20 18:21:40 -07:00
OverflowInstAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
PHITransAddr.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
PhiValues.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
PtrUseVisitor.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
README.txt
RegionInfo.cpp [NFC] Remove unnecessary #includes 2022-02-04 21:22:41 -08:00
RegionPass.cpp [LegacyPassManager] Move structural hashing into Pass classes. NFC. 2022-03-17 09:51:12 +00:00
RegionPrinter.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ReplayInlineAdvisor.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ScalarEvolution.cpp [SCEV] Use constant ranges when determining reachable blocks (PR54434) 2022-03-18 12:04:35 +01:00
ScalarEvolutionAliasAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ScalarEvolutionDivision.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ScalarEvolutionNormalization.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
ScopedNoAliasAA.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
StackLifetime.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
StackSafetyAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
StratifiedSets.h
SyncDependenceAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
SyntheticCountsUtils.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
TFUtils.cpp [mlgo][nfc] Decouple TensorSpec from tensorflow. 2022-04-21 15:37:01 -07:00
TargetLibraryInfo.cpp [TLI] Check that malloc argument has type size_t 2022-03-14 17:22:24 +01:00
TargetTransformInfo.cpp [SLP] Refactoring isLegalBroadcastLoad() to use `ElementCount`. 2022-04-21 10:19:00 -07:00
Trace.cpp
TypeBasedAliasAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
TypeMetadataUtils.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
VFABIDemangling.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
ValueLattice.cpp
ValueLatticeUtils.cpp [SCCP] Check that load/store and global type match 2022-02-11 11:01:18 +01:00
ValueTracking.cpp Revert "[ValueTracking] Make getStringLenth aware of strdup" 2022-04-13 19:17:28 +02:00
VectorUtils.cpp [DAG]Introduce llvm::processShuffleMasks and use it for shuffles in DAG Type Legalizer. 2022-04-20 09:37:16 -07:00

README.txt

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

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