llvm-project/llvm/lib/Analysis
Fangrui Song cf9e61a9bb [LTO][WPD] Simplify mustBeUnreachableFunction and test after D115492
An well-formed IR function definition must have an entry basic block and
a well-formed IR basic block must have one terminator so the emptiness
check can be simplified.
Also simplify the test a bit.

Reviewed By: luna

Differential Revision: https://reviews.llvm.org/D115780
2021-12-15 15:43:35 -08:00
..
models
AliasAnalysis.cpp [llvm] Use range-based for loops (NFC) 2021-12-05 08:33:02 -08:00
AliasAnalysisEvaluator.cpp
AliasAnalysisSummary.cpp
AliasAnalysisSummary.h
AliasSetTracker.cpp
Analysis.cpp Reapply CycleInfo: Introduce cycles as a generalization of loops 2021-12-10 14:36:43 +05:30
AssumeBundleQueries.cpp Make various assume bundle data structures use uint64_t 2021-10-13 10:38:41 -07:00
AssumptionCache.cpp [InferAddressSpaces] Support assumed addrspaces from addrspace predicates. 2021-11-08 16:51:57 -05:00
BasicAliasAnalysis.cpp [BasicAA] Use index size instead of pointer size 2021-11-07 18:56:11 +01:00
BlockFrequencyInfo.cpp
BlockFrequencyInfoImpl.cpp [NFC] Use Optional<ProfileCount> to model invalid counts 2021-11-14 19:03:30 -08:00
BranchProbabilityInfo.cpp [BPI] Look-up tables for non-loop branches. NFC. 2021-11-22 10:30:42 +00:00
CFG.cpp
CFGPrinter.cpp
CFLAndersAliasAnalysis.cpp
CFLGraph.h
CFLSteensAliasAnalysis.cpp
CGSCCPassManager.cpp [NewPM] Add option to prevent rerunning function pipeline on functions in CGSCC adaptor 2021-11-17 09:06:46 -08:00
CMakeLists.txt [NFC][MLGO] Factor ModelUnderTrainingRunner for reuse 2021-12-10 11:24:15 -08:00
CallGraph.cpp
CallGraphSCCPass.cpp
CallPrinter.cpp Revert "[NFC] Remove LinkAll*.h" 2021-11-02 09:08:09 -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 [CodeMetrics] Don't require speculatability for ephemeral values 2021-10-21 20:30:01 +02:00
ConstantFolding.cpp [ConstantFold] Handle same type in ConstantFoldLoadThroughBitcast 2021-12-10 16:39:50 +01:00
ConstraintSystem.cpp
CostModel.cpp Port the cost model printer to New PM 2021-09-08 14:47:05 -07:00
CycleAnalysis.cpp Reapply CycleInfo: Introduce cycles as a generalization of loops 2021-12-10 14:36:43 +05:30
DDG.cpp
DDGPrinter.cpp
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
DevelopmentModeInlineAdvisor.cpp [NFC][MLGO] Factor ModelUnderTrainingRunner for reuse 2021-12-10 11:24:15 -08:00
DivergenceAnalysis.cpp [DA][NFC] Update publication - add remarks 2021-11-22 12:58:19 +01:00
DomPrinter.cpp Revert "[NFC] Remove LinkAll*.h" 2021-11-02 09:08:09 -07:00
DomTreeUpdater.cpp
DominanceFrontier.cpp
EHPersonalities.cpp
FunctionPropertiesAnalysis.cpp
GlobalsModRef.cpp
GuardUtils.cpp
HeatUtils.cpp [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00:00
IRSimilarityIdentifier.cpp [LLVM][NFC]Inclusive language: remove occurances of sanity check/test from llvm 2021-11-24 17:29:55 -05:00
IVDescriptors.cpp [LV] Mark various functions as const (NFC). 2021-12-09 10:51:29 +00:00
IVUsers.cpp [IVUsers] Move preheader check into SCEVExpander 2021-10-14 21:52:31 +02:00
ImportedFunctionsInliningStatistics.cpp
IndirectCallPromotionAnalysis.cpp
InlineAdvisor.cpp [InlineAdvisor] Add option to control deferred inlining (NFC) 2021-12-14 15:46:11 +01:00
InlineCost.cpp [llvm] Use isa instead of dyn_cast (NFC) 2021-11-14 19:40:46 -08:00
InlineSizeEstimatorAnalysis.cpp [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00: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 [InstSimplify] Simplify bool icmp with not in LHS 2021-12-09 16:26:46 -05:00
Interval.cpp
IntervalPartition.cpp [llvm] Use range-based for loops (NFC) 2021-11-20 18:42:10 -08:00
LazyBlockFrequencyInfo.cpp
LazyBranchProbabilityInfo.cpp
LazyCallGraph.cpp [LazyCallGraph] Skip blockaddresses 2021-11-01 13:10:24 -07:00
LazyValueInfo.cpp [LVI] Drop requirement that modulus is constant 2021-11-20 21:06:08 +01:00
LegacyDivergenceAnalysis.cpp
Lint.cpp Put implementation details into anonymous namespaces. NFCI. 2021-11-07 15:18:30 +01:00
Loads.cpp [Loads] Handle addrspacecast constant expressions when determining dereferenceability 2021-11-16 11:17:57 -08:00
LoopAccessAnalysis.cpp [LAA] Use type sizes when determining dependence. 2021-12-08 15:00:58 +00:00
LoopAnalysisManager.cpp
LoopCacheAnalysis.cpp Use llvm::any_of and llvm::none_of (NFC) 2021-10-24 17:35:33 -07:00
LoopInfo.cpp [LoopInfo] Fix function getInductionVariable 2021-11-11 16:22:42 +08:00
LoopNestAnalysis.cpp LoopNest Analysis expansion to return instructions that prevent a Loop 2021-08-17 22:25:49 +00:00
LoopPass.cpp
LoopUnrollAnalyzer.cpp
MLInlineAdvisor.cpp [NFC][mlgo] Generalize model runner interface 2021-12-08 20:10:58 -08:00
MemDepPrinter.cpp
MemDerefPrinter.cpp [NFC] Remove more calls to getAlignment() 2021-12-15 14:40:57 -08:00
MemoryBuiltins.cpp [NFC] Replace some deprecated getAlignment() calls with getAlign() 2021-12-09 08:43:19 -08:00
MemoryDependenceAnalysis.cpp [llvm] Use range-based for loops (NFC) 2021-11-20 18:42:10 -08:00
MemoryLocation.cpp Revert "[MemoryLocation] Handle memset_pattern{4,8,16} in getForDest." 2021-12-14 14:48:47 +00:00
MemorySSA.cpp [CSSPGO] Unblock optimizations with pseudo probe instrumentation part 3. 2021-10-12 09:44:12 -07:00
MemorySSAUpdater.cpp [llvm] Use range-based for loops (NFC) 2021-11-18 09:09:52 -08:00
ModelUnderTrainingRunner.cpp [NFC][MLGO] Factor ModelUnderTrainingRunner for reuse 2021-12-10 11:24:15 -08:00
ModuleDebugInfoPrinter.cpp
ModuleSummaryAnalysis.cpp [LTO][WPD] Simplify mustBeUnreachableFunction and test after D115492 2021-12-15 15:43:35 -08:00
MustExecute.cpp
NoInferenceModelRunner.cpp Ensure newlines at the end of files (NFC) 2021-12-12 11:04:44 -08:00
ObjCARCAliasAnalysis.cpp
ObjCARCAnalysisUtils.cpp
ObjCARCInstKind.cpp [llvm] Use range-based for loops (NFC) 2021-11-18 09:09:52 -08:00
OptimizationRemarkEmitter.cpp
OverflowInstAnalysis.cpp Ensure newlines at the end of files (NFC) 2021-10-23 08:45:29 -07:00
PHITransAddr.cpp [LLVM][NFC]Inclusive language: remove occurances of sanity check/test from llvm 2021-11-24 17:29:55 -05:00
PhiValues.cpp
PostDominators.cpp
ProfileSummaryInfo.cpp [NFC] Use Optional<ProfileCount> to model invalid counts 2021-11-14 19:03:30 -08:00
PtrUseVisitor.cpp
README.txt
RegionInfo.cpp Revert "[NFC] Remove LinkAll*.h" 2021-11-02 09:08:09 -07:00
RegionPass.cpp [RegionPass] Added check for -filter-print-funcs option to the region IR dumps. 2021-11-30 12:30:15 -05:00
RegionPrinter.cpp
ReleaseModeModelRunner.cpp [NFC][mlgo] Generalize model runner interface 2021-12-08 20:10:58 -08:00
ReplayInlineAdvisor.cpp [InlineAdvisor] Add fallback/format switches and negative remark processing to Replay Inliner 2021-10-29 12:32:03 -07:00
ScalarEvolution.cpp [SCEV] Fix unused variable warning (NFC) 2021-12-11 21:03:54 +01:00
ScalarEvolutionAliasAnalysis.cpp [SCEVAA] Avoid forming malformed pointer diff expressions 2021-11-17 12:38:04 -08:00
ScalarEvolutionDivision.cpp
ScalarEvolutionNormalization.cpp
ScopedNoAliasAA.cpp
StackLifetime.cpp [NPM] Added -print-pipeline-passes print params for a few passes. 2021-09-15 08:34:04 +02:00
StackSafetyAnalysis.cpp [stack-safety] Check SCEV constraints at memory instructions. 2021-11-23 15:29:23 -08:00
StratifiedSets.h
SyncDependenceAnalysis.cpp [DA][NFC] Update publication - add remarks 2021-11-22 12:58:19 +01:00
SyntheticCountsUtils.cpp
TFUtils.cpp [NFC][MLGO] Use std::move when moving protobufs 2021-08-20 13:40:35 -07: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 [VP] getVPMemoryOpCost interface 2021-12-06 11:27:07 -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 [LLVM][NFC]Inclusive language: remove occurances of sanity check/test from llvm 2021-11-24 17:29:55 -05:00
ValueLattice.cpp
ValueLatticeUtils.cpp
ValueTracking.cpp [NFC] Remove more calls to getAlignment() 2021-12-15 14:40:57 -08: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))

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