llvm-project/llvm/lib/Analysis
Arthur Eubanks 53e5e58670 [NewPM][Inliner] Make inlined calls to functions in same SCC as callee exponentially expensive
Introduce a new attribute "function-inline-cost-multiplier" which
multiplies the inline cost of a call site (or all calls to a callee) by
the multiplier.

When processing the list of calls created by inlining, check each call
to see if the new call's callee is in the same SCC as the original
callee. If so, set the "function-inline-cost-multiplier" attribute of
the new call site to double the original call site's attribute value.
This does not happen when the original call site is intra-SCC.

This is an alternative to D120584, which marks the call sites as
noinline.

Hopefully fixes PR45253.

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D121084
2022-03-07 23:51:09 -08: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: LLVMAnalysis 2022-03-01 18:01:54 +01: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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01: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 [CFG] Move reachable from entry checks into basic block variant 2021-05-15 15:42:02 +02:00
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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01: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 Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
CallPrinter.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
CaptureTracking.cpp [llvm] Use = default (NFC) 2022-02-06 22:18:35 -08: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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
DependenceGraphBuilder.cpp [NFC] Remove unnecessary #includes 2022-02-04 21:22:41 -08:00
DevelopmentModeInlineAdvisor.cpp [llvm] Remove uses of `std::vector<bool>` 2022-01-18 18:20:45 +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 [NFC] Remove unnecessary "#include"s from header files 2022-02-23 01:20:48 -08: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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
GuardUtils.cpp
HeatUtils.cpp [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00:00
IRSimilarityIdentifier.cpp [IRSim] Make sure that commutative intrinsics are treated as function calls without commutativity 2022-02-02 13:24:56 -06: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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
InlineCost.cpp [NewPM][Inliner] Make inlined calls to functions in same SCC as callee exponentially expensive 2022-03-07 23:51:09 -08: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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01: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 Revert "Add missing include under EXPENSIVE_CHECK" 2022-03-03 07:56:34 +01:00
LazyValueInfo.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
LegacyDivergenceAnalysis.cpp [NFC] Remove unnecessary #includes 2022-02-04 21:22:41 -08:00
Lint.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
Loads.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
LoopAccessAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
LoopAnalysisManager.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
LoopCacheAnalysis.cpp [llvm] Remove redundant member initialization (NFC) 2022-01-07 17:45:09 -08:00
LoopInfo.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
LoopNestAnalysis.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
LoopPass.cpp Fix -DLLVM_ENABLE_EXPENSIVE_CHECKS=on build after D120659 2022-03-01 11:36:25 -08: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 getAllocAlignment: respect allocalign attribute if present 2022-03-04 15:57:54 -05: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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
MemorySSAUpdater.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01: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
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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01: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] Enable verification under EXPENSIVE_CHECKS 2022-03-07 09:53:00 +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
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] Add support for multiple training traces per module 2022-01-11 16:13:31 -08:00
TargetLibraryInfo.cpp Revert "Revert "Use VersionTuple for parsing versions in Triple, fixing issues that caused the original change to be reverted. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible."" 2021-12-07 23:15:21 +00:00
TargetTransformInfo.cpp Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01: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 Cleanup includes: LLVMAnalysis 2022-03-01 18:01:54 +01:00
VectorUtils.cpp [Analysis] add utility function for unary shuffle mask creation 2021-10-18 09:00:39 -04: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))

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