llvm-project/llvm/lib/Analysis
Nikita Popov 2a2a37d972 [IVUsers] Check for preheader instead of loop simplify form
IVUsers currently makes sure that all loops dominating a user are
in loop simplify form, because SCEVExpander needs a preheader to
insert into. However, loop simplify form requires much more than
that. In particular, it requires dedicated exits, which means that
exits need to be found and walked. For large functions with many
nested loops, this can result in pathological compile-time explosion.

Fix this by only checking the property we're actually interested in,
which is incidentally cheap to check.

Differential Revision: https://reviews.llvm.org/D111493
2021-10-11 23:13:13 +02:00
..
models Unpack the CostEstimate feature in ML inlining models. 2021-07-02 16:57:16 +00:00
AliasAnalysis.cpp [Analysis, CodeGen] Migrate from arg_operands to args (NFC) 2021-10-03 08:22:20 -07:00
AliasAnalysisEvaluator.cpp [AA] Updates for D95543. 2021-04-15 12:22:03 +03:00
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
Analysis.cpp
AssumeBundleQueries.cpp [Attributes] Replace doesAttrKindHaveArgument() (NFC) 2021-07-12 21:57:26 +02:00
AssumptionCache.cpp Use AssumeInst in a few more places [nfc] 2021-04-06 13:18:53 -07:00
BasicAliasAnalysis.cpp re-land "[AA] Teach BasicAA to recognize basic GEP range information." 2021-10-11 10:04:22 +02:00
BlockFrequencyInfo.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
BlockFrequencyInfoImpl.cpp [CSSPGO][NFC] Allow cl::ZeroOrMore for use-iterative-bfi-inference 2021-07-18 13:22:32 -07:00
BranchProbabilityInfo.cpp [Analaysis, CodeGen] Remove getHotSucc (NFC) 2021-07-17 07:31:36 -07:00
CFG.cpp [CFG] Move reachable from entry checks into basic block variant 2021-05-15 15:42:02 +02:00
CFGPrinter.cpp Use `-cfg-func-name` value as filter for `-view-cfg`, etc. 2021-06-16 23:54:51 +02:00
CFLAndersAliasAnalysis.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
CFLGraph.h [CFLGraph] Fix a crash due to missing handling of freeze 2021-03-21 02:14:13 +09:00
CFLSteensAliasAnalysis.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
CGSCCPassManager.cpp [NFC] Remove FIXMEs about calling LLVMContext::yield() 2021-09-17 14:59:34 -07:00
CMakeLists.txt [MLGO] Update the current model url for the Oz inliner model. 2021-08-04 03:09:00 +00:00
CallGraph.cpp Set IgnoreLLVMUsed to false in CallGraph::addToCallGraph() 2021-04-08 11:14:09 -07:00
CallGraphSCCPass.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
CallPrinter.cpp Support: Stop using F_{None,Text,Append} compatibility synonyms, NFC 2021-04-30 11:00:03 -07:00
CaptureTracking.cpp Recommit "[DSE] Track earliest escape, use for loads in isReadClobber." 2021-09-24 17:13:27 +01:00
CmpInstAnalysis.cpp [APInt] Stop using soft-deprecated constructors and methods in llvm. NFC. 2021-10-04 08:57:44 +01:00
CodeMetrics.cpp Revert "[AssumptionCache] Avoid dangling llvm.assume calls in the cache" 2021-02-11 12:17:38 -06:00
ConstantFolding.cpp [ConstantFold] Refactor load folding 2021-10-05 18:07:57 +02:00
ConstraintSystem.cpp [llvm] Remove redundant string initialization (NFC) 2021-01-12 21:43:46 -08:00
CostModel.cpp Port the cost model printer to New PM 2021-09-08 14:47:05 -07:00
DDG.cpp [Analysis] Use llvm::append_range (NFC) 2021-01-22 23:25:01 -08:00
DDGPrinter.cpp Support: Stop using F_{None,Text,Append} compatibility synonyms, NFC 2021-04-30 11:00:03 -07:00
Delinearization.cpp [SCEV] Move getIndexExpressionsFromGEP to delinearize [NFC] 2021-09-08 16:56:49 -07:00
DemandedBits.cpp [APInt] Normalize naming on keep constructors / predicate methods. 2021-09-09 09:50:24 -07:00
DependenceAnalysis.cpp [APInt] Normalize naming on keep constructors / predicate methods. 2021-09-09 09:50:24 -07:00
DependenceGraphBuilder.cpp [Analysis] Use llvm::append_range (NFC) 2021-01-22 23:25:01 -08:00
DevelopmentModeInlineAdvisor.cpp [MLGO] Make sure inliner logs when deleting callees 2021-08-23 14:54:46 -07:00
DivergenceAnalysis.cpp [Analysis] Use range-based for loops (NFC) 2021-02-22 20:17:18 -08:00
DomPrinter.cpp
DomTreeUpdater.cpp [NFCI][DomTreeUpdater] applyUpdates(): reserve space for updates first 2021-04-11 23:56:22 +03:00
DominanceFrontier.cpp
EHPersonalities.cpp [XCOFF] Handle the case when personality routine is an alias 2021-04-29 22:03:30 +00:00
FunctionPropertiesAnalysis.cpp [llvm] Ensure newlines at the end of files (NFC) 2021-01-10 09:24:57 -08:00
GlobalsModRef.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
GuardUtils.cpp
HeatUtils.cpp [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00:00
IRSimilarityIdentifier.cpp [IRSim] Adding support for recognizing branch similarity 2021-09-06 11:55:38 -07:00
IVDescriptors.cpp [LoopVectorize] Permit vectorisation of more select(cmp(), X, Y) reduction patterns 2021-10-11 09:41:38 +01:00
IVUsers.cpp [IVUsers] Check for preheader instead of loop simplify form 2021-10-11 23:13:13 +02:00
ImportedFunctionsInliningStatistics.cpp [Analysis] ImportedFunctionsInliningStatistics.h - add <memory> and remove unused <string> include. NFCI. 2021-04-19 16:20:56 +01:00
IndirectCallPromotionAnalysis.cpp [SampleFDO] Another fix to prevent repeated indirect call promotion in 2021-03-04 18:44:12 -08:00
InlineAdvisor.cpp [inliner] Mandatory inlining decisions produce remarks 2021-10-05 14:01:25 -07:00
InlineCost.cpp [InlineCost] model calls to llvm.is.constant* more carefully 2021-10-08 15:27:30 -07:00
InlineSizeEstimatorAnalysis.cpp [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00:00
InstCount.cpp
InstructionPrecedenceTracking.cpp [IPT] Add a statistic to track instructions scanned to answer queries 2021-10-08 10:59:35 -07:00
InstructionSimplify.cpp [KnownBits] Introduce `countMaxActiveBits()` and use it in a few places 2021-10-11 23:36:06 +03:00
Interval.cpp [Analysis/Interval] Remove isLoop (NFC) 2020-12-12 10:09:35 -08:00
IntervalPartition.cpp
LazyBlockFrequencyInfo.cpp Make dependency between certain analysis passes transitive (reapply) 2021-05-05 15:17:55 +02:00
LazyBranchProbabilityInfo.cpp Make dependency between certain analysis passes transitive (reapply) 2021-05-05 15:17:55 +02:00
LazyCallGraph.cpp [LCG] Don't skip invalidation of LazyCallGraph if CFG analyses are preserved 2021-10-11 13:30:47 -07:00
LazyValueInfo.cpp [APInt] Stop using soft-deprecated constructors and methods in llvm. NFC. 2021-10-04 08:57:44 +01:00
LegacyDivergenceAnalysis.cpp [NewPM] Introduce (GPU)DivergenceAnalysis in the new pass manager 2021-02-16 10:26:45 +05:30
Lint.cpp [NFC] Remove AttributeList::hasParamAttribute() 2021-08-13 10:58:21 -07:00
Loads.cpp Fix incorrect GEP bitwidth in areNonOverlapSameBaseLoadAndStore() 2021-09-28 17:57:36 +01:00
LoopAccessAnalysis.cpp Recommit "[LAA] Support pointer phis in loop by analyzing each incoming pointer." 2021-09-14 11:19:12 +01:00
LoopAnalysisManager.cpp [NewPM] Don't mark AA analyses as preserved 2021-05-18 13:49:03 -07:00
LoopCacheAnalysis.cpp Move delinearization logic out of SCEV [NFC] 2021-09-08 12:28:35 -07:00
LoopInfo.cpp [OpenMP][OpenMPIRBuilder] Implement loop unrolling. 2021-09-04 19:18:58 -05:00
LoopNestAnalysis.cpp LoopNest Analysis expansion to return instructions that prevent a Loop 2021-08-17 22:25:49 +00:00
LoopPass.cpp [Analysis] Use llvm::erase_value (NFC) 2020-12-14 22:40:13 -08:00
LoopUnrollAnalyzer.cpp [unroll] Use value domain for symbolic execution based cost model 2021-05-26 08:41:25 -07:00
MLInlineAdvisor.cpp Unpack the CostEstimate feature in ML inlining models. 2021-07-02 16:57:16 +00:00
MemDepPrinter.cpp [Analysis] Remove dead function getInstTypePair (NFC) 2020-12-19 10:57:35 -08:00
MemDerefPrinter.cpp Minor format tweak to deref analysis printer 2021-03-22 18:44:18 -07:00
MemoryBuiltins.cpp MemoryBuiltins: update comment; NFC 2021-09-21 13:47:26 -07:00
MemoryDependenceAnalysis.cpp [NFC] MemoryDependenceAnalysis cleanup. 2021-05-31 18:07:55 +03:00
MemoryLocation.cpp [IR] Return AAMDNodes from Instruction::getMetadata() (NFC) 2021-09-16 21:06:57 +02:00
MemorySSA.cpp [MemorySSA] Fix "set but not used" warnings 2021-09-15 11:41:41 -07:00
MemorySSAUpdater.cpp [llvm] Use pop_back_val (NFC) 2021-09-19 13:44:23 -07:00
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp [IR][NFC] Rename getBaseObject to getAliaseeObject 2021-10-06 19:33:10 -07:00
MustExecute.cpp [MustExecute] Use ListSeparator (NFC) 2021-01-28 22:21:16 -08:00
ObjCARCAliasAnalysis.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
ObjCARCAnalysisUtils.cpp [NFC] Reduce include files dependency. 2020-12-03 18:25:05 +03:00
ObjCARCInstKind.cpp [ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of 2021-03-04 11:22:30 -08:00
OptimizationRemarkEmitter.cpp [BPI] Improve static heuristics for "cold" paths. 2020-12-23 22:47:36 +07:00
OverflowInstAnalysis.cpp Fix MSan crash after 1977c53b 2021-05-02 13:44:43 +09:00
PHITransAddr.cpp [InstSimplify] Don't lose inbounds when simplifying a GEP 2021-09-23 09:25:06 +01:00
PhiValues.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp [CSSPGO][llvm-profdata] Support trimming cold context when merging profiles 2021-04-22 00:42:37 -07:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp
RegionPass.cpp
RegionPrinter.cpp
ReleaseModeModelRunner.cpp [NFC][MLGO] Fix vector sizing 2021-07-22 13:06:00 -07:00
ReplayInlineAdvisor.cpp [InlineAdvisor] Add single quotes around caller/callee names 2021-08-10 11:51:31 -07:00
ScalarEvolution.cpp [SCEV] Extend trip count to avoid overflow by default 2021-10-11 09:55:55 -07:00
ScalarEvolutionAliasAnalysis.cpp Recommit [ScalarEvolution] Make getMinusSCEV() fail for unrelated pointers. 2021-07-06 12:16:05 -07:00
ScalarEvolutionDivision.cpp
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
StackLifetime.cpp [NPM] Added -print-pipeline-passes print params for a few passes. 2021-09-15 08:34:04 +02:00
StackSafetyAnalysis.cpp [IR][NFC] Rename getBaseObject to getAliaseeObject 2021-10-06 19:33:10 -07:00
StratifiedSets.h
SyncDependenceAnalysis.cpp [Analysis] Use ListSeparator (NFC) 2021-02-14 08:36:14 -08:00
SyntheticCountsUtils.cpp
TFUtils.cpp [NFC][MLGO] Use std::move when moving protobufs 2021-08-20 13:40:35 -07:00
TargetLibraryInfo.cpp [PS4][TargetLibraryInfo] Set TLI info correctly for PS4 2021-10-07 10:03:31 -07:00
TargetTransformInfo.cpp Reapply "[GlobalOpt][FIX] Do not embed initializers into AS!=0 globals"" 2021-09-10 15:22:56 -05:00
Trace.cpp
TypeBasedAliasAnalysis.cpp [IR] Re-group AAMDNodes relevant interfaces. NFC. 2021-09-21 14:29:33 -04:00
TypeMetadataUtils.cpp [GlobalDCE] In VFE, replace the whole 'sub' expression of unused relative-pointer-based vtable slots 2021-10-06 15:55:55 -07:00
VFABIDemangling.cpp [NFC] Change VFShape so it contains an ElementCount rather than seperate VF and IsScalable properties. 2021-07-26 12:25:46 +01:00
ValueLattice.cpp
ValueLatticeUtils.cpp
ValueTracking.cpp Add iterator range variants of isGuaranteedToTransferExecutionToSuccessor [mostly-nfc] 2021-10-08 09:50:10 -07:00
VectorUtils.cpp [LAA] Pass access type to getPtrStride() 2021-09-11 19:16:49 +02: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))

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